summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Ismael Haase Hernandez <hahj87@gmail.com>2011-05-26 14:50:51 -0500
committerJoshua Ismael Haase Hernandez <hahj87@gmail.com>2011-05-26 14:50:51 -0500
commit9586c7a26566a5f404f9ba6fbc89aad6a1ce48a2 (patch)
tree303132984883096b74e21e6f595e20b2719df644
parent70a50f72c79d234599c961c703ba1f373ac5478d (diff)
* Added build only option to fullpkg-ng
-rwxr-xr-xfullpkg-ng144
1 files changed, 76 insertions, 68 deletions
diff --git a/fullpkg-ng b/fullpkg-ng
index d186f58..6be9a22 100755
--- a/fullpkg-ng
+++ b/fullpkg-ng
@@ -21,6 +21,7 @@ function usage {
echo "OPTIONS:"
echo " -h : this message."
echo " -a absdir : set absdir as ABSROOT."
+ echo " -b : do not check deps but build. Needs -d"
echo " -c : check deps only, do not build."
echo " -d build_dir : use this dir to build. Defaults to mktemp."
echo " -n : don't update pacman db."
@@ -171,6 +172,72 @@ function find_deps {
options install changelog source noextract md5sums build check package
}
+function _pkg_build () {
+ # Exit loop on Ctrl+C
+ trap "break" INT
+ # 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
+ build_packages=$(sort -gr $buildorder | cut -d: -f2)
+ pushd $build_dir/${build_packages[0]} > /dev/null
+ unset build_packages
+ source PKGBUILD
+ msg2 "${pkgbase:-${pkgname[0]}} $pkgver-$pkgrel"
+ 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_queue || {
+ echo "someone_is_building:$(basename $PWD)" >> $build_dir/log
+ egrep -vwh "$(basename $PWD)" $buildorder > $buildorder.2
+ continue
+ }
+ update_queue || {
+ warning "Couldn't update the queue, let your partners know about this."
+ }
+ pkgbuild-check-nonfree || [ $? -eq 15 ] && {
+ echo "nonfree:$(basename $PWD)" >> $build_dir/log
+ egrep -vwh "$(basename $PWD)" $buildorder > $buildorder.2
+ continue
+ }
+ $FULLBUILDCMD; r=$?
+ case $r in
+ 0) plain "The build was succesful."
+ source .INFO && [ -n $repo ] && librestage $repo || \
+ echo "unstaged:$(basename $PWD)" >> $build_dir/log
+ echo "built:$(basename $PWD)" >> $build_dir/log
+ cleanup "$(basename $PWD)"
+ ;;
+ 1) error "There were errors while trying to build the package."
+ echo "failed:$(basename $PWD)" >> $build_dir/log ;;
+ 2) error "The build failed."
+ echo "failed:$(basename $PWD)" >> $build_dir/log ;;
+ esac
+ egrep -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)"
+ }
+ pkgs=$(cat $build_dir/log | grep "built:") && {
+ error "Those packages were built and installed:"
+ plain "$(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)"
+ }
+ 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)"
+ }
+
+}
## END FUNCTIONS ##
force_build=""
@@ -179,10 +246,11 @@ noupdate='n'
build_only='n'
check_deps_only='n'
max_level=21
-while getopts 'ha:cd:l:nm:' arg; do
+while getopts 'ha:bcd:l:nm:r:' arg; do
case $arg in
h) usage; exit 0 ;;
a) ABSROOT="$OPTARG" ;;
+ b) build_only='y' ;;
c) check_deps_only='y' ;;
# f) force_build+="-f pkgname " ;;
d) build_dir="$OPTARG" ;;
@@ -204,7 +272,7 @@ done
mkdir -p $XDG_CONFIG_HOME/libretools
queue_file=$XDG_CONFIG_HOME/libretools/queue
ban_file=$XDG_CONFIG_HOME/libretools/ban
- touch $build_dir/{deps,log,BUILDORDER} $queue_file $ban_file
+ touch $build_dir/{log,BUILDORDER} $queue_file $ban_file
[ $noupdate = 'n' ] && {
msg "Updating pacman db and packages"
@@ -221,6 +289,11 @@ 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
@@ -255,76 +328,11 @@ find_deps || {
}
## START Building
-
msg "Building packages:"
cd ${build_dir} > /dev/null
[ ! -w $queue_file ] && error "can't write queue file"
-
-# Exit loop on Ctrl+C
-trap "break" INT
-# 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
- build_packages=$(sort -gr $buildorder | cut -d: -f2)
- pushd $build_dir/${build_packages[0]} > /dev/null
- unset build_packages
- source PKGBUILD
- msg2 "${pkgbase:-${pkgname[0]}} $pkgver-$pkgrel"
- 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_queue || {
- echo "someone_is_building:$(basename $PWD)" >> $build_dir/log
- egrep -vwh "$(basename $PWD)" $buildorder > $buildorder.2
- continue
- }
- update_queue || {
- warning "Couldn't update the queue, let your partners know about this."
- }
- pkgbuild-check-nonfree || [ $? -eq 15 ] && {
- echo "nonfree:$(basename $PWD)" >> $build_dir/log
- egrep -vwh "$(basename $PWD)" $buildorder > $buildorder.2
- continue
- }
- $FULLBUILDCMD; r=$?
- case $r in
- 0) plain "The build was succesful."
- source .INFO && [ -n $repo ] && librestage $repo || \
- echo "unstaged:$(basename $PWD)" >> $build_dir/log
- echo "built:$(basename $PWD)" >> $build_dir/log
- cleanup "$(basename $PWD)"
- ;;
- 1) error "There were errors while trying to build the package."
- echo "failed:$(basename $PWD)" >> $build_dir/log ;;
- 2) error "The build failed."
- echo "failed:$(basename $PWD)" >> $build_dir/log ;;
- esac
- egrep -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)"
-}
-pkgs=$(cat $build_dir/log | grep "built:") && {
- error "Those packages were built and installed:"
- plain "$(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)"
-}
-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)"
-}
+_pkg_build
echo
msg2 "Check if your system works fine and librerelease if it does"