From 4d4439b1b9b5ab83981407e06e3a85bf1144d6cd Mon Sep 17 00:00:00 2001 From: Nicolas Reynolds Date: Thu, 9 Jun 2011 20:00:26 -0300 Subject: Changed mipsrelease into a hook that's meant to run for local releases. For mipsrelease, it adds packages to a local repo and copies all needed build files to a dir on WORKDIR. --- fullpkg | 39 +++++++++++++++++++++++++++++++-------- libretools.conf | 7 +++++++ mipsrelease | 21 +++++++++++++++++++-- 3 files changed, 57 insertions(+), 10 deletions(-) diff --git a/fullpkg b/fullpkg index 2ca5226..b4475a8 100755 --- a/fullpkg +++ b/fullpkg @@ -257,8 +257,10 @@ function _pkg_build () { 0) plain "The build was succesful." source .INFO && [ -n $repo ] && { -# Release locally - mipsrelease *.pkg.tar.?z + +# Calls a local release script if it's used + [ -z $HOOKLOCALRELEASE ] || \ + $HOOKLOCALRELEASE $repo *.pkg.tar.?z # Stage for releasing librestage $repo || { @@ -268,6 +270,7 @@ function _pkg_build () { msg "Updating pacman db and packages" sudo pacman -Syu --noconfirm } + echo "built:$(basename $PWD)" >> $build_dir/log cleanup "$(basename $PWD)" ;; @@ -313,8 +316,27 @@ function _pkg_build () { popd > /dev/null } + +# End inmediately but print a useful message +trap_exit() { + remove_queue + + error "$@" + warning "Leftover files left on $build_dir" + + exit 1 +} + ## END FUNCTIONS ## +## Trap signals +# From makepkg +set -E +trap 'clean_up' 0 +trap 'trap_exit "TERM signal caught. Exiting..."' TERM HUP QUIT +trap 'trap_exit "Aborted by user! Exiting..."' INT +trap 'trap_exit "An unknown error has occurred. Exiting..."' ERR + force_build="" level=0 noupdate='n' @@ -386,7 +408,7 @@ done } ## if $level = 20 there is highly likely there are circular deps -[ $level -eq $max_level -o $level -gt $max_level ] && exit 20 +[ $level -ge $max_level ] && exit 20 find_deps || { @@ -425,11 +447,12 @@ find_deps || { ## START Building msg "Building packages:" -[ ! -w $queue_file ] && error "can't write queue file" -# Exit loop on Ctrl+C -trap "break" INT -# Remove from queue package being built on error -trap "remove_queue" EXIT INT QUIT TERM KILL +# If the queue file isn't writable go into offline mode +[ ! -w $queue_file ] && { + error "Can't write queue file" + OFFLINE=true +} + _pkg_build echo diff --git a/libretools.conf b/libretools.conf index c4ac606..4842e22 100644 --- a/libretools.conf +++ b/libretools.conf @@ -35,6 +35,13 @@ PARABOLAHOST=parabola ## Run a command before releasing a package (ie. SSH connection, SSH tunnel, etc.) HOOKPRERELEASE="ssh -fN parabola" +## Run a command for local releasing of packages +# Useful for mass packaging (ie. mips port) +# Must accept the following parameters even if the command won't use them: +# $1 repo name +# $2+ packages +HOOKLOCALRELEASE="mipsrelease" + ## Server destination of libre packages # Don't change unless you know what you're doing and you won't screw # anything ;) diff --git a/mipsrelease b/mipsrelease index 400e9f1..140e524 100755 --- a/mipsrelease +++ b/mipsrelease @@ -1,11 +1,28 @@ #!/bin/bash -# Temporary script for uploading mips64el packages to the server +# Lic: GPLv3+ +# Author: Nicolas Reynolds +# Local release of mips64el packages + clean ABS sync +# Called by HOOKLOCALRELEASE + +# $1 repo +# $2+ packages source /etc/makepkg.conf +repo=$1; shift + pushd ${PKGDEST} >/dev/null -repo-add stage3.db.tar.gz $@ + repo-add stage3.db.tar.gz $@ +popd >/dev/null + +# Get all needed sources +source PKGBUILD +makepkg --source + +[ ! -d ${WORKDIR}/abs/${CARCH}/${repo} ] && mkdir -p ${WORKDIR}/${CARCH}/${repo} >/dev/null +pushd ${WORKDIR}/abs/${CARCH}/${repo} >/dev/null + tar xvf $SRCPKGDEST/${pkgbase:-${pkgname[0]}}-${pkgver}-${pkgrel}-${CARCH}${SRCEXT} popd >/dev/null exit $? -- cgit v1.1-4-g5e80