summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Reynolds <fauno@kiwwwi.com.ar>2011-06-09 19:20:09 -0300
committerNicolas Reynolds <fauno@kiwwwi.com.ar>2011-06-09 19:20:09 -0300
commit34fc8f48c893714be74e90d65b8e3132ae4ef6f0 (patch)
treedcfcc520ad9f68554d9b2e6ed2ac7f9719149a7b
parentf21fd2185aaef0b2e9054c5eb0d4369597bcc0ff (diff)
Implemented offline mode (aka don't use shared build queue)
-rwxr-xr-xfullpkg39
1 files changed, 28 insertions, 11 deletions
diff --git a/fullpkg b/fullpkg
index f281df3..2ca5226 100755
--- a/fullpkg
+++ b/fullpkg
@@ -7,6 +7,12 @@ source /etc/abs.conf
source /etc/libretools.conf
source /usr/bin/libremessages
+# Avoid /libretools dir doesn't exist errors
+[ -z $XDG_CONFIG_HOME ] && {
+ 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
@@ -27,6 +33,7 @@ function usage {
echo " -n : don't update pacman db."
echo " -m max_level : check deps until this level"
echo " -r \"command\" : use this instead of \"$FULLBUILDCMD\""
+ echo " -o : work offline (avoid queue)"
# printf " -f pkgname : build even when a package has been built. "
# printf " Use it as many times as needed\n"
echo
@@ -42,6 +49,8 @@ function usage {
# Get the queue list from the server
get_queue() {
+ [[ "$OFFLINE" = "true" ]] && return 0
+
rsync -e ssh -aq $PARABOLAHOST:mips64el/queue $queue_file >/dev/null 2>&1 || {
error "Failed to retrieve queue list"
return 1
@@ -50,6 +59,8 @@ get_queue() {
# Put the queue list on the server
put_queue() {
+ [[ "$OFFLINE" = "true" ]] && return 0
+
rsync -e ssh -aq $queue_file $PARABOLAHOST:mips64el/queue >/dev/null 2>&1 || {
error "Failed to put queue list"
return 1
@@ -65,6 +76,8 @@ update_queue() {
# Remove a package from the queue
remove_queue() {
+ [[ "$OFFLINE" = "true" ]] && return 0
+
get_queue
grep -Evw "^$(basename $PWD)" $queue_file > $queue_file.2
@@ -75,6 +88,8 @@ remove_queue() {
# Checks if a package is listed
check_queue() {
+ [[ "$OFFLINE" = "true" ]] && return 0
+
get_queue
local packager=$(grep -w "$(basename $PWD)" ${queue_file} | cut -d ':' -f2)
@@ -161,17 +176,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
@@ -307,7 +322,8 @@ build_only='n'
check_deps_only='n'
do_cleanup='n'
max_level=21
-while getopts 'ha:bcCd:l:nm:r:' arg; do
+OFFLINE=false
+while getopts 'ha:bcCd:l:nm:r:o' arg; do
case $arg in
h) usage; exit 0 ;;
a) ABSROOT="$OPTARG" ;;
@@ -322,6 +338,7 @@ while getopts 'ha:bcCd:l:nm:r:' arg; do
n) noupdate='y';;
m) max_level=$OPTARG ;;
r) FULLBUILDCMD="$OPTARG" ;;
+ o) OFFLINE=true ;;
esac
done