summaryrefslogtreecommitdiff
path: root/fullpkg
diff options
context:
space:
mode:
authorNicolas Reynolds <fauno@kiwwwi.com.ar>2011-06-14 15:49:07 -0300
committerNicolas Reynolds <fauno@kiwwwi.com.ar>2011-06-14 15:49:07 -0300
commit90db8b196cf626d6fa0fd698050edb331ceab7e9 (patch)
treeeae103df00261fab132848db5e5799288f509986 /fullpkg
parent26005b7e07f968e045cf19ae9ede9be6f5f0fad8 (diff)
parent51c9918206763265d2df42050e241f7f12f1b9df (diff)
Merge branch 'master' of ssh://vparabola/srv/git/projects/libretools
Conflicts: fullpkg
Diffstat (limited to 'fullpkg')
-rwxr-xr-xfullpkg92
1 files changed, 51 insertions, 41 deletions
diff --git a/fullpkg b/fullpkg
index 9736d05..befc39f 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 -f ${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 -f ${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 {
@@ -141,10 +152,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
@@ -163,7 +175,7 @@ function find_deps {
fi
# Inform the current package
- msg2 "${pkgbase}-${pkgver}-${pkgrel}"
+ msg2 "${pkgbase}-${fullver}"
## Check next levels
# Clean version checking
@@ -189,17 +201,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
@@ -211,8 +223,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 () {
@@ -303,18 +314,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
}
@@ -408,7 +418,6 @@ fi
## if $level = 20 it's highly likely there are circular deps
[ $level -ge $max_level ] && exit 20
-
# Tries to find deps and build order
find_deps || {
# if find_deps finds circular deps
@@ -433,12 +442,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 -f ${buildorder}2 ${buildorder}
unset search
}
}