diff options
author | Joshua Ismael Haase Hernández <hahj87@gmail.com> | 2011-04-30 05:53:38 -0500 |
---|---|---|
committer | Joshua Ismael Haase Hernández <hahj87@gmail.com> | 2011-04-30 05:53:38 -0500 |
commit | 8fd5887191e11e0ee64272991a8c5fc6c7636524 (patch) | |
tree | 2e0fbee8e4ce82941481fb7220c69d8d9a9efbe8 | |
parent | f33f1f0ed91fb33e7681291f7f6b260447fcfb86 (diff) |
* libremakepkg optionaly uses a chroot different from $CHCOPY
* libremakepkg cleaning and mkarchroot update is optional
* librerepkg uses -cu flags for libremakepkg
-rwxr-xr-x | libremakepkg | 45 | ||||
-rwxr-xr-x | librerepkg | 2 | ||||
-rwxr-xr-x | 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 @@ -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 |