diff options
-rwxr-xr-x | fullpkg | 65 |
1 files changed, 17 insertions, 48 deletions
@@ -19,7 +19,7 @@ elif [ -e $XDG_CONFIG_HOME/libretools/libretools.conf ]; then fi -function usage { +usage() { echo "cd to a dir containing a PKGBUILD and run:" echo "$0 [options]" @@ -71,11 +71,11 @@ get_fullver() { # Cleans the build_dir. cleanup() { # Do nothing or already cleaned. - [[ "${do_cleanup}" = "n" || ! -d ${build_dir} ]] && return 0 + [[ "${do_cleanup}" = false || ! -d ${build_dir} ]] && return 0 # Only do cleanup on level 0. msg "Cleaning up..." - [ $level -eq 0 ] && rm -rf $build_dir/* + [ $level -eq 0 ] && rm -rf $build_dir/ } @@ -275,17 +275,17 @@ trap 'trap_exit "(prfullpkg:${level}) An unknown error has occurred. Exiting..." ban_file=$XDG_CONFIG_HOME/libretools/ban force_build="" level=0 -noupdate='n' -build_only='n' -check_deps_only='n' -do_cleanup='n' +noupdate=false +build_only=false +check_deps_only=false +do_cleanup=false max_level=21 while getopts 'ha:b:cCd:l:nm:r:' arg; do case $arg in h) usage ;; a) ABSROOT="$OPTARG" ;; - b) build_only='y' + b) build_only=true build_dir="$OPTARG" if [ -z ${build_dir} ]; then usage @@ -294,24 +294,24 @@ while getopts 'ha:b:cCd:l:nm:r:' arg; do error "${build_dir}/BUILDORDER doesn't exist." exit 1 fi;; - c) check_deps_only='y' ;; - C) do_cleanup='y';; + c) check_deps_only=true ;; + C) do_cleanup=true;; d) build_dir="$OPTARG" ;; # hidden option to know dep level. l) level=$OPTARG ;; - n) noupdate='y';; + n) noupdate=true;; m) max_level=$OPTARG ;; r) FULLBUILDCMD="$OPTARG" ;; esac done -if [ ${build_only} == 'n' ]; then +if [ ! ${build_only} ]; then # Check if we are actually on a build directory. Do this early. - [ ! -r PKGBUILD ] && { + if [ ! -r PKGBUILD ]; then error "This isn't a build directory" usage - } + fi if [ ! -z "$HOOKPKGBUILDMOD" ]; then "$HOOKPKGBUILDMOD" @@ -336,14 +336,14 @@ if [ $level -eq 0 ]; then touch ${build_dir}/{log,BUILDORDER} ${ban_file} buildorder=${build_dir}/BUILDORDER - if [ ${noupdate} = 'n' ]; then + if [ ! ${noupdate} ]; then msg "Updating pacman db and packages" sudo pacman -Syu --noconfirm || true fi - if [ ${build_only} == 'y' ]; then + if [ ${build_only} ]; then msg "Build Packages" @@ -375,38 +375,7 @@ find_deps || { } # only build on level 0 -[ $check_deps_only = 'y' -o $level -gt 0 ] && exit 0 - -# Sanity check -if [ $level -eq 0 -a -d $build_dir ]; then - -# Check ban_file permisions - if [ ! -w $ban_file -o ! -r $ban_file ]; then - - chmod a+rw $ban_file || error "Ban file is not readable/writable ($ban_file)" - - else - - rsync -e ssh -aq $PARABOLAHOST:mips64el/ban >/dev/null 2>&1 || { - -# use local copy if it exist - warning "Failed to get ban list" && [ -r ${ban_file} ] && { - - search=$(cat ${ban_file} | tr "\n" "|") - -# Keep track of banned files - egrep -w "$search" ${buildorder} >> ${build_dir}/banned - -# Take banned packages out of buildorder - egrep -vw "$search" ${buildorder} > ${buildorder}2 - - mv -f ${buildorder}2 ${buildorder} - - unset search - } - } - fi -fi +[ $check_deps_only = true -o $level -gt 0 ] && exit 0 msg "Building packages:" |