summaryrefslogtreecommitdiff
path: root/fullpkg
diff options
context:
space:
mode:
Diffstat (limited to 'fullpkg')
-rwxr-xr-xfullpkg102
1 files changed, 56 insertions, 46 deletions
diff --git a/fullpkg b/fullpkg
index 15d6cc1..88bbe15 100755
--- a/fullpkg
+++ b/fullpkg
@@ -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
}
}