Changeset 374 for trunk/confmanlib.sh.in


Ignore:
Timestamp:
07/02/2009 14:26:52 (3 years ago)
Author:
blee
Message:

Replacing global variables with functions:

  • METADIR -> conf_meta_dir
  • RECIPEDIR -> conf_recipe_dir
  • RECIPE_PATH -> conf_recipe_path

Also deleted unused variable REPO_VERSION_FILE.

Also removed workarounds in conf_export and conf_revision.

Fixes #35

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/confmanlib.sh.in

    r373 r374  
    2929REPO_ACTION="${REPO_DB}/last_action" 
    3030REPO_SYNC_STATE="${REPO_DB}/state" 
    31 METADIR="${WORK_PATH}/meta" 
    32 RECIPEDIR="${METADIR}/recipes" 
    3331RECIPE_NAME="$(cat "$RECIPE_FILE" 2>/dev/null)" 
    34 RECIPE_PATH="${RECIPEDIR}/${RECIPE_NAME}" 
    3532 
    3633VERSION="1.9.a" 
    3734REPO_VERSION="2" 
    38 REPO_VERSION_FILE="${METADIR}/rversion" 
    3935 
    4036# Prints the repository URI 
     
    5349 
    5450        echo $uri 
     51} 
     52 
     53function conf_meta_dir { 
     54    echo "${WORK_PATH}/meta" 
     55} 
     56 
     57function conf_recipe_dir { 
     58    echo "$(conf_meta_dir)/recipes" 
     59} 
     60 
     61function conf_recipe_path { 
     62    echo "$(conf_recipe_dir)/${RECIPE_NAME}" 
    5563} 
    5664 
     
    256264            ;; 
    257265        recipe) 
    258             RECIPEDIR="${WORK_PATH}/meta/recipes" # until ticket #35 is resolved 
    259             for recipefile in ${RECIPEDIR}/*; do 
     266            for recipefile in $(conf_recipe_dir)/*; do 
    260267                modules="meta $(conf_get_recipe $recipefile)" 
    261                 tar -czf "$exportpath/${recipefile#$RECIPEDIR/}.tgz" -C "${WORK_PATH}" $modules 
     268                tar -czf "$exportpath/${recipefile#$(conf_recipe_dir)/}.tgz" -C "${WORK_PATH}" $modules 
    262269            done 
    263270            ;; 
     
    758765# Returns the current revision number of the repository on stdout 
    759766function conf_revision { 
    760     METADIR="${WORK_PATH}/meta" # until ticket #35 is resolved 
    761     @SVN@ info ${METADIR} | awk '/Last Changed Rev:/ {print $4}' 
     767    @SVN@ info $(conf_meta_dir) | awk '/Last Changed Rev:/ {print $4}' 
    762768} 
    763769 
     
    785791 
    786792    if [ -z "$recipe" ] ; then 
    787         recipe_file="$RECIPE_PATH" 
     793        recipe_file="$(conf_recipe_path)" 
    788794    fi 
    789795 
     
    815821function conf_recipe_create { 
    816822    local recipe="$1" 
    817     local recipe_file="${RECIPEDIR}/${recipe}" 
     823    local recipe_file="$(conf_recipe_dir)/${recipe}" 
    818824    if [ -f "${recipe_file}" ] ; then 
    819825        echo "Recipe $recipe already exists!" >&2 
     
    827833    local recipe="$1" 
    828834    local recipe_file="$2" 
    829     cat "$recipe_file" > "${RECIPEDIR}/${recipe}" 
    830     @SVN@ commit "${RECIPEDIR}/${recipe}" 
     835    cat "$recipe_file" > "$(conf_recipe_dir)/${recipe}" 
     836    @SVN@ commit "$(conf_recipe_dir)/${recipe}" 
    831837} 
    832838 
    833839function conf_remove_recipe { 
    834840    local recipe="$1" 
    835     local recipe_file="${RECIPEDIR}/${recipe}" 
     841    local recipe_file="$(conf_recipe_dir)/${recipe}" 
    836842    if ! [ -f "${recipe_file}" ] ; then 
    837843        echo "Recipe $recipe doesn't exist!" >&2 
Note: See TracChangeset for help on using the changeset viewer.