summaryrefslogtreecommitdiff
path: root/fullpkg
diff options
context:
space:
mode:
authorNicolas Reynolds <fauno@kiwwwi.com.ar>2011-06-14 15:45:26 -0300
committerNicolas Reynolds <fauno@kiwwwi.com.ar>2011-06-14 15:45:26 -0300
commit26005b7e07f968e045cf19ae9ede9be6f5f0fad8 (patch)
treeab07d2c9a97157e6d9a1fc10bacfbe0cd54d4186 /fullpkg
parente8724e43c334dfe57882dbe2b5d8a83f37c25af0 (diff)
Better and working cleanup. Also fail early on missing PKGBUILD and add the
mips64el arch to the main PKGBUILD. TODO: make the arch configurable.
Diffstat (limited to 'fullpkg')
-rwxr-xr-xfullpkg50
1 files changed, 20 insertions, 30 deletions
diff --git a/fullpkg b/fullpkg
index 15d6cc1..9736d05 100755
--- a/fullpkg
+++ b/fullpkg
@@ -125,19 +125,13 @@ guess_repo() {
# Usage: cleanup [ $(basename $PWD) ] from PKGBUILD dir
# cleans the build_dir
function cleanup {
-# Already clean
- if [ ! -d $build_dir ]; then
- return 0
+# Do nothing OR
+# Already cleaned
+ [ "${do_cleanup}" = "n" || ! -d ${build_dir} ] && return 0
- elif [ -d $build_dir -a ${#@} -gt 0 ]; then
- for _dir in $@; do
- rm -rf $build_dir/$_dir/
- done
-
- else
-# Only do full cleanup on level 0
- [ $level -eq 0 ] && rm -rf $build_dir/*
- fi
+# Only do cleanup on level 0
+ msg "Cleaning up..."
+ [ $level -eq 0 ] && rm -rf $build_dir/*
}
# Check PKGBUILD and find non built or outdated deps
@@ -285,7 +279,6 @@ function _pkg_build () {
}
echo "built:$(basename $PWD)" >> $build_dir/log
- cleanup "$(basename $PWD)"
;;
###### Failed Build ######
*)
@@ -376,17 +369,24 @@ while getopts 'ha:bcCd:l:nm:r:o' arg; do
esac
done
+# Check if we are actually on a build directory
+# Do this early
+[ ! -r PKGBUILD ] && {
+ error "This isn't a build directory"
+ usage && exit 1
+}
+
+# Add mips64el if missing from arch=() and it isn't an 'any' package
+if ! grep mips64el PKGBUILD >/dev/null; then
+ plain "Adding mips64el arch"
+ sed -i "s/^\(arch=([^)anym]\+\))/\1 'mips64el')/" "PKGBUILD"
+fi
+
# Only on level 0
if [ $level -eq 0 ]; then
# if build_dir exist use it, else make a build_dir
build_dir=${build_dir:-$(mktemp -d /tmp/fullpkg.XXXXXX)}
-# cleanup if the option was used.
- [ $do_cleanup == 'y' ] && {
- cleanup
- [ $build_only == 'y' ] && exit 0
- }
-
# make files for log and buildorder
touch $build_dir/{log,BUILDORDER}
buildorder=$build_dir/BUILDORDER
@@ -405,15 +405,11 @@ if [ $level -eq 0 ]; then
msg "Checking dependencies"
fi
-[ ! -r PKGBUILD ] && {
- error "This isn't a build directory"
- usage && exit 1
-}
-
## if $level = 20 it's highly likely there are circular deps
[ $level -ge $max_level ] && exit 20
+# Tries to find deps and build order
find_deps || {
# if find_deps finds circular deps
# it should exit with status 20
@@ -458,12 +454,6 @@ msg "Building packages:"
OFFLINE=true
}
-# Add mips64el if missing from arch=() and it isn't an 'any' package
-if ! grep mips64el PKGBUILD >/dev/null; then
- plain "Adding mips64el arch"
- sed -i "s/^\(arch=([^)anym]\+\))/\1 'mips64el')/" "PKGBUILD"
-fi
-
# Build the package
_pkg_build