summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Ismael Haase Hernandez <hahj87@gmail.com>2011-05-19 02:02:22 -0500
committerJoshua Ismael Haase Hernandez <hahj87@gmail.com>2011-05-19 02:02:22 -0500
commit2e4d78c7768119a75bba8ae5eab98c1a6026ea89 (patch)
tree8483171dde27eb8dc89a868b10155b5be28450ce
parent64a0772ca0f9d542ab8a94bd16a1edc78f5b40db (diff)
* fullpkg uses options and librerelease
* librerelease tell wich repo for each pkg when listing
-rwxr-xr-xfullpkg124
-rwxr-xr-xlibrerelease11
-rwxr-xr-xmipsrelease2
3 files changed, 84 insertions, 53 deletions
diff --git a/fullpkg b/fullpkg
index f74c0b5..41bc5c5 100755
--- a/fullpkg
+++ b/fullpkg
@@ -4,23 +4,57 @@
# * Detect circular builds
# * Detect pkgnames by provides, replaces, etc. instead of dir tree
+source /etc/makepkg.conf
+source /etc/abs.conf
+source /etc/libretools.conf
+
+[[ -r ~/.config/libretools/libretools.conf ]] && \
+ source ~/.config/libretools/libretools.conf
+
+function usage {
+ echo "cd to a dir containing a PKGBUILD and run:"
+ echo "$0 [options]"
+ printf "This script will check dependencies, build them if possible "
+ printf "and stage the packages on it's repo."
+ echo
+ echo "OPTIONS:"
+ echo " -h : this message."
+ echo " -f : build even when a package has been built."
+ echo " -n : set ABSROOT to this dir"
+ echo " -r reponame : set repo name to reponame"
+ echo
+}
+
+force_build='n'
+
+while getopts 'hfn:r' arg; do
+ case $arg in
+ h) usage; exit 0 ;;
+ f) force_build='y' ;;
+ n) ABSROOT="$OPTARG" ;;
+ r) repo="$OPTARG" ;;
+ esac
+done
+
[[ ! -r PKGBUILD ]] && {
- echo "This isn't a build directory"
+ error "This isn't a build directory"
+ echo
+ usage
exit 1
}
tmp_dir=$(mktemp -d /tmp/$(basename $PWD).XXXXXX)
queue_file=$(mktemp /tmp/queue.XXXXXX)
ban_file=$(mktemp)
-[[ ! -w $queue_file ]] && exit 1
-[[ ! -w $ban_file ]] && exit 1
-
-source /etc/makepkg.conf
-source /etc/abs.conf
-source /etc/libretools.conf
+if [[ ! -w $queue_file ]]; then
+ error "can't write queue file"
+ exit 1
+elif [[ ! -w $ban_file ]] ; then
+ error "can't write ban file"
+ exit 1
+fi
-[[ -r ~/.config/libretools/libretools.conf ]] && \
- source ~/.config/libretools/libretools.conf
+## START FUNCTIONS ##
# Queue Management
# * Always get the queue list from the server
@@ -30,10 +64,6 @@ source /etc/libretools.conf
# TODO
# * Check for concurrence
-guess_repo() {
- basename $(dirname $(pwd))
-}
-
# Get the queue list from the server
get_queue() {
rsync -e ssh -aq $PARABOLAHOST:mips64el/queue $queue_file >/dev/null 2>&1 || {
@@ -66,7 +96,7 @@ remove_queue() {
grep -vw "^$(basename $PWD)" $queue_file > $queue_file.2
cat $queue_file.2 > $queue_file
- put_queue || return $?
+ put_queue && rm $queue_file{,.2} && return 0 || return $?
}
# Checks if a package is listed
@@ -83,32 +113,45 @@ check_queue() {
return 0
}
+# END Queue Management #
+
# Checks if the package is banned from building
is_banned() {
rsync -e ssh -aq $PARABOLAHOST:mips64el/ban $ban_file >/dev/null 2>&1 || {
- plain ":: Failed to get ban list"
+ plain "Failed to get ban list"
return 0
}
grep -w $1 $ban_file >/dev/null 2>&1
+ local rt=$?
+ rm $ban_file
+ return $rt
+}
- return $?
+guess_repo() {
+ basename $(dirname $(pwd))
}
# TODO keep track of spawned fullpkgs
quit() {
remove_queue
-
exit 1
}
-repo=${1:-$(guess_repo)}
+## END FUNCTIONS ##
+
+repo=${repo:-$(guess_repo)}
source PKGBUILD
msg "Building ${repo:-missing repo}/${pkgbase:-${pkgname[@]}}: $pkgdesc"
-is_built "${pkgbase:-${pkgname[0]}}>=${pkgver}-${pkgrel}" && \
- msg2 "This package is built." && exit 0
+if is_built "${pkgbase:-${pkgname[0]}}>=${pkgver}-${pkgrel}"; then
+ msg2 "This package is built."
+ if [ $force_build == 'n' ]; then
+ exit 0
+ fi
+ plain "Building anyway ..."
+fi
trap "quit" TERM KILL INT
@@ -144,10 +187,8 @@ for _dep in ${deps[@]}; do
source "$ABSROOT/${_repo}/$_dep/PKGBUILD"
msg2 "Checking for $_dep>=$pkgver-$pkgrel"
-# If this version is built, continue with the next dep
-
if is_built "$_dep>=$pkgver-$pkgrel"; then
- plain "No need to build this one"
+ plain "this package is built"
break
fi
@@ -158,22 +199,13 @@ for _dep in ${deps[@]}; do
# Enter the work dir and run this command in it
pushd $tmp_dir/$_dep >/dev/null
- $0 $_repo
+ $0 -r $_repo
[[ $? -ne 0 ]] && {
failed=(${failed[@]} $_dep)
}
popd >/dev/null
-
- break
-# } || {
-# The package can't be found
-# This can happen if:
-# * The package is built inside a split package
-# * The package is provided by some other package (ie by *-libre packages)
-# echo "==> Missing package $_dep"
-# missing=(${missing[@]} $_dep)
}
done
done
@@ -194,25 +226,19 @@ pushd $tmp_dir/$(basename $PWD) >/dev/null
msg "Syncing database"
sudo pacman -Syu --noconfirm
-makepkg --noconfirm -sLcr ; r=$?
+makepkg --noconfirm --nocheck -sLcr ; r=$?
case $r in
- 0)
- msg "The build was succesful."
- mipsrelease *.pkg.tar.*
-
- librestage $repo
-
- sudo pacman -Sy
- ;;
- 1)
- error "There were errors while trying to build the package."
- ;;
- 2)
- error "The build failed."
- ;;
+ 0) msg "The build was succesful."
+ #TODO: mipsrelease should upload to a local db
+ mipsrelease *.pkg.tar.*
+ librestage $repo
+ librerelease
+ sudo pacman -Sy ;;
+ 1) error "There were errors while trying to build the package." ;;
+ 2) error "The build failed." ;;
esac
-# Remove from queue
remove_queue
exit $r
+
diff --git a/librerelease b/librerelease
index c34abaf..4e7c491 100755
--- a/librerelease
+++ b/librerelease
@@ -37,15 +37,20 @@ function usage {
}
function list_packages {
- find $WORKDIR/staging/ -type f -printf "%f\n"
+ repos=($(find "$WORKDIR/staging/" -mindepth 1 -type d \! -empty -printf '%f ' 2>/dev/null))
+ for _repo in ${repos[@]}; do
+ msg2 "$_repo"
+ find ${WORKDIR}/staging/${_repo} -type f -printf "%f\n"
+ done
+ unset repos
}
function clean_non_packages {
- find $WORKDIR/staging/ -type f \! -iname "*.pkg.tar.*" -delete
+ find $WORKDIR/staging/ -type f \! -iname "*.pkg.tar.?z" -delete
}
function clean_packages {
- find ${WORKDIR}/staging/ -iname "*.pkg.tar.*" -delete
+ find ${WORKDIR}/staging/ -iname "*.pkg.tar.?z" -delete
}
while getopts 'hlc' arg; do
diff --git a/mipsrelease b/mipsrelease
index 97e12d2..925748f 100755
--- a/mipsrelease
+++ b/mipsrelease
@@ -4,7 +4,7 @@
source /etc/makepkg.conf
pushd ${PKGDEST} >/dev/null
-
+#TODO: repo-add should stage to a local db and not stage3
repo-add stage3.db.tar.gz $@
popd >/dev/null