summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xfullpkg40
1 files changed, 15 insertions, 25 deletions
diff --git a/fullpkg b/fullpkg
index 55f9cdb..befc39f 100755
--- a/fullpkg
+++ b/fullpkg
@@ -136,19 +136,13 @@ get_full_version() {
# 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
@@ -296,7 +290,6 @@ function _pkg_build () {
}
echo "built:$(basename $PWD)" >> $build_dir/log
- cleanup "$(basename $PWD)"
;;
###### Failed Build ######
*)
@@ -386,22 +379,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
@@ -423,6 +418,7 @@ fi
## 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
@@ -468,12 +464,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