From 34fc8f48c893714be74e90d65b8e3132ae4ef6f0 Mon Sep 17 00:00:00 2001 From: Nicolas Reynolds Date: Thu, 9 Jun 2011 19:20:09 -0300 Subject: Implemented offline mode (aka don't use shared build queue) --- fullpkg | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) (limited to 'fullpkg') diff --git a/fullpkg b/fullpkg index f281df3..2ca5226 100755 --- a/fullpkg +++ b/fullpkg @@ -7,6 +7,12 @@ source /etc/abs.conf source /etc/libretools.conf source /usr/bin/libremessages +# Avoid /libretools dir doesn't exist errors +[ -z $XDG_CONFIG_HOME ] && { + error "There's no XDG_CONFIG_HOME var set" + exit 1 +} + [ -r $XDG_CONFIG_HOME/libretools/libretools.conf ] && \ source $XDG_CONFIG_HOME/libretools/libretools.conf @@ -27,6 +33,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)" # printf " -f pkgname : build even when a package has been built. " # printf " Use it as many times as needed\n" echo @@ -42,6 +49,8 @@ function usage { # Get the queue list from the server get_queue() { + [[ "$OFFLINE" = "true" ]] && return 0 + rsync -e ssh -aq $PARABOLAHOST:mips64el/queue $queue_file >/dev/null 2>&1 || { error "Failed to retrieve queue list" return 1 @@ -50,6 +59,8 @@ get_queue() { # Put the queue list on the server put_queue() { + [[ "$OFFLINE" = "true" ]] && return 0 + rsync -e ssh -aq $queue_file $PARABOLAHOST:mips64el/queue >/dev/null 2>&1 || { error "Failed to put queue list" return 1 @@ -65,6 +76,8 @@ update_queue() { # Remove a package from the queue remove_queue() { + [[ "$OFFLINE" = "true" ]] && return 0 + get_queue grep -Evw "^$(basename $PWD)" $queue_file > $queue_file.2 @@ -75,6 +88,8 @@ remove_queue() { # Checks if a package is listed check_queue() { + [[ "$OFFLINE" = "true" ]] && return 0 + get_queue local packager=$(grep -w "$(basename $PWD)" ${queue_file} | cut -d ':' -f2) @@ -161,17 +176,17 @@ function find_deps { # if search pkgname in repo doesn't work # this should find pkgsplits - elif _dir=($(find "$ABSROOT/${_repo}" -type f -name PKGBUILD -print0 2>/dev/null | \ - "xargs" -0 -e grep -HEw "pkgname=|pkgbase=|provides=" | grep -w "$_dep" 2>&1)); - then - _dir=$(dirname $(echo $_dir | cut -d: -f1)) - plain "guess for $_dep -> $_dir" - pushd $_dir > /dev/null - $0 -c -d ${build_dir} -l ${next_level} +# elif _dir=($(find "$ABSROOT/${_repo}" -type f -name PKGBUILD -print0 2>/dev/null | \ +# "xargs" -0 -e grep -HEw "pkgname=|pkgbase=|provides=" | grep -w "$_dep" 2>&1)); +# then +# _dir=$(dirname $(echo $_dir | cut -d: -f1)) +# plain "guess for $_dep -> $_dir" +# pushd $_dir > /dev/null +# $0 -c -d ${build_dir} -l ${next_level} # Circular deps must fail - [ $? -eq 20 ] && return 20 - popd > /dev/null - break 1 # found, go to next dep +# [ $? -eq 20 ] && return 20 +# popd > /dev/null +# break 1 # found, go to next dep else echo "dep_not_found:$_dep:$_repo" >> $build_dir/log @@ -307,7 +322,8 @@ build_only='n' check_deps_only='n' do_cleanup='n' max_level=21 -while getopts 'ha:bcCd:l:nm:r:' arg; do +OFFLINE=false +while getopts 'ha:bcCd:l:nm:r:o' arg; do case $arg in h) usage; exit 0 ;; a) ABSROOT="$OPTARG" ;; @@ -322,6 +338,7 @@ while getopts 'ha:bcCd:l:nm:r:' arg; do n) noupdate='y';; m) max_level=$OPTARG ;; r) FULLBUILDCMD="$OPTARG" ;; + o) OFFLINE=true ;; esac done -- cgit v1.2.3