summaryrefslogtreecommitdiff
path: root/fullpkg
diff options
context:
space:
mode:
authorJoshua Ismael Haase Hernandez <hahj87@gmail.com>2011-05-19 13:25:47 -0500
committerJoshua Ismael Haase Hernandez <hahj87@gmail.com>2011-05-19 13:25:47 -0500
commitd53c7ad69c8f52513ee6c2f82b07af9b486c6d85 (patch)
treeff1a0d4be5a633161764ccf13492ce551b6d18be /fullpkg
parent5636a97ca66e432cc59a0dcaf2b05398150b4e1f (diff)
* fullpkg can be asked to rebuild some package if it's a dep
Diffstat (limited to 'fullpkg')
-rwxr-xr-xfullpkg51
1 files changed, 38 insertions, 13 deletions
diff --git a/fullpkg b/fullpkg
index 0088045..911a11c 100755
--- a/fullpkg
+++ b/fullpkg
@@ -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