summaryrefslogtreecommitdiff
path: root/fullpkg-ng
diff options
context:
space:
mode:
Diffstat (limited to 'fullpkg-ng')
-rwxr-xr-xfullpkg-ng45
1 files changed, 29 insertions, 16 deletions
diff --git a/fullpkg-ng b/fullpkg-ng
index 4ab4ab0..5311593 100755
--- a/fullpkg-ng
+++ b/fullpkg-ng
@@ -103,8 +103,7 @@ function cleanup {
rm -rf $build_dir/$_dir/
done
else
- find $build_dir -type f -delete
- find $build_dir -type d -delete
+ rm -rf $build_dir
fi
}
@@ -178,17 +177,20 @@ function find_deps {
function _pkg_build () {
pushd ${build_dir} > /dev/null
+ # packages to build are on $buildorder
+ # greater levels must be built first
build_packages=($(sort -gr $buildorder | cut -d: -f2))
while [ ${#build_packages[@]} -ge 1 ]; do
build_packages=($(sort -gr $buildorder | cut -d: -f2))
pushd $build_dir/${build_packages[0]} > /dev/null
source PKGBUILD
msg2 "${pkgbase:-${pkgname[0]}} $pkgver-$pkgrel"
+ # Add mips64el
if ! grep mips64el PKGBUILD >/dev/null; then
plain "Adding mips64el arch"
sed -i "s/^\(arch=([^)anym]\+\))/\1 'mips64el')/" "PKGBUILD"
fi
- # Check if pkg is being built, if it's not let everybody know we're building this.
+ # Check if pkg is being built
msg2 "Checking build queue"
check_queue || {
echo "someone_is_building:$(basename $PWD)" >> $build_dir/log
@@ -196,20 +198,27 @@ function _pkg_build () {
mv $buildorder.2 $buildorder
continue
}
+ # Let everybody know we're building this.
msg2 "Updating build queue"
update_queue || {
warning "Couldn't update the queue, let your partners know about this."
}
msg2 "Checking for non free deps"
pkgbuild-check-nonfree || {
+ # pkgbuild-check-nonfree fails with 15 if there are nonfree deps,
+ # fails with something else if blacklist can't be retrieved
if [ $? -eq 15 ]; then
+ # log they have nonfree deps and so didn't build
echo "nonfree:$(basename $PWD)" >> $build_dir/log
+ # take out package from $buildorder
grep -vwh "$(basename $PWD)" $buildorder > $buildorder.2
- mv $buildorder $buildorder.2
+ mv $buildorder.2 $buildorder
+ # continue building next package
continue
fi
}
msg2 "Building $(basename $PWD)"
+ # this buildcmd is on libretools.conf
$FULLBUILDCMD; r=$?
case $r in
0) plain "The build was succesful."
@@ -222,30 +231,33 @@ function _pkg_build () {
cleanup "$(basename $PWD)"
;;
1) error "There were errors while trying to build the package."
- echo "failed:$(basename $PWD)" >> $build_dir/log ;;
+ echo "failed:$(basename $PWD)" >> $build_dir/log
+ ;;
2) error "The build failed."
- echo "failed:$(basename $PWD)" >> $build_dir/log ;;
+ echo "failed:$(basename $PWD)" >> $build_dir/log
+ ;;
esac
+ # Package was built or failed: take it out of $buildorder
grep -vwh "${build_packages[0]}" $buildorder > $buildorder.2
mv $buildorder.2 $buildorder
popd > /dev/null
done
pkgs=$(cat $build_dir/log | grep "nonfree:") && {
error "Those packages contain nonfree deps:"
- plain "$(echo ${pkgs[@]} | cut -d: -f2)"
+ echo ${pkgs[@]} | cut -d: -f2
}
pkgs=$(cat $build_dir/log | grep "built:") && {
error "Those packages were built and installed:"
- plain "$(echo ${pkgs[@]} | cut -d: -f2)"
+ echo ${pkgs[@]} | cut -d: -f2
msg "Uploading packages to the server"
}
pkgs=$(cat $build_dir/log | grep "failed:") && {
error "Those packages failed to build:"
- plain "$(echo ${pkgs[@]} | cut -d: -f2)"
+ echo ${pkgs[@]} | cut -d: -f2
}
pkgs=$(cat $build_dir/log | grep "unstaged:") && {
error "Those packages couldn't be staged because of missing reponame:"
- plain "$(cat $build_dir/log | grep "unstaged:" | cut -d: -f2)"
+ echo ${pkgs[@]} | cut -d: -f2
}
popd > /dev/null
}
@@ -280,22 +292,23 @@ done
[ $level -eq 0 ] && {
# 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
+ }
# set queue_file and ban_file
mkdir -p $XDG_CONFIG_HOME/libretools
queue_file=$XDG_CONFIG_HOME/libretools/queue
ban_file=$XDG_CONFIG_HOME/libretools/ban
- touch $build_dir/{log,BUILDORDER} $queue_file $ban_file
+ # make files for log and buildorder
+ touch $build_dir/{log,BUILDORDER}
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' ] && {
# Exit loop on Ctrl+C