diff options
Diffstat (limited to 'fullpkg')
-rwxr-xr-x | fullpkg | 51 |
1 files changed, 38 insertions, 13 deletions
@@ -18,21 +18,25 @@ function usage { printf "and stage the packages on it's repo." echo echo "OPTIONS:" - echo " -h : this message." - echo " -f : build even when a package has been built." - echo " -n : set ABSROOT to this dir" + echo " -h : this message." + echo " -f : build even when a package has been built." + echo " -n absdir : set ABSROOT to this dir" echo " -r reponame : set repo name to reponame" + echo " -R pkgname : build pkgname if it is a dep" echo } force_build='n' +force_array=() +_fullpkgargs="" failed=() missing=() -while getopts 'hfn:r' arg; do +while getopts 'hfn:r:R:' arg; do case $arg in h) usage; exit 0 ;; f) force_build='y' ;; + R) force_array=(${force_array[@]} $OPTARG); _fullpkgargs+="-R $OPTARG ";; n) ABSROOT="$OPTARG" ;; r) repo="$OPTARG" ;; esac @@ -124,8 +128,20 @@ guess_repo() { basename $(dirname $(pwd)) } -# TODO keep track of spawned fullpkgs -quit() { +# usage : in_array( $needle, $haystack ) +# return : 0 - found +# 1 - not found +function in_array { + [[ $2 ]] || return 1 + local needle=$1; shift + local item + for item in "$@"; do + [[ ${item#@} = $needle ]] && return 0 + done + return 1 # Not Found +} + +function quit { remove_queue exit 1 } @@ -135,6 +151,8 @@ function cleanup { rm -rf $tmp_dir } +# TODO keep track of spawned fullpkgs + ## END FUNCTIONS ## source PKGBUILD @@ -190,12 +208,16 @@ for _dep in ${deps[@]}; do [[ -e "$ABSROOT/${_repo}/$_dep/PKGBUILD" ]] && { source "$ABSROOT/${_repo}/$_dep/PKGBUILD" msg2 "Checking for $_dep>=$pkgver-$pkgrel" - - if is_built "$_dep>=$pkgver-$pkgrel"; then - plain "this package is built" - break - fi - + + if ! in_array $_dep ${force_array[@]}; then + if is_built "$_dep>=$pkgver-$pkgrel"; then + plain "this package is built" + break + fi + else + _fullpkgargs+="-f " + fi + cp -r "$ABSROOT/$_repo/$_dep" $tmp_dir/ || { error "Can't copy $_dep to the work dir." exit 1 @@ -203,7 +225,8 @@ for _dep in ${deps[@]}; do # Enter the work dir and run this command in it pushd $tmp_dir/$_dep >/dev/null - $0 -r $_repo + + $0 -r $_repo $_fullpkgargs [[ $? -ne 0 ]] && { failed=(${failed[@]} $_dep) @@ -215,6 +238,8 @@ for _dep in ${deps[@]}; do done # TODO probably not elegant enough +# TODO only the last fullpkg should show this message +# and it should contain all failed pkgs [[ ${#failed[@]} -gt 0 ]] && { error "This packages failed to build: ${failed[@]}" exit 1 |