diff options
-rwxr-xr-x | fullpkg | 27 |
1 files changed, 15 insertions, 12 deletions
@@ -16,6 +16,11 @@ source /usr/bin/libremessages [ -r $XDG_CONFIG_HOME/libretools/libretools.conf ] && \ source $XDG_CONFIG_HOME/libretools/libretools.conf +# set queue_file and ban_file +mkdir -p $XDG_CONFIG_HOME/libretools +queue_file=$XDG_CONFIG_HOME/libretools/queue +ban_file=$XDG_CONFIG_HOME/libretools/ban + ##### START FUNCTIONS ##### function usage { @@ -33,7 +38,7 @@ function usage { echo " -n : don't update pacman db." echo " -m max_level : check deps until this level" echo " -r \"command\" : use this instead of \"$FULLBUILDCMD\"" - echo " -o : work offline (avoid queue)" + echo " -o : work offline (avoid queuing)" # printf " -f pkgname : build even when a package has been built. " # printf " Use it as many times as needed\n" echo @@ -46,7 +51,7 @@ function usage { # Get the queue list from the server get_queue() { - [[ "$OFFLINE" = "true" ]] && return 0 + [[ "$OFFLINE" -eq true ]] && return 0 rsync -e ssh -aq $PARABOLAHOST:mips64el/queue $queue_file >/dev/null 2>&1 || { error "Failed to retrieve queue list" @@ -56,7 +61,7 @@ get_queue() { # Put the queue list on the server put_queue() { - [[ "$OFFLINE" = "true" ]] && return 0 + [[ "$OFFLINE" = true ]] && return 0 rsync -e ssh -aq $queue_file $PARABOLAHOST:mips64el/queue >/dev/null 2>&1 || { error "Failed to put queue list" @@ -73,7 +78,7 @@ update_queue() { # Remove a package from the queue remove_queue() { - [[ "$OFFLINE" = "true" ]] && return 0 + [[ "$OFFLINE" -eq true ]] && return 0 get_queue @@ -120,8 +125,9 @@ guess_repo() { # Usage: cleanup [ $(basename $PWD) ] from PKGBUILD dir # cleans the build_dir function cleanup { +# Already clean if [ ! -d $build_dir ]; then - return 1 + return 0 elif [ -d $build_dir -a ${#@} -gt 0 ]; then for _dir in $@; do @@ -129,7 +135,8 @@ function cleanup { done else - rm -rf $build_dir/* +# Only do full cleanup on level 0 + [ $level -eq 0 ] && rm -rf $build_dir/* fi } @@ -211,6 +218,7 @@ function find_deps { unset pkgname pkgver pkgrel epoch pkgdesc arch url license groups depends \ makedepens checkdepends optdepends provides conflicts replaces backup \ options install changelog source noextract md5sums build check package + } function _pkg_build () { @@ -379,11 +387,6 @@ if [ $level -eq 0 ]; then [ $build_only == 'y' ] && exit 0 } -# set queue_file and ban_file - mkdir -p $XDG_CONFIG_HOME/libretools - queue_file=$XDG_CONFIG_HOME/libretools/queue - ban_file=$XDG_CONFIG_HOME/libretools/ban - # make files for log and buildorder touch $build_dir/{log,BUILDORDER} buildorder=$build_dir/BUILDORDER @@ -439,7 +442,7 @@ find_deps || { search=$(cat $ban_file | tr "\n" "|") echo ${@} | tr " " "\n" | egrep -w "$search" $buildorder >> $build_dir/banned echo ${@} | tr " " "\n" | egrep -vw "$search" $buildorder > $buildorder.2 - cat $buildorder.2 > $buildorder + cat $buildorder.2 > $buildorder; rm $buildorder.2 unset search } } |