diff options
-rwxr-xr-x | fullpkg | 102 | ||||
-rwxr-xr-x | libremakepkg | 10 | ||||
-rw-r--r-- | libretools.conf | 6 |
3 files changed, 68 insertions, 50 deletions
@@ -8,18 +8,16 @@ source /etc/libretools.conf source /usr/bin/libremessages # Avoid /libretools dir doesn't exist errors -[ -z $XDG_CONFIG_HOME ] && { +if [ -z $XDG_CONFIG_HOME ]; then error "There's no XDG_CONFIG_HOME var set" - exit 1 -} - -[ -r $XDG_CONFIG_HOME/libretools/libretools.conf ] && \ - source $XDG_CONFIG_HOME/libretools/libretools.conf - + OFLINE=true +elif [ -r $XDG_CONFIG_HOME/libretools/libretools.conf ]; # 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 + source $XDG_CONFIG_HOME/libretools/libretools.conf + queue_file=$XDG_CONFIG_HOME/libretools/queue + ban_file=$XDG_CONFIG_HOME/libretools/ban +fi + ##### START FUNCTIONS ##### @@ -82,8 +80,8 @@ remove_queue() { get_queue - grep -Evw "^$(basename $PWD)" $queue_file > $queue_file.2 - cat $queue_file.2 > $queue_file; rm -f $queue_file.2 + grep -Evw "^$(basename $PWD)" ${queue_file} > ${queue_file}2 + mv ${queue_file}2 ${queue_file} put_queue && return 0 || return $? } @@ -112,8 +110,8 @@ check_queue() { # $1 package name # $2 buildorder file remove_buildorder() { - grep -Evw "$1" $2 > $2.2 - cat $2.2 > $2; rm -f $2.2 + grep -Evw "${1}" ${2} > ${2}2 + mv ${2}2 ${2} } # Guesses the repo name according to the parent dir of the current package @@ -122,6 +120,19 @@ guess_repo() { basename $(dirname $(pwd)) } +## +# usage : get_full_version( $epoch, $pkgver, $pkgrel ) +# return : full version spec, including epoch (if necessary), pkgver, pkgrel +## +get_full_version() { + if [[ $1 -eq 0 ]]; then + # zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi +} + # Usage: cleanup [ $(basename $PWD) ] from PKGBUILD dir # cleans the build_dir function cleanup { @@ -147,10 +158,11 @@ function find_deps { source PKGBUILD local repo=${repo:-$(guess_repo)} local pkgbase=${pkgbase:-${pkgname[0]}} + local fullver=$(get_full_version ${epoch} ${pkgver} ${pkgrel}) -# If package is built exit +# If package and correct ${fullver} is built exit # TODO?: If this package is in force_build: skip this step - if is_built "${pkgbase}>=${pkgver}-${pkgrel}"; then + if is_built "${pkgbase}=${fullver}"; then exit 0 fi @@ -169,7 +181,7 @@ function find_deps { fi # Inform the current package - msg2 "${pkgbase}-${pkgver}-${pkgrel}" + msg2 "${pkgbase}-${fullver}" ## Check next levels # Clean version checking @@ -195,17 +207,17 @@ function find_deps { # if search pkgname in repo doesn't work # this should find pkgsplits -# elif _dir=($(find "$ABSROOT/${_repo}" -type f -name PKGBUILD -print0 2>/dev/null | \ -# "xargs" -0 -e grep -HEw "pkgname=|pkgbase=|provides=" | grep -w "$_dep" 2>&1)); -# then -# _dir=$(dirname $(echo $_dir | cut -d: -f1)) -# plain "guess for $_dep -> $_dir" -# pushd $_dir > /dev/null -# $0 -c -d ${build_dir} -l ${next_level} + elif _dir=($(find "$ABSROOT/${_repo}" -type f -name PKGBUILD -print0 2>/dev/null | \ + "xargs" -0 -e grep -HEw "pkgname=|pkgbase=|provides=" | grep -w "$_dep" 2>&1)); + then + _dir=$(dirname $(echo $_dir | cut -d: -f1)) + plain "guess for $_dep -> $_dir" + pushd $_dir > /dev/null + $0 -c -d ${build_dir} -l ${next_level} # Circular deps must fail -# [ $? -eq 20 ] && return 20 -# popd > /dev/null -# break 1 # found, go to next dep + [ $? -eq 20 ] && return 20 + popd > /dev/null + break 1 # found, go to next dep else echo "dep_not_found:$_dep:$_repo" >> $build_dir/log @@ -217,8 +229,7 @@ function find_deps { # unset PKGBUILD variables unset pkgname pkgver pkgrel epoch pkgdesc arch url license groups depends \ makedepens checkdepends optdepends provides conflicts replaces backup \ - options install changelog source noextract md5sums build check package - + options install changelog source noextract md5sums build check package } function _pkg_build () { @@ -310,18 +321,17 @@ function _pkg_build () { echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 } - pkgs=$(cat $build_dir/log | tr " " "\n" | grep "built:") && { - error "Those packages were built and installed:" + pkgs=($(grep "built:" $build_dir/log)) && { + msg "Those packages were built and staged:" echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 - msg "Uploading packages to the server" } - pkgs=$(cat $build_dir/log | tr " " "\n" | grep "failed:") && { + pkgs=($(grep "failed:" $build_dir/log) && { error "Those packages failed to build:" echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 } - pkgs=$(cat $build_dir/log | tr " " "\n" | grep "unstaged:") && { + pkgs=($(grep "unstaged:" $build_dir/log) && { error "Those packages couldn't be staged because of missing reponame:" echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 } @@ -376,6 +386,11 @@ while getopts 'ha:bcCd:l:nm:r:o' arg; do esac done +[ ! -r PKGBUILD ] && { + error "This isn't a build directory" + usage && exit 1 +} + # Only on level 0 if [ $level -eq 0 ]; then # if build_dir exist use it, else make a build_dir @@ -405,15 +420,9 @@ if [ $level -eq 0 ]; then msg "Checking dependencies" fi -[ ! -r PKGBUILD ] && { - error "This isn't a build directory" - usage && exit 1 -} - ## if $level = 20 it's highly likely there are circular deps [ $level -ge $max_level ] && exit 20 - find_deps || { # if find_deps finds circular deps # it should exit with status 20 @@ -437,12 +446,13 @@ find_deps || { rsync -e ssh -aq $PARABOLAHOST:mips64el/ban >/dev/null 2>&1 || { warning "Failed to get ban list" && [ -r $ban_file ] && { -# Continue if download failed but local copy -# @xihh i don't understand this -- fauno - search=$(cat $ban_file | tr "\n" "|") - echo ${@} | tr " " "\n" | egrep -w "$search" $buildorder >> $build_dir/banned - echo ${@} | tr " " "\n" | egrep -vw "$search" $buildorder > $buildorder.2 - cat $buildorder.2 > $buildorder; rm $buildorder.2 +# Use local copy of ban file if it is avaliable and continue. + search=$(cat ${ban_file} | tr "\n" "|") +# Keep track of banned files + egrep -w "$search" ${buildorder} >> ${build_dir}/banned +# Take banned packages out from buildorder + egrep -vw "$search" ${buildorder} > ${buildorder}2 + mv ${buildorder}2 ${buildorder} unset search } } diff --git a/libremakepkg b/libremakepkg index 3cbc844..af18e8e 100755 --- a/libremakepkg +++ b/libremakepkg @@ -40,6 +40,7 @@ function usage { _CLEAN="" CLEAN_CACHE="" update_first="n" +use_log='n' chrootname=${CHCOPY} _PKGINSTALL="" _MAKEPKG_ARGS="" @@ -56,6 +57,8 @@ while getopts ${libremakepkgargs} arg ; do n) chrootname="$OPTARG"; echo $chrootname ;; I) _PKGINSTALL+="-I $OPTARG " ;; M) _MAKEPKG_ARGS+=" $OPTARG" ;; + L) _MAKEPKG_ARGS+=" -$arg $OPTARG" + use_log='y';; *) _MAKEPKG_ARGS+=" -$arg $OPTARG" ;; esac done @@ -84,4 +87,9 @@ fi msg "Creating the package" makechrootpkg $_CLEAN -r ${CHROOTDIR} -l "${chrootname}" $_PKGINSTALL -- $_MAKEPKG_ARGS -exit $? +ev=$? # exit value + +[ $ev -ne 0 -a "$use_log" == 'y' ] && { + cp ${CHROOTDIR}/${chrootname}/build/*.log ./ +} +exit $ev diff --git a/libretools.conf b/libretools.conf index 4842e22..524a289 100644 --- a/libretools.conf +++ b/libretools.conf @@ -49,7 +49,7 @@ LIBREDESTDIR=/home/parabolavnx/parabolagnulinux.org/repo LIBRESRCDIR=/home/parabolavnx/parabolagnulinux.org/repo/pkgbuilds ## ABSLibre -ABSLIBREGIT=http://projects.parabolagnulinux.org/abslibre.git/ +ABSLIBREGIT=http://projects.parabolagnulinux.org/abslibre.git ## Commit Command ## Should be git or hg @@ -59,8 +59,8 @@ ABSLIBREGIT=http://projects.parabolagnulinux.org/abslibre.git/ ## Build cmd for fullpkg-ng ## Uncomment one of those or make one of your choice -#FULLBUILDCMD="sudo libremakepkg -siL -M --noconfirm -M --nocheck" -#FULLBUILDCMD="makepkg --noconfirm --nocheck -sciL" +#FULLBUILDCMD="sudo libremakepkg -simL -M --noconfirm -M --nocheck" +#FULLBUILDCMD="makepkg --noconfirm --nocheck -scimL" #FULLBUILDCMD="here is a place for cross-compiling build cmd" # Checks if vars aren't empty |