diff options
author | Nicolás Reynolds <fauno@kiwwwi.com.ar> | 2011-03-21 20:18:44 -0300 |
---|---|---|
committer | Nicolás Reynolds <fauno@kiwwwi.com.ar> | 2011-03-21 20:18:44 -0300 |
commit | f98753091219274bc92cf8a90b7786e288d8219f (patch) | |
tree | 7f72f30a2aaf304fa7b21daf06a8e001bf4efdb7 | |
parent | 9c4f19b5e3f590002c19758cded5cb6ed691a8fd (diff) | |
parent | de28a019385b3a4465ffeadf39e51f0411771edf (diff) |
Merge branch 'master' of ssh://vparabola/srv/git/projects/libretoolsv20110321
-rwxr-xr-x | abslibre-commit | 35 | ||||
-rwxr-xr-x | librechroot | 48 | ||||
-rwxr-xr-x | libremakepkg | 13 | ||||
-rwxr-xr-x | librerelease | 5 | ||||
-rwxr-xr-x | librestage | 33 | ||||
-rw-r--r-- | libretools.conf | 5 |
6 files changed, 101 insertions, 38 deletions
diff --git a/abslibre-commit b/abslibre-commit new file mode 100755 index 0000000..8922cc0 --- /dev/null +++ b/abslibre-commit @@ -0,0 +1,35 @@ +#!/bin/bash +# ABSLibreCommit +# Commits a PKGBUILD to ABSLibre.git + +# Copyright 2010 Nicolás Reynolds + +# ---------- GNU General Public License 3 ---------- + +# This file is part of Parabola. + +# Parabola is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# Parabola is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with Parabola. If not, see <http://www.gnu.org/licenses/>. + +for _pkg in ${@}; do + [[ ! -e ${_pkg}/PKGBUILD ]] && continue + + unset pkgbase pkgname + source ${_pkg}/PKGBUILD + + git stage ${_pkg}/* + + git commit -m "${pkgbase:-$pkgname}-${pkgver}-${pkgrel}" +done + +exit 0 diff --git a/librechroot b/librechroot index 63bf9b4..99adcc0 100755 --- a/librechroot +++ b/librechroot @@ -1,4 +1,7 @@ #!/bin/bash +# LibreChRoot +# Enters a chroot + # Copyright 2010 Nicolás Reynolds # ---------- GNU General Public License 3 ---------- @@ -18,37 +21,38 @@ # You should have received a copy of the GNU General Public License # along with Parabola. If not, see <http://www.gnu.org/licenses/>. -[[ -z "${1}" ]] && { - echo "This scripts enters into the build chroot." - echo "Usage: $0 <chroot name>" - echo "Example: \`$0 root\` enters the 'root' chroot" +[[ "$UID" != "0" ]] && { + echo "This script must be run as root." exit 1 } -[[ $UID -ne 0 ]] && { - echo "This script must be run as root" - exit 2 -} - source /etc/libretools.conf -custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf -[[ -e $custom_config ]] && source $custom_config +custom_config=${XDG_CONFIG_HOME}/libretools/libretools.conf +[[ -e ${custom_config} ]] && source ${custom_config} -[[ ! -d $CHROOTDIR/$1/ ]] && { - echo "There's no $CHROOTDIR/$1" - exit 3 +# Enter the chroot copy by default +root=${1:-$CHCOPY} +CACHEDIR=${CACHEDIR:-/var/cache/pacman/pkg} + +[[ ! -d ${CHROOTDIR}/${root} ]] && { + echo "${CHROOTDIR}/$root is not a dir." + exit 1 } -mount -t proc proc $CHROOTDIR/$1/proc/ -mount -t sysfs sys $CHROOTDIR/$1/sys/ -mount -o bind /dev $CHROOTDIR/$1/dev/ +mount -t proc proc ${CHROOTDIR}/${root}/proc/ +mount -t sysfs sys ${CHROOTDIR}/${root}/sys/ +mount -o bind /dev ${CHROOTDIR}/${root}/dev/ + +# Share pacman cache +mount -o bind ${CACHEDIR} ${CHROOTDIR}/${root}/var/cache/pacman/pkg -cp -L /etc/resolv.conf $CHROOTDIR/$1/etc/resolv.conf >/dev/null 2>&1 +cp -L /etc/resolv.conf ${CHROOTDIR}/${root}/etc/resolv.conf -chroot $CHROOTDIR/$1 /bin/bash +chroot ${CHROOTDIR}/${root} /bin/bash -umount $CHROOTDIR/$1/proc/ -umount $CHROOTDIR/$1/sys/ -umount $CHROOTDIR/$1/dev/ +umount ${CHROOTDIR}/${root}/proc/ +umount ${CHROOTDIR}/${root}/sys/ +umount ${CHROOTDIR}/${root}/dev/ +umount ${CHROOTDIR}/${root}/var/cache/pacman/pkg exit 0 diff --git a/libremakepkg b/libremakepkg index 2055002..cf3f13f 100755 --- a/libremakepkg +++ b/libremakepkg @@ -25,10 +25,17 @@ fi source /etc/libretools.conf -echo "Updating the main chroot" -mkarchroot -u -c ${CACHEDIR} -- ${CHROOTDIR}/${CHROOT} +[[ -z $1 ]] && { + CLEAN="-c" + + echo "Updating the main chroot" + mount -o bind ${CACHEDIR} ${CHROOTDIR}/${CHROOT}/var/cache/pacman/pkg || exit 1 + mkarchroot -u -- ${CHROOTDIR}/${CHROOT} + + mount -o bind ${CACHEDIR} ${CHROOTDIR}/${CHCOPY}/var/cache/pacman/pkg || exit 1 +} echo "Creating the package" -makechrootpkg -c -r ${CHROOTDIR} -l ${CHCOPY} -- $@ +makechrootpkg $CLEAN -r ${CHROOTDIR} -l ${CHCOPY} -- $@ exit 0 diff --git a/librerelease b/librerelease index ad083a3..900cad3 100755 --- a/librerelease +++ b/librerelease @@ -25,16 +25,19 @@ source /etc/libretools.conf custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf [[ -e $custom_config ]] && source $custom_config +[[ ! -z ${HOOKPRERELEASE} ]] && bash -c "${HOOKPRERELEASE}" + echo ":: Uploading packages..." rsync --recursive \ --copy-links \ + --hard-links \ --partial \ --prune-empty-dirs \ --human-readable \ --progress \ -e "ssh " \ ${WORKDIR}/staging \ - ${PARABOLAHOST}:${LIBREDESTDIR} || exit 1 + ${PARABOLAHOST}:${LIBREDESTDIR}/ || exit 1 echo ":: Removing packages from local [staging]" find ${WORKDIR}/staging/ -iname "*.pkg.tar.*" -delete @@ -66,23 +66,34 @@ SRCPKGDEST=${SRCPKGDEST:-.} # Copies the packages to the specified repos inside staging for _arch in ${arch[@]}; do for pkg in ${pkgname[@]}; do + pkgfile="$pkg-$pkgver-$pkgrel-$_arch$PKGEXT" + pkgpath="$PKGDEST/$pkgfile" - pkgfile="$PKGDEST/$pkg-$pkgver-$pkgrel-$_arch$PKGEXT" + if [ -e "${pkgpath}" ]; then + echo found ${pkgfile} - if [ -e "${pkgfile}" ]; then - echo found ${pkgfile} + canonical="" for _repo in ${repos[@]}; do - cp "${pkgfile}" "${WORKDIR}/staging/${_repo}/" || { - echo "Can't put ${pkgfile} on [staging]" - exit 1 - } && { - echo "${pkg} staged on [${_repo}]" - } + [[ -z "$canonical" ]] && { + canonical="${WORKDIR}/staging/${_repo}/${pkgfile}" + cp "${pkgpath}" "${WORKDIR}/staging/${_repo}/" || { + echo "Can't put ${pkgfile} on [staging]" + exit 1 + } && { + echo "${pkg} staged on [${_repo}]" + } + } || { + ln "${canonical}" "${WORKDIR}/staging/${_repo}/${pkgfile}" || { + echo "Can't put ${pkgfile} on [staging]" + exit 1 + } && { + echo "${pkg} staged on [${_repo}]" + } + } done - fi done done -exit 0
\ No newline at end of file +exit 0 diff --git a/libretools.conf b/libretools.conf index ce61f30..a3fd4b8 100644 --- a/libretools.conf +++ b/libretools.conf @@ -26,6 +26,9 @@ PATCHDIR=${WORKDIR}/abslibre/patches ## Parabola hostname (should be the same used on ssh_config PARABOLAHOST=parabola +## Run a command before releasing a package (ie. SSH connection, SSH tunnel, etc.) +HOOKPRERELEASE="ssh -fN parabola" + ## Server destination of libre packages LIBREDESTDIR=/home/parabolavnx/parabolagnulinux.org/free LIBRESRCDIR=/home/parabolavnx/parabolagnulinux.org/repo/pkgbuilds @@ -45,7 +48,7 @@ ABSLIBREGIT=http://projects.parabolagnulinux.org/abslibre.git/ # # Host parabola # Port 22 -# HostName parabolagnulinux.org +# HostName repo.parabolagnulinux.org # User parabolavnx # IdentityFile ~/.ssh/id_rsa |