diff options
-rwxr-xr-x | libremakepkg | 47 | ||||
-rwxr-xr-x | librerepkg | 4 | ||||
-rwxr-xr-x | pkgbuild-check-nonfree | 18 |
3 files changed, 53 insertions, 16 deletions
diff --git a/libremakepkg b/libremakepkg index 8cce89d..ef276f3 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="" +CLEAN_CACHE="" +update_first=0 +chrootname=${CHCOPY} + +while getopts 'hcCun' arg; do + case "${arg}" in + h) usage ;; + c) CLEAN="-c" ;; + C) CLEAN_CACHE="-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 [[$?=15]]; then + if [[ $? -eq 15 ]]; then error "PKGBUILD contains non-free issues" exit 15 else - error "Check failed, continuing" + exit $? fi } -[[ -z $1 ]] && { - CLEAN="-c" - +if [ $update_first -eq 1 ]; then msg "Updating the main chroot" + # -c option in mkarchroot indicates cache mkarchroot -c ${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} -- $CLEAN_CACHE $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 -L +stdnull "popd ${tempdir}" diff --git a/pkgbuild-check-nonfree b/pkgbuild-check-nonfree index c55e7f6..7f04787 100755 --- a/pkgbuild-check-nonfree +++ b/pkgbuild-check-nonfree @@ -23,7 +23,7 @@ source /etc/libretools.conf [[ -f $XDG_CONFIG_HOME/libretools/libretools.conf ]] && \ source $XDG_CONFIG_HOME/libretools/libretools.conf -pushd /tmp >/dev/null +pushd $(mktemp -d) >/dev/null # This is the exit status. ev=0 @@ -44,6 +44,7 @@ wget -N -q -O blacklist.txt "${BLACKLIST}" 2>/dev/null || { # Get everything before the `:' in the blacklist (that's the names of the # packages). unfree=($(cut -d: -f1 blacklist.txt)) +freerep=($(cut -d: -f2 blacklist.txt)) popd >/dev/null @@ -59,10 +60,17 @@ msg "Looking for unfree dependencies" for item in ${pkgname[@]} ${depends[@]} ${makedepends[@]} ; do # We cycle through all of the programs in the array (if any), and check if # they are in the `unfree' array. - if in_array $item ${unfree[@]} - then - ev=15 - msg2 "found $item" + if in_array $item ${unfree[@]} ; then + # if item has a free replacement, use error 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" + fi fi done |