From 8fd5887191e11e0ee64272991a8c5fc6c7636524 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Sat, 30 Apr 2011 05:53:38 -0500 Subject: * libremakepkg optionaly uses a chroot different from $CHCOPY * libremakepkg cleaning and mkarchroot update is optional * librerepkg uses -cu flags for libremakepkg --- libremakepkg | 45 +++++++++++++++++++++++++++++++++++++-------- librerepkg | 2 +- pkgbuild-check-nonfree | 8 +++++--- 3 files changed, 43 insertions(+), 12 deletions(-) diff --git a/libremakepkg b/libremakepkg index 988b6f2..6b996dc 100755 --- a/libremakepkg +++ b/libremakepkg @@ -1,5 +1,6 @@ #!/bin/bash -# Copyright 2010 Nicolás Reynolds +# Copyright 2010 - 2011 Nicolás Reynolds +# Copyright 2011 Joshua Ismael Haase Hernández # ---------- GNU General Public License 3 ---------- @@ -25,26 +26,54 @@ if [ $UID -ne 0 ]; then exit 1 fi +usage() { + echo "cd to a dir containing a PKGBUILD and run:" + echo "$0 [options] [makepkg args]" + echo + echo "OPTIONS:" + echo + echo " -h : show this message" + echo " -c : cleans CHCOPY and cachedir" + echo " -u : updates before building" + echo " -n chrootname : use this dir instead of CHCOPY" +} + +CLEAN="" +update_first=0 +chrootname=${CHCOPY} + +while getopts 'hcun' arg; do + case "${arg}" in + h) usage ;; + c) CLEAN="-c" ;; + u) update_first=1 ;; + n) chrootname="$OPTARG" ;; + *) MAKEPKG_ARGS="$MAKEPKG_ARGS -$arg $OPTARG" ;; + esac +done + msg "Checking PKGBUILD for non-free issues" pkgbuild-check-nonfree ||{ if [[ $? -eq 15 ]]; then error "PKGBUILD contains non-free issues" exit 15 else - error "Check failed, continuing" + exit $? fi } -[[ -z $1 ]] && { - CLEAN="-c" +mount -o bind ${CACHEDIR} \ + ${CHROOTDIR}/${chrootname}/var/cache/pacman/pkg || exit 1 +if [ $update_first -eq 1 ]; then msg "Updating the main chroot" - mkarchroot -c ${CACHEDIR} -u -- ${CHROOTDIR}/${CHROOT} + mkarchroot $CLEAN ${CACHEDIR} -u -- ${CHROOTDIR}/${CHROOT} +fi - mount -o bind ${CACHEDIR} ${CHROOTDIR}/${CHCOPY}/var/cache/pacman/pkg || exit 1 -} msg "Creating the package" -makechrootpkg $CLEAN -r ${CHROOTDIR} -l ${CHCOPY} -- $@ +makechrootpkg $CLEAN -r ${CHROOTDIR} -l ${chrootname} -- $MAKEPKG_ARGS + +umount ${CHROOTDIR}/${chrootname}/var/cache/pacman/pkg exit 0 diff --git a/librerepkg b/librerepkg index 22c237d..08451bd 100755 --- a/librerepkg +++ b/librerepkg @@ -48,5 +48,5 @@ mv rePKGBUILD PKGBUILD msg2 "Updating md5sums" makepkg -g >> PKGBUILD msg "Repackaging using libremakepkg" -sudo libremakepkg +sudo libremakepkg -cu diff --git a/pkgbuild-check-nonfree b/pkgbuild-check-nonfree index 67c562d..7f04787 100755 --- a/pkgbuild-check-nonfree +++ b/pkgbuild-check-nonfree @@ -62,12 +62,14 @@ for item in ${pkgname[@]} ${depends[@]} ${makedepends[@]} ; do # they are in the `unfree' array. if in_array $item ${unfree[@]} ; then # if item has a free replacement, use error 16. - if in_array $item-libre ${freerep[@]} and [[ $ev -ne 15 ]] ; then - ev=16 + if in_array $item-libre ${freerep[@]} ; then warning "$item -> $item-libre" + if [[ $ev -ne 15 ]]; then + ev=16 + fi else ev=15 - msg2 "found $item" + msg2 "found $item" fi fi done -- cgit v1.2.3