summaryrefslogtreecommitdiff
path: root/fullpkg-ng
diff options
context:
space:
mode:
authorJoshua Ismael Haase Hernandez <hahj87@gmail.com>2011-05-27 08:05:23 -0500
committerJoshua Ismael Haase Hernandez <hahj87@gmail.com>2011-05-27 08:05:23 -0500
commita0b449063079a27b63a8bd98f4736e3e7c50854d (patch)
treea20e1a1ae136a843f8c4c99ca2b43342500f321e /fullpkg-ng
parentcf2d9947da7ee62320ea094ae31b1d522adc4d73 (diff)
* Build cycle should continue
Diffstat (limited to 'fullpkg-ng')
-rwxr-xr-xfullpkg-ng42
1 files changed, 28 insertions, 14 deletions
diff --git a/fullpkg-ng b/fullpkg-ng
index 0547305..277d570 100755
--- a/fullpkg-ng
+++ b/fullpkg-ng
@@ -58,19 +58,19 @@ put_queue() {
# Add packages to the queue
update_queue() {
- get_queue || return $?
- echo "$(basename $PWD):$PACKAGER" >> $queue_file || return 2
+ get_queue
+ echo "$(basename $PWD):$PACKAGER" >> $queue_file
put_queue || return $?
}
# Remove a package from the queue
remove_queue() {
- get_queue || return $?
+ get_queue
grep -vw "^$(basename $PWD)" $queue_file > $queue_file.2
mv $queue_file.2 > $queue_file
- put_queue && rm $queue_file.2 && return 0 || return $?
+ put_queue && return 0 || return $?
}
# Checks if a package is listed
@@ -102,6 +102,9 @@ function cleanup {
for _dir in $@; do
rm -rf $build_dir/$_dir/
done
+ else
+ find $build_dir -type f -delete
+ find $build_dir -type d -delete
fi
}
@@ -179,7 +182,7 @@ function _pkg_build () {
# Remove from queue package being built on error
trap "remove_queue" EXIT INT QUIT TERM KILL
build_packages=$(sort -gr $buildorder | cut -d: -f2)
- while [ ${#build_packages[@]} -gt 0 ]; do
+ while [ ${#build_packages[@]} -ge 1 ]; do
build_packages=$(sort -gr $buildorder | cut -d: -f2)
pushd $build_dir/${build_packages[0]} > /dev/null
unset build_packages
@@ -208,8 +211,11 @@ function _pkg_build () {
$FULLBUILDCMD; r=$?
case $r in
0) plain "The build was succesful."
- source .INFO && [ -n $repo ] && librestage $repo || \
- echo "unstaged:$(basename $PWD)" >> $build_dir/log
+ source .INFO && [ -n $repo ] && {
+ librestage $repo || {
+ echo "unstaged:$(basename $PWD)" >> $build_dir/log
+ }
+ }
echo "built:$(basename $PWD)" >> $build_dir/log
cleanup "$(basename $PWD)"
;;
@@ -220,6 +226,7 @@ function _pkg_build () {
esac
egrep -vwh ${build_packages[0]} $buildorder > $buildorder.2
mv $buildorder.2 $buildorder
+ build_packages=$(sort -gr $buildorder | cut -d: -f2)
popd > /dev/null
done
pkgs=$(cat $build_dir/log | grep "nonfree:") && {
@@ -248,13 +255,15 @@ level=0
noupdate='n'
build_only='n'
check_deps_only='n'
+do_cleanup='n'
max_level=21
-while getopts 'ha:bcd:l:nm:r:' arg; do
+while getopts 'ha:bcCd:l:nm:r:' arg; do
case $arg in
h) usage; exit 0 ;;
a) ABSROOT="$OPTARG" ;;
b) build_only='y' ;;
c) check_deps_only='y' ;;
+ C) do_cleanup='y';;
# f) force_build+="-f pkgname " ;;
d) build_dir="$OPTARG" ;;
# hidden option to know what to build first.
@@ -276,14 +285,23 @@ done
queue_file=$XDG_CONFIG_HOME/libretools/queue
ban_file=$XDG_CONFIG_HOME/libretools/ban
touch $build_dir/{log,BUILDORDER} $queue_file $ban_file
+ buildorder=$build_dir/BUILDORDER
[ $noupdate = 'n' ] && {
msg "Updating pacman db and packages"
sudo pacman -Syu --noconfirm
}
+ [ $do_cleanup == 'y' ] && {
+ cleanup
+ [ $build_only == 'y' ] && exit 0
+ }
+ # Build only
+ [ $build_only == 'y' ] && {
+ _pkg_build
+ exit 0
+ }
msg "Checking dependencies"
}
-buildorder=$build_dir/BUILDORDER
[ ! -r PKGBUILD ] && {
error "This isn't a build directory"
@@ -292,11 +310,7 @@ buildorder=$build_dir/BUILDORDER
## if $level = 20 there is highly likely there are circular deps
[ $level -eq $max_level -o $level -gt $max_level ] && exit 20
-# Build only
-[ $level -eq 0 -a $build_only == 'y' ] && {
- _pkg_build
- exit 0
-}
+
find_deps || {
# if find_deps finds circular deps