From 5f1ef1bd95e2aa1d5b596d929e12e55e8f00f3d2 Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernández Date: Fri, 9 Dec 2011 06:09:22 -0600 Subject: "cleansystem is sorted" --- cleansystem | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/cleansystem b/cleansystem index 8da434b..5aae1df 100644 --- a/cleansystem +++ b/cleansystem @@ -1,13 +1,8 @@ -bzip2 -filesystem -initscripts -licenses-libre -linux-libre -pacman -pacman-mirrorlist-libre -your-freedom +autoconf +automake bash binutils +bison bzip2 coreutils cronie @@ -16,9 +11,13 @@ device-mapper dhcpcd diffutils e2fsprogs +fakeroot file +filesystem findutils +flex gawk +gcc gcc-libs gettext glibc @@ -26,25 +25,36 @@ grep gzip heirloom-mailx inetutils +initscripts iputils jfsutils less libpipeline +libtool +licenses-libre +linux-libre logrotate lvm2 +m4 +make man-db man-pages mdadm nano +pacman +pacman-mirrorlist-libre +patch pciutils pcmciautils perl +pkg-config ppp procps psmisc reiserfsprogs sed shadow +sudo sysfsutils syslog-ng sysvinit @@ -58,15 +68,4 @@ wget which wpa_supplicant xfsprogs -autoconf -automake -bison -fakeroot -flex -gcc -libtool -m4 -make -patch -pkg-config -sudo +your-freedom -- cgit v1.2.3-54-g00ecf From 7e8764fb315b05068fe9d704734a2a4ec8588e54 Mon Sep 17 00:00:00 2001 From: Nicolás Reynolds Date: Sun, 18 Dec 2011 17:55:03 -0300 Subject: Check running as normal user --- librerelease | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/librerelease b/librerelease index 56cf856..bc765fe 100755 --- a/librerelease +++ b/librerelease @@ -59,6 +59,11 @@ function clean { find ${WORKDIR}/staging/ -type f -delete } +if [ -w / ]; then + error "Run $0 as normal user" + exit 1 +fi + while getopts 'hlcn' arg; do case $arg in h) usage; exit 0 ;; -- cgit v1.2.3-54-g00ecf From dce177d9f929c18d5eb2b5164b18f92c701a0052 Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernández Date: Wed, 21 Dec 2011 01:14:32 -0600 Subject: Some usage messages added --- AUTHORS | 2 +- is_built | 17 +++++++++++++++-- toru | 12 ++++++++++-- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/AUTHORS b/AUTHORS index c35d4e3..6ab8015 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,2 +1,2 @@ -Joshua Ismael +Joshua Haase Nicolás Reynolds diff --git a/is_built b/is_built index f789e4f..60f24e9 100755 --- a/is_built +++ b/is_built @@ -1,11 +1,24 @@ #!/bin/bash -# Detect is a package is installed or in a database +usage() { + echo "$0 " + echo + echo "Detect is a package is installed or in a database" + echo + echo "Example usage: is_built \"pcre>=20\"" +} + +while getopts 'h' arg; do + case $arg in + h) usage; exit 0 ;; + *) usage; exit 1 ;; + esac +done # Checks for package, if -T returns non-zero output, egrep will return 0 # because it finds it, so we negate the value to say it's not built. # -Sp works backwards, it will print output only when the package already # exists -# Example usage: is_built "pcre>=20" + !(sudo pacman -T "$1" | egrep "*" >/dev/null) || \ sudo pacman -Sp "$1" --print-format "%n-%v" 2>/dev/null | egrep "*" >/dev/null diff --git a/toru b/toru index d622510..b71fb8c 100755 --- a/toru +++ b/toru @@ -15,9 +15,17 @@ source /etc/abs.conf source /etc/libretools.conf +# TODO: clean usage instructions +function usage { + echo "$0 [options] repo1 ... repon" + echo + echo "-h : this message" + exit 1 +} + if [ ! -w "$TORUPATH" ]; then error "Toru's path isn't writable. Please check $TORUPATH" - exit 1 + exit 1 fi # TODO move to common functions @@ -115,7 +123,7 @@ split_pkgname_from_pkgver() { sed "s/^\(.\+\)-\([^-]\+-[^-]\+\)$/\1 \2/" $1 } -# Get the fullpkgver +# Get the fullpkgver # pkgname from pkgver separator can be either '-' or ' ' extract_fullpkgver() { echo "$@" | tr " " "\n" | sed "s/^.\+[ -]\([^-]\+-[^-]\+\)$/\1/" -- cgit v1.2.3-54-g00ecf From 32b6057b15e4f0872b9ebd51038c72b0d681cb80 Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernández Date: Wed, 21 Dec 2011 13:58:41 -0600 Subject: create cleansystem list every time --- cleansystem | 71 ------------------------------------------------------------ libremakepkg | 4 +++- 2 files changed, 3 insertions(+), 72 deletions(-) delete mode 100644 cleansystem diff --git a/cleansystem b/cleansystem deleted file mode 100644 index 5aae1df..0000000 --- a/cleansystem +++ /dev/null @@ -1,71 +0,0 @@ -autoconf -automake -bash -binutils -bison -bzip2 -coreutils -cronie -cryptsetup -device-mapper -dhcpcd -diffutils -e2fsprogs -fakeroot -file -filesystem -findutils -flex -gawk -gcc -gcc-libs -gettext -glibc -grep -gzip -heirloom-mailx -inetutils -initscripts -iputils -jfsutils -less -libpipeline -libtool -licenses-libre -linux-libre -logrotate -lvm2 -m4 -make -man-db -man-pages -mdadm -nano -pacman -pacman-mirrorlist-libre -patch -pciutils -pcmciautils -perl -pkg-config -ppp -procps -psmisc -reiserfsprogs -sed -shadow -sudo -sysfsutils -syslog-ng -sysvinit -tar -texinfo -udev -usbutils -util-linux -vi -wget -which -wpa_supplicant -xfsprogs -your-freedom diff --git a/libremakepkg b/libremakepkg index 292e4b5..cb71300 100755 --- a/libremakepkg +++ b/libremakepkg @@ -64,7 +64,9 @@ function buildenv { # Mounts *DEST from makepkg.conf function clean_chroot { # Clean packages with pacman plain "making list of packages in ${CHROOTDIR}/${CHROOTNAME}/root/" - cp "/etc/libretools.d/cleansystem" "${CHROOTDIR}/${CHROOTNAME}/root/cleansystem" + echo "sudo +" > "${CHROOTDIR}/${CHROOTNAME}/root/cleansystem" + pacman -Sgq base base-devel >> "${CHROOTDIR}/${CHROOTNAME}/root/cleansystem" (cat < Date: Thu, 22 Dec 2011 22:08:52 -0300 Subject: Repackage all architectures at once --- librerepkg | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/librerepkg b/librerepkg index 706b603..c33a538 100755 --- a/librerepkg +++ b/librerepkg @@ -44,21 +44,26 @@ usage() { while getopts 'h' arg; do case $arg in h) usage; exit 0 ;; - *) makepkgflags=$@ ;; esac done +makepkgflags=$@ + tempdir=$(mktemp -d /tmp/$(basename $PWD).XXXXX) -msg "Repackaging: $pkgname $pkgver-$pkgrel ($(date -u))" -cp ./* ${tempdir}/ +for _arch in ${arch[@]}; do + export CARCH=${_arch} + + msg "Repackaging: $pkgname $pkgver-$pkgrel ($(date -u))" + cp ./* ${tempdir}/ -stdnull pushd ${tempdir} + stdnull pushd ${tempdir} -msg2 "Updating md5sums" -makepkg -gp rePKGBUILD >> rePKGBUILD + msg2 "Updating md5sums" + makepkg -gp rePKGBUILD >> rePKGBUILD -msg "Repackaging using makepkg" -makepkg -Lcdp rePKGBUILD ${makepkgflags} + msg "Repackaging using makepkg" + makepkg -Lcdp rePKGBUILD ${makepkgflags} -stdnull popd ${tempdir} + stdnull popd ${tempdir} +done -- cgit v1.2.3-54-g00ecf From 89f2322d7c3fc28690d06bda06b45ba7742be1c0 Mon Sep 17 00:00:00 2001 From: Nicolás Reynolds Date: Thu, 22 Dec 2011 23:25:29 -0300 Subject: Skip existing PKGBUILDs (doesn't compare versions) --- aur | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/aur b/aur index ca7d587..1b17358 100755 --- a/aur +++ b/aur @@ -39,9 +39,13 @@ missing_deps=() for _pkg in ${@}; do # Remove the version -# TODO check downloaded PKGBUILD version _pkg="${_pkg%%[<>=]*}" + if [ -f "${_pkg}/PKGBUILD" ]; then + warning "${_pkg} already existed. skipping..." + continue + fi + msg "Downloading $_pkg..." wget -O - -q http://aur.archlinux.org/packages/$_pkg/$_pkg.tar.gz | \ tar xzf - >/dev/null 2>&1 -- cgit v1.2.3-54-g00ecf From f258090c62535b9e02450494507f2e3f08024c96 Mon Sep 17 00:00:00 2001 From: Nicolás Reynolds Date: Thu, 22 Dec 2011 23:27:13 -0300 Subject: Keep base-devel installed. Mount bind to default CacheDir on chroot --- libremakepkg | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/libremakepkg b/libremakepkg index 292e4b5..5a04b4b 100755 --- a/libremakepkg +++ b/libremakepkg @@ -49,15 +49,18 @@ function usage { # Display message and exit function buildenv { # Mounts *DEST from makepkg.conf msg "Building env" - for mp in SRCDEST PKGDEST SRCPKGDEST; do +# for mp in SRCDEST PKGDEST SRCPKGDEST; do # The host system directory - lmp=LOCAL${mp} +# lmp=LOCAL${mp} - msg2 "Binding ${!lmp} to ${CHROOTDIR}/${CHROOT}${!mp}" +# msg2 "Binding ${!lmp} to ${CHROOTDIR}/${CHROOT}${!mp}" - mkdir -p "${CHROOTDIR}/${CHROOT}${!mp}" - mount -o bind ${!lmp} "${CHROOTDIR}/${CHROOT}${!mp}" || exit 1 - done +# mkdir -p "${CHROOTDIR}/${CHROOT}${!mp}" +# mount -o bind ${!lmp} "${CHROOTDIR}/${CHROOT}${!mp}" || exit 1 +# done + + msg2 "Bind ${CACHEDIR} => ${CHROOTDIR}/${CHROOT}/var/cache/pacman/pkg/" + mount -o bind ${CACHEDIR} ${CHROOTDIR}/${CHROOT}/var/cache/pacman/pkg/ } @@ -69,19 +72,14 @@ function clean_chroot { # Clean packages with pacman #!/bin/bash export LANG=C -clean='false' - -while [ "\$clean" = 'false' ]; do - pkgs=(\$(comm -23 <(pacman -Qq | sort) <(sort /root/cleansystem))) if [ \${#pkgs[@]} -gt 0 ]; then pacman --noconfirm -Rcs \${pkgs[@]} + pacman --noconfirm -S --needed base-devel gettext else - clean="true" echo "clean" fi -done EOF ) > "${CHROOTDIR}/${CHROOTNAME}/clean" chmod +x "${CHROOTDIR}/${CHROOTNAME}/clean" -- cgit v1.2.3-54-g00ecf From 55b66d324fb5b08651606207bec73f4d51525c7e Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernández Date: Sat, 24 Dec 2011 21:11:03 -0600 Subject: libremakepkg: uses chroot for cleaning librechroot: clean chroot option added (uses pacman) cleansystem: updated list from a clean chroot --- cleansystem | 119 ++++++++++++++++++++++++++++++++++++++++ librechroot | 127 ++++++++++++++++++++++++++++++++----------- libremakepkg | 174 +++++++++++++++++++---------------------------------------- 3 files changed, 270 insertions(+), 150 deletions(-) create mode 100644 cleansystem diff --git a/cleansystem b/cleansystem new file mode 100644 index 0000000..b91bf86 --- /dev/null +++ b/cleansystem @@ -0,0 +1,119 @@ +acl +attr +autoconf +automake +bash +binutils +bison +bzip2 +cloog +coreutils +cracklib +cronie +cryptsetup +db +dbus-core +device-mapper +dhcpcd +diffutils +e2fsprogs +expat +fakeroot +file +filesystem +findutils +flex +gawk +gcc +gcc-libs +gdbm +gettext +glib2 +glibc +gmp +grep +groff +gzip +heirloom-mailx +iana-etc +inetutils +initscripts +iproute2 +iputils +isl +jfsutils +kbd +keyutils +krb5 +less +libarchive +libcap +libfetch +libffi +libgcrypt +libgpg-error +libgssglue +libldap +libltdl +libmpc +libnl +libpcap +libpipeline +libsasl +libtirpc +libtool +libusb +libusb-compat +licenses-libre +linux-api-headers +linux-libre +logrotate +lvm2 +m4 +make +man-db +man-pages +mdadm +mkinitcpio +mkinitcpio-busybox +module-init-tools +mpfr +nano +ncurses +openssl +pacman +pacman-mirrorlist-libre +pam +patch +pciutils +pcmciautils +pcre +perl +pkg-config +popt +ppl +ppp +procps +psmisc +readline +reiserfsprogs +run-parts +sed +shadow +sudo +sysfsutils +sysvinit +tar +texinfo +tzdata +udev +usbutils +util-linux +vi +wget +which +wpa_supplicant +xfsprogs +xz +your-freedom +zlib diff --git a/librechroot b/librechroot index d3e02f1..31516ac 100755 --- a/librechroot +++ b/librechroot @@ -3,6 +3,7 @@ # Enters a chroot # Copyright 2010 Nicolás Reynolds +# Copyright 2011 Joshua Haase # ---------- GNU General Public License 3 ---------- @@ -21,52 +22,114 @@ # You should have received a copy of the GNU General Public License # along with Parabola. If not, see . -source /etc/libretools.conf - function usage { - echo "Usage: $0 chrootname" - echo "Change to a chroot in $CHROOTDIR. Use it as root." - echo + + echo "Usage: $0 [options] [chrootname]" + echo "Use it as root." + echo '' echo "Default chroot name: $CHROOT" + echo "Default chrootdir: $CHROOTDIR" + echo '' + echo "OPTIONS:" + echo '' + echo " -c : clean the chroot using pacman" + echo " only 'base', 'base-devel' and 'sudo' on chroot" + echo " -d : use instead of default" + echo " -r : clean /repo on the chroot" + echo " -h : this message" + echo " -u : update the chroot" + echo "" + } -while getopts 'h' arg; do - case $arg in - h) usage; exit 0 ;; - esac +function clean_chroot { # Clean packages with pacman + + msg "Cleaning chroot: ${CHROOTDIR}/${CHROOTNAME}" + + cp "/etc/libretools.d/cleansystem" "${CHROOTDIR}/${CHROOTNAME}/cleansystem" + (cat < "${CHROOTDIR}/${CHROOTNAME}/clean" -# Enter the chroot copy by default -chrootname=${1:-$CHROOT} -CACHEDIR=${CACHEDIR:-/var/cache/pacman/pkg} + chmod +x "${CHROOTDIR}/${CHROOTNAME}/clean" + mkarchroot -r "/clean" "${CHROOTDIR}/${CHROOTNAME}" -[[ ! -d ${CHROOTDIR}/${chrootname} ]] && { - error "${CHROOTDIR}/${chrootname} is not a dir." - exit 1 + rm "${CHROOTDIR}/${CHROOTNAME}/clean" + rm "${CHROOTDIR}/${CHROOTNAME}/cleansystem" +} + +function clean_repo { + msg "Cleaning repo for chroot: ${CHROOTDIR}/${CHROOTNAME}" + if [ -d "${CHROOTDIR}/${CHROOTNAME}/repo" ]; then + rm -rf "${CHROOTDIR}/${CHROOTNAME}/repo" + fi } +source /etc/libretools.conf -mount -t proc proc ${CHROOTDIR}/${chrootname}/proc/ -mount -t sysfs sys ${CHROOTDIR}/${chrootname}/sys/ -mount -o bind /dev ${CHROOTDIR}/${chrootname}/dev/ +if [ -e "$XDG_CONFIG_HOME/libretools/libretools.conf" ]; then + source "$XDG_CONFIG_HOME/libretools/libretools.conf" +fi -# Share pacman cache -mount -o bind ${CACHEDIR} ${CHROOTDIR}/${chrootname}/var/cache/pacman/pkg +CLEANCHROOT='false' +UPDATE='false' +CLEANREPO='false' +CHROOTNAME="${CHROOT:-${SUDO_USER:-root}}" -cp -L /etc/resolv.conf ${CHROOTDIR}/${chrootname}/etc/resolv.conf +while getopts 'hrcud:' arg; do + case $arg in + h) usage; exit 0 ;; + c) CLEANCHROOT='true' ;; + u) UPDATE='true' ;; + r) CLEANREPO='true' ;; + d) CHROOTDIR="$(readlink -e $OPTARG)" ;; + esac +done -chroot ${CHROOTDIR}/${chrootname} /bin/bash +[[ "$UID" != "0" ]] && { + error "This script must be run as root." + exit 1 +} -umount ${CHROOTDIR}/${chrootname}/proc/ -umount ${CHROOTDIR}/${chrootname}/sys/ -umount ${CHROOTDIR}/${chrootname}/dev/ -umount ${CHROOTDIR}/${chrootname}/var/cache/pacman/pkg +shift $(($OPTIND - 1)) + +if [ $# -eq 1 ]; then + CHROOTNAME="$1" +fi + +if "$CLEANREPO"; then + clean_repo +fi + +if "$CLEANCHROOT"; then + clean_chroot +elif "$UPDATE"; then + msg "Updating chroot: ${CHROOTDIR}/${CHROOTNAME}" + mkarchroot -u "${CHROOTDIR}/${CHROOTNAME}" +else + msg "Entering chroot: ${CHROOTDIR}/${CHROOTNAME}" + mkarchroot -r "bash" "${CHROOTDIR}/${CHROOTNAME}" +fi exit 0 diff --git a/libremakepkg b/libremakepkg index 2f90cce..7885f1e 100755 --- a/libremakepkg +++ b/libremakepkg @@ -19,97 +19,22 @@ # You should have received a copy of the GNU General Public License # along with Parabola. If not, see . -source /etc/libretools.conf -source /etc/makepkg.conf - -# Local vars may differ from chroot's -LOCALPKGDEST=${PKGDEST} -LOCALSRCDEST=${SRCDEST} -LOCALSRCPKGDEST=${SRCPKGDEST} - -source ${CHROOTDIR}/${CHROOT}/etc/makepkg.conf - -function usage { # Display message and exit - - echo 'cd to a dir containing a PKGBUILD and run:' - echo '$0 [options] [makepkg args]' - echo 'This script will build your package on a chroot.' - echo - echo 'OPTIONS:' - echo - echo ' -h show this message.' - echo ' -c cleans the chroot before building.' - echo ' -u updates the chroot before building.' - echo ' -n use this dir instead of "${CHROOT}".' - echo ' -M <--arg> passes long args to makepkg, use it as many times as needed.' - echo - exit 1 -} - -function buildenv { # Mounts *DEST from makepkg.conf - - msg "Building env" -# for mp in SRCDEST PKGDEST SRCPKGDEST; do -# The host system directory -# lmp=LOCAL${mp} -# msg2 "Binding ${!lmp} to ${CHROOTDIR}/${CHROOT}${!mp}" - -# mkdir -p "${CHROOTDIR}/${CHROOT}${!mp}" -# mount -o bind ${!lmp} "${CHROOTDIR}/${CHROOT}${!mp}" || exit 1 -# done - - msg2 "Bind ${CACHEDIR} => ${CHROOTDIR}/${CHROOT}/var/cache/pacman/pkg/" - mount -o bind ${CACHEDIR} ${CHROOTDIR}/${CHROOT}/var/cache/pacman/pkg/ - -} - -function clean_chroot { # Clean packages with pacman - - plain "making list of packages in ${CHROOTDIR}/${CHROOTNAME}/root/" - echo "sudo -" > "${CHROOTDIR}/${CHROOTNAME}/root/cleansystem" - pacman -Sgq base base-devel >> "${CHROOTDIR}/${CHROOTNAME}/root/cleansystem" - (cat < "${CHROOTDIR}/${CHROOTNAME}/clean" - chmod +x "${CHROOTDIR}/${CHROOTNAME}/clean" - mkarchroot -r "/clean" "${CHROOTDIR}/${CHROOTNAME}" - -} +# set -x # uncomment for debug function copy_log { # copy logs if they exist - if [ "${USE_LOG}" == 'y' ]; then - find ${CHROOTDIR}/${CHROOTNAME}/build/ -name "*\.log" -exec cp {} ./ \; - fi + find "${CHROOTDIR}/${CHROOTNAME}/build/" -name "*\.log" -exec cp {} ./ \; } -function trap_exit { # End inmediately but print a useful message - -# args are treated as part of the message - for mp in ${SRCDEST} ${PKGDEST} ${SRCPKGDEST}; do - umount "${CHROOTDIR}/${CHROOT}${mp}" - done +function trap_exit { # End inmediately but print a useful message copy_log - error "$@" - exit 1 + } # Trap signals from makepkg @@ -118,69 +43,82 @@ trap 'trap_exit "(libremakepkg): TERM signal caught. Exiting..."' TERM HUP QUIT trap 'trap_exit "(libremakepkg): Aborted by user! Exiting..."' INT trap 'trap_exit "(libremakepkg): An unknown error has occurred. Exiting..."' ERR -CLEAN_FIRST="n" -CLEAN_CACHE="" -UPDATE_FIRST="n" -USE_LOG='n' -CHROOTNAME=${CHROOT} +source /etc/libretools.conf + +CLEANFIRST="false" +UPDATEFIRST="false" +CHECKNONFREE="true" +LIBRECHROOT_ARGS="" MAKEPKG_ARGS="" -libremakepkgargs='hcuUn:I:M:' # libremakepkg own args -libremakepkgargs+='ACdefiLmop:rRs' # makepkg args +function usage { + + echo 'cd to a dir containing a PKGBUILD and run:' + echo '$0 [options] [-- makechrootpkg args] [-- makepkg args]' + echo 'This script will build your package on a chroot.' + echo '' + echo 'OPTIONS:' + echo '' + echo ' -h : show this message.' + echo ' -c : clean the chroot before building.' + echo ' -u : update the chroot before building.' + echo ' -d : use this dir instead of "$CHROOTDIR"' + echo ' -n : use this dir instead of "$CHROOT".' + echo ' -N : do not check freedom issues' # As fullpkg-check will do that before + echo '' + exit 1 + +} -while getopts ${libremakepkgargs} arg ; do +while getopts 'hcud:n:N' arg ; do case "${arg}" in h) usage ;; - c) CLEAN_FIRST="y" ;; - u) UPDATE_FIRST="y" ;; - n) CHROOTNAME="$OPTARG" ;; - M) MAKEPKG_ARGS+=" $OPTARG" ;; - L) MAKEPKG_ARGS+=" -$arg $OPTARG" - USE_LOG='y';; - *) MAKEPKG_ARGS+=" -$arg $OPTARG" ;; + c) CLEANFIRST="true" ;; + u) UPDATEFIRST="true" ;; + d) CHROOTDIR="$OPTARG" + LIBRECHROOT_ARGS='-d "$OPTARG"' ;; + n) CHROOT="$OPTARG" ;; + N) CHECKNONFREE="false" ;; esac done -if [ ${UID} -ne 0 ]; then +# Pass all arguments after -- right to makechrootpkg +MAKEPKG_ARGS="$makepkg_args ${*:$OPTIND}" + +if (( EUID )); then error "This script must be run as root" exit 1 fi -if [ ! -r PKGBUILD ]; then # Check if we are actually on a build directory. Do this early. +if [ ! -e PKGBUILD ]; then # Check if we are actually on a build directory. Do this early. error "This isn't a build directory"; usage fi msg "Checking PKGBUILD for non-free issues" -if ! pkgbuild-check-nonfree; then - - if [[ $? -eq 15 ]]; then # other errors mean fail, not nonfree - error "PKGBUILD contains non-free issues" - exit 15 - else - true +if (( CHECKNONFREE )); then + if ! pkgbuild-check-nonfree; then + + if [[ $? -eq 15 ]]; then # other errors mean fail, not nonfree + error "PKGBUILD contains non-free issues" + exit 15 + else + warning "PKGBUILD couldn't be check aganist non-free issues" + fi fi - fi -buildenv - -msg "Creating the package" -if [ ! -d "${CHROOTDIR}/${CHROOTNAME}" ]; then # use chroot - mkarchroot -c ${CACHEDIR} -u "${CHROOTDIR}/${CHROOT}" # -c option is for cache +if (( CLEANFIRST )); then + librechroot -c "$LIBRECHROOT_ARGS" "$CHROOT" fi -if [ "${CLEAN_FIRST}" = 'y' ]; then - msg "Cleaning" - clean_chroot +if (( UPDATEFIRST )); then + librechroot -u "$LIBRECHROOT_ARGS" "$CHROOT" fi -if [ "${UPDATE_FIRST}" = 'y' ]; then - msg "Updating the chroot in use..." - mkarchroot -c ${CACHEDIR} -u "${CHROOTDIR}/${CHROOTNAME}" # -c option is for cache -fi +unset CLEANFIRST UPDATEFIRST LIBRECHROOT_ARGS -makechrootpkg -r "${CHROOTDIR}" -l "${CHROOTNAME}" -- "${MAKEPKG_ARGS}" -ev=$? # exit value +makechrootpkg -r "$CHROOTDIR" -l "$CHROOT" "$MAKEPKG_ARGS" +ev="$?" # exit value copy_log -- cgit v1.2.3-54-g00ecf From cc746eb378b3d24a38e6f6b58890061fd2a995dd Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernández Date: Sat, 24 Dec 2011 21:23:11 -0600 Subject: libremessages: added in_array function --- libremessages | 59 ++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 17 deletions(-) diff --git a/libremessages b/libremessages index d333f3f..5d817dd 100755 --- a/libremessages +++ b/libremessages @@ -26,24 +26,27 @@ export TEXTDOMAINDIR='/usr/share/locale' # check if messages are to be printed using color unset ALL_OFF BOLD BLUE GREEN RED YELLOW - -if tput setaf 0 &>/dev/null; then - ALL_OFF="$(tput sgr0)" - BOLD="$(tput bold)" - BLUE="${BOLD}$(tput setaf 4)" - GREEN="${BOLD}$(tput setaf 2)" - RED="${BOLD}$(tput setaf 1)" - YELLOW="${BOLD}$(tput setaf 3)" - PURPLE="${ALL_OFF}$(tput setaf 5)" -else - ALL_OFF="\033[1;0m" - BOLD="\033[1;1m" - BLUE="${BOLD}\033[1;34m" - GREEN="${BOLD}\033[1;32m" - RED="${BOLD}\033[1;31m" - YELLOW="${BOLD}\033[1;33m" - PURPLE="${BOLD}\033[1;30;40m" +if [[ -t 2 ]]; then + # prefer terminal safe colored and bold text when tput is supported + if tput setaf 0 &>/dev/null; then + ALL_OFF="$(tput sgr0)" + BOLD="$(tput bold)" + PURPLE="${ALL_OFF}$(tput setaf 5)" + BLUE="${BOLD}$(tput setaf 4)" + GREEN="${BOLD}$(tput setaf 2)" + RED="${BOLD}$(tput setaf 1)" + YELLOW="${BOLD}$(tput setaf 3)" + else + ALL_OFF="\e[1;0m" + BOLD="\e[1;1m" + BLUE="${BOLD}\e[1;34m" + GREEN="${BOLD}\e[1;32m" + RED="${BOLD}\e[1;31m" + YELLOW="${BOLD}\e[1;33m" + PURPLE="${BOLD}\033[1;30;40m" + fi fi +readonly ALL_OFF BOLD BLUE GREEN RED YELLOW PURPLE stdnull() { eval "$@ >/dev/null 2>&1" @@ -74,3 +77,25 @@ error() { printf "${RED}==> $(gettext "ERROR:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 } +stat_busy() { + local mesg=$1; shift + printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}...${ALL_OFF}" >&2 +} + +stat_done() { + printf "${BOLD}done${ALL_OFF}\n" >&2 +} + +# usage : in_array( $needle, $haystack ) +in_array() { + [[ $2 ]] || return 1 # Not found + + local needle=$1; shift + local item + + for item in "$@"; do + [[ ${item#@} = $needle ]] && return 0 # Found + done + + return 1 # Not Found +} -- cgit v1.2.3-54-g00ecf From 69acc962f6277cf591125ba111716a7c5723e70e Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernández Date: Sun, 25 Dec 2011 22:17:46 -0600 Subject: toru: -p flag for showing the path of some pkgname --- fullpkg | 21 ++----------------- toru | 72 ++++++++++++++++++++++++++++++++++++----------------------------- 2 files changed, 42 insertions(+), 51 deletions(-) diff --git a/fullpkg b/fullpkg index eddf3d5..bd2e8ae 100755 --- a/fullpkg +++ b/fullpkg @@ -40,23 +40,6 @@ usage() { } -# Finds a PKGBUILD on toru's path cache -# Look in all caches but pick the first one -# TODO move to a toru flag (-p?) -where_is() { - local _repo - local _path - for _repo in ${REPOS[@]}; do - _path=$(grep "^${1}:" "${TORUPATH}/${_repo}.paths.cache" 2>/dev/null| \ - cut -d: -f2 2>/dev/null) - - [ -n "${_path}" ] && break - done - - echo ${_path} - -} - # Removes a package from the buildorder # $1 package name # $2 buildorder file @@ -148,9 +131,9 @@ find_deps() { for _dep in ${deps[@]}; do local found=false - local pkgdir=$(where_is ${_dep}) + local pkgdir=$(toru -p ${_dep}) - if [ -d "${pkgdir}" ]; then + if [ -n "$pkgdir" -a -d "${pkgdir}" ]; then found=true pushd "${pkgdir}" > /dev/null diff --git a/toru b/toru index b71fb8c..a054ddf 100755 --- a/toru +++ b/toru @@ -15,34 +15,11 @@ source /etc/abs.conf source /etc/libretools.conf -# TODO: clean usage instructions -function usage { - echo "$0 [options] repo1 ... repon" - echo - echo "-h : this message" - exit 1 -} - if [ ! -w "$TORUPATH" ]; then error "Toru's path isn't writable. Please check $TORUPATH" exit 1 fi -# TODO move to common functions -# usage : in_array( $needle, $haystack ) -function in_array { - [[ $2 ]] || return 1 # Not found - - local needle=$1; shift - local item - - for item in "$@"; do - [[ ${item#@} = $needle ]] && return 0 # Found - done - - return 1 # Not Found -} - # Stores the lastsync date lastsync() { local lastsyncfile @@ -290,23 +267,56 @@ missing() { true } +## Finds a PKGBUILD on toru's path cache +## usage: where_is +# Look in all caches but pick the first one +where_is() { + local _repo + local _path + for _repo in ${REPOS[@]}; do + _path=$(grep "^${1}:" "${TORUPATH}/${_repo}.paths.cache" 2>/dev/null | + cut -d: -f2) + + [ -n "${_path}" ] && break + done + echo ${_path} +} + +# TODO: clean usage instructions +function usage { + echo "$0 [options] repo1 ... repon" + echo "" + echo "Make a db containing PKGBUILD metadata." + echo "" + echo "-h : this message" +# echo "-a : update all repos at once" + echo "-u : update repo information" + echo "-q : quiet" + echo "-f : rebuild the db even if it is updated" + echo "-p : return the path for pkgname" + exit 1 +} ## MAIN commands=() repos=() quiet=false force=false -while getopts 'hqfum' arg; do +while getopts 'haqfpum' arg; do case $arg in - h) usage; exit 0 ;; - q) quiet=true ;; - f) force=true ;; - u) commands+=(update);; - m) commands+=(missing);; + h) usage; exit 0 ;; +# a) update_all_repos ;; + q) quiet=true ;; + f) force=true ;; + u) commands+=(update);; + p) shift $(( OPTIND - 1 )) + where_is "$1" + exit 0;; + m) commands+=(missing);; esac - shift $((OPTIND-1)) + shift $(( OPTIND - 1 )) done @@ -316,6 +326,4 @@ TMPDIR=$(mktemp -d) ${commands[0]} ${@} -#rm -rf ${TMPDIR} - exit $? -- cgit v1.2.3-54-g00ecf From c4eecdae6106541bfd94c17302c7c55b20754adb Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernández Date: Mon, 26 Dec 2011 00:02:20 -0600 Subject: pkgbuild-check-nonfree: optimized + checks multiple PKGBUILDS --- pkgbuild-check-nonfree | 177 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 142 insertions(+), 35 deletions(-) diff --git a/pkgbuild-check-nonfree b/pkgbuild-check-nonfree index fd7b69e..6f365e3 100755 --- a/pkgbuild-check-nonfree +++ b/pkgbuild-check-nonfree @@ -19,80 +19,187 @@ # You should have received a copy of the GNU General Public License # along with Parabola. If not, see . -source /etc/libretools.conf +# function log_end { +# kill "$teepid" +# rm "$logpipe" +# } + +# function log { +# LOG="pkgbuild-check-nonfree-$(date -u +%Y%m%d).log" +# # ensure overridden package variables survive tee with split packages +# logpipe="$(mktemp -u "$startdir/logpipe.XXXXXXXX")" +# mkfifo "$logpipe" +# tee "$LOG" < "$logpipe" & +# teepid=$! +# trap log_end ERR EXIT +# } + + +function unset_pkgbuild { + + unset 'pkgbase' 'pkgname' 'pkgver' 'pkgrel' 'epoch' 'pkgdesc' \ + 'arch' 'url' 'license' 'groups' 'optdepends' 'provides' \ + 'conflicts' 'replaces' 'backup' 'options' 'install' \ + 'changelog' 'source' 'noextract' 'md5sums' 'build' \ + 'check' 'package' 'depends' 'makedepends' 'checkdepends' + +} + +function assert_pkgbuild { + + if [ -e "$1" ]; then + + source "$1" + if [ -n "${pkgname[0]}" ]; then + return 0 # valid PKGBUILD + fi -function in_array { # usage : in_array( $needle, $haystack ) + fi - [[ $2 ]] || return 1 # Not found + error "$1 is not a valid PKGBUILD" + return 1 +} + +function check_replacement { + + [ $2 ] || return 0 # Free (not found) local needle=$1; shift local item - for item in "$@"; do - [[ ${item#@} = $needle ]] && return 0 # Found + local rep + for line in $@; do + + item="$(echo "$line" | cut -d':' -f1)" + rep="$(echo "$line" | cut -s -d':' -f2)" + + if [ "$item" == "$needle" ]; then + if [ -z "$rep" ]; then + return 15 # Nonfree (found) + else + echo "$rep" + return 0 # Free (has replacement) + fi + fi + done - return 1 # Not Found + return 0 # Free (not found) } function get_blacklist { # Download the blacklist. pushd "$XDG_CONFIG_HOME/libretools" >/dev/null + msg "Downloading the blacklist of proprietary software packages." - wget -N -q -O blacklist.txt "${BLACKLIST}" 2>/dev/null || { - [ -e $XDG_CONFIG_HOME/libretools/blacklist.txt ] || { + + if ! wget -N -q -O blacklist.txt "${BLACKLIST}" 2>/dev/null; then + + if [ -e "$XDG_CONFIG_HOME/libretools/blacklist.txt" ]; then + warning "Using local copy of blacklist" + else error "Download failed, exiting" - exit 1 - } - warning "Using local copy of blacklist" - } + fi + + fi + popd > /dev/null } function check_deps { # Check wheter a package depends on non-free - pushd "$XDG_CONFIG_HOME/libretools/" >/dev/null - local unfree=($(cut -d: -f1 blacklist.txt)) # pkgname:free-replacement:comments - local freerep=($(cut -d: -f2 blacklist.txt)) # pkgname:free-replacement:comments - popd >/dev/null + unset_pkgbuild - msg "Looking for unfree dependencies" - for item in ${pkgname[@]} ${depends[@]} ${makedepends[@]} ; do + if ! assert_pkgbuild "$1"; then + return 1 # not PKGBUILD + fi - if in_array $item ${unfree[@]} ; then + msg "${pkgbase:-${pkgname[0]}} $pkgver $pkgrel ${epoch:-""}" # > "$logpipe" - if in_array $item ${freerep[@]} ; then - warning "$item is repackaged with the same name." - continue + for pkg in ${pkgname[@]} ${depends[@]} ${makedepends[@]} ${checkdepends[@]}; do + + lines=($(grep "$pkg" "$XDG_CONFIG_HOME/libretools/blacklist.txt" | tr " " "_")) + + rep="$(check_replacement $pkg ${lines[@]})" + freedom=$? - elif in_array $item-libre ${freerep[@]} ; then - warning "$item -> $item-libre" + if [ "$freedom" -eq 15 ]; then + warning "found $pkg" # > "$logpipe" + ev=15 + continue + + elif [ -n "$rep" ]; then + + if [ "$rep" = "$pkg" ]; then + msg2 "$pkg is repackaged with the same name." # > "$logpipe" continue else - ev=15 - msg2 "found $item" + msg2 "$pkg -> $rep" # > "$logpipe" + continue fi + fi + done + } -if [ -e $XDG_CONFIG_HOME/libretools/libretools.conf ]; then - source $XDG_CONFIG_HOME/libretools/libretools.conf +function usage { + # TODO: implement PKGBUILD arguments + echo "" + echo "$(basename $0) [options] [PKGBUILD1 PKGBUILD2 ...]" + echo "" + echo "OPTIONS" + echo "" + echo " -h : this message" + echo "" + echo "If no PKGBUILD is specified, one is searched on current directory" + + exit 1 +} + +while getopts 'h' arg; do + case "$arg" in + h) usage ;; + esac +done + +if (( ! EUID )); then + error "Run as normal user" fi -if [ -z "${BLACKLIST}" ]; then - error "BLACKLIST variable is not set your libretools.conf file"; exit 1 +source /etc/libretools.conf +if [ -e "$XDG_CONFIG_HOME/libretools/libretools.conf" ]; then + source "$XDG_CONFIG_HOME/libretools/libretools.conf" fi -if [ -r PKGBUILD ]; then - source PKGBUILD -else - error "There is no PKGBUILD in dir"; exit 1 +if [ -z "${BLACKLIST}" ]; then + error "BLACKLIST variable is not set your libretools.conf file" + exit 1 fi if [ ! -d "$XDG_CONFIG_HOME/libretools" ]; then mkdir -p "$XDG_CONFIG_HOME/libretools" fi +startdir=`pwd` + get_blacklist +# log + +shift $(( OPTIND - 1)) + +msg "Looking for unfree dependencies" + +if [ $# -gt 1 ]; then + + for p in $@; do + if [ -n "$p" ]; then + check_deps "$p" + fi + done + +else + + check_deps "`pwd`/PKGBUILD" -check_deps +fi exit $ev -- cgit v1.2.3-54-g00ecf From fa0b7b6f8e45982f1e2317c386ef0cf49ee840c7 Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernández Date: Tue, 27 Dec 2011 20:07:08 -0600 Subject: libremakepkg: fixed conditionals toru: -p exit with 1 status if not found --- libremakepkg | 7 ++++--- toru | 9 +++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/libremakepkg b/libremakepkg index 7885f1e..9af487f 100755 --- a/libremakepkg +++ b/libremakepkg @@ -53,6 +53,7 @@ MAKEPKG_ARGS="" function usage { + echo '' echo 'cd to a dir containing a PKGBUILD and run:' echo '$0 [options] [-- makechrootpkg args] [-- makepkg args]' echo 'This script will build your package on a chroot.' @@ -95,7 +96,7 @@ if [ ! -e PKGBUILD ]; then # Check if we are actually on a build directory. Do fi msg "Checking PKGBUILD for non-free issues" -if (( CHECKNONFREE )); then +if "$CHECKNONFREE"; then if ! pkgbuild-check-nonfree; then if [[ $? -eq 15 ]]; then # other errors mean fail, not nonfree @@ -107,11 +108,11 @@ if (( CHECKNONFREE )); then fi fi -if (( CLEANFIRST )); then +if "$CLEANFIRST"; then librechroot -c "$LIBRECHROOT_ARGS" "$CHROOT" fi -if (( UPDATEFIRST )); then +if "$UPDATEFIRST"; then librechroot -u "$LIBRECHROOT_ARGS" "$CHROOT" fi diff --git a/toru b/toru index a054ddf..5867bfe 100755 --- a/toru +++ b/toru @@ -280,11 +280,14 @@ where_is() { [ -n "${_path}" ] && break done + [ -z "$_path" ] && return 1 + echo ${_path} } # TODO: clean usage instructions function usage { + echo "" echo "$0 [options] repo1 ... repon" echo "" echo "Make a db containing PKGBUILD metadata." @@ -295,6 +298,7 @@ function usage { echo "-q : quiet" echo "-f : rebuild the db even if it is updated" echo "-p : return the path for pkgname" + echo "" exit 1 } @@ -306,13 +310,14 @@ force=false while getopts 'haqfpum' arg; do case $arg in h) usage; exit 0 ;; -# a) update_all_repos ;; +# TODO: Update all repos on $REPOS array +# a) update_all_repos ;; q) quiet=true ;; f) force=true ;; u) commands+=(update);; p) shift $(( OPTIND - 1 )) where_is "$1" - exit 0;; + exit $?;; m) commands+=(missing);; esac -- cgit v1.2.3-54-g00ecf From af6ac6ea9ef779c0f88fd456e8d73636f22773ce Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernández Date: Wed, 28 Dec 2011 01:23:53 -0600 Subject: fullpkg: split in fullpkg-find and fullpkg-build fullpkg-build: build, download and custom command on fullpkg-find: create a build_dir or append new building instruction libretools-mips64el: deprecation process pkgbuild-check-nonfree: minor bug corrected --- fullpkg | 375 ++----------------------------------------------- fullpkg-build | 211 ++++++++++++++++++++++++++++ fullpkg-find | 194 +++++++++++++++++++++++++ libretools.conf | 24 ++-- mips64el/mips64el.conf | 4 +- pkgbuild-check-nonfree | 8 +- 6 files changed, 433 insertions(+), 383 deletions(-) create mode 100755 fullpkg-build create mode 100644 fullpkg-find diff --git a/fullpkg b/fullpkg index bd2e8ae..fe74432 100755 --- a/fullpkg +++ b/fullpkg @@ -3,383 +3,30 @@ # Builds packages from ABS recursively. It tries to find dependencies that # aren't built or need update and then makepkg them in order. -# TODO move __build to chroot - -source /etc/makepkg.conf -source /etc/abs.conf -source /etc/libretools.conf - -if [ -z $XDG_CONFIG_HOME ]; then # Avoid /libretools dir doesn't exist errors - - error "There's no XDG_CONFIG_HOME var set"; exit 1 - -elif [ -e $XDG_CONFIG_HOME/libretools/libretools.conf ]; then - - source $XDG_CONFIG_HOME/libretools/libretools.conf - -fi - usage() { echo "cd to a dir containing a PKGBUILD and run:" - echo "$0 [options]" - printf "This script will check dependencies, build them if possible " - printf "and stage the packages on it's repo." - echo + echo "$0 [build_dir]" + echo "" + echo "This script will check dependencies, build them if possible " + echo "and stage the packages on it's repo." + echo "" echo "OPTIONS:" echo " -h : this message." - echo " -a absdir : set absdir as ABSROOT." - echo " -b build_dir : use a fullpkg build_dir and only build." - echo " -c : check deps only, do not build." - echo " -d build_dir : use this dir to build. Defaults to mktemp." - echo " -n : don't update pacman db." - echo " -m max_level : check deps until this level" - echo " -r \"command\" : use this instead of \"$FULLBUILDCMD\"" - echo + echo "" + echo "Wrapper for \`fullpkg-find' and \`fullpkg-build'" exit 1 } -# Removes a package from the buildorder -# $1 package name -# $2 buildorder file -remove_buildorder() { - grep -Evw "${1}" ${2} > ${2}2 - mv -f ${2}2 ${2} - - return $? -} - -# Get repo name. Asumes ${ABSROOT}/repo/package/PKGBUILD -guess_repo() { - basename $(dirname $(pwd)) -} - -# return : full version spec, including epoch (if necessary), pkgver, pkgrel -# usage : get_fullver( ${epoch:-0}, $pkgver, $pkgrel ) -get_fullver() { - if [[ $1 -eq 0 ]]; then -# zero epoch case, don't include it in version - echo $2-$3 - else - echo $1:$2-$3 - fi - -} - -# Cleans the build_dir. -cleanup() { -# Do nothing or already cleaned. - [[ "${do_cleanup}" = false || ! -d ${build_dir} ]] && return 0 - -# Only do cleanup on level 0. - msg "Cleaning up..." - [ $level -eq 0 ] && rm -rf $build_dir/ - -} - -# Checks ABSROOT and look for target pkg deps. Adds them if not built or outdated. -find_deps() { -# Check this level - source PKGBUILD - -# unset PKGBUILD variables - unset pkgdesc url license groups optdepends provides conflicts replaces \ - backup options install changelog source noextract md5sums build \ - check package - for _pkg in ${pkgname[@]}; do - unset package_${_pkg} >/dev/null 2>&1 - done - - local repo=${repo:-$(guess_repo)} - local pkgbase=${pkgbase:-${pkgname[0]}} -# Provide a default 0 to epoch - local epoch=${epoch:-0} - local fullver=$(get_fullver ${epoch} ${pkgver} ${pkgrel}) - -# Check if the package is already built - if is_built "${pkgbase}>=${fullver}"; then -# pkg is built and updated - exit 0 - fi - -# greater levels are built first - echo "${level}:${pkgbase}" >>"${build_dir}/BUILDORDER" -# PKGBUILD is already there - if [ -d "${build_dir}/${pkgbase}" ]; then - exit 0 -# Copy dir to build_dir - else - cp -r ../${pkgbase}/ ${build_dir}/ - -# to identify repo later - echo "repo=$repo" > "${build_dir}/${pkgbase}/.INFO" - fi - -# current package plus a space for every level - msg2 "%${level}s${pkgbase}-${fullver}" - -## Check next levels - declare -i next_level=$level+1 - -# All deps in separate line, only once, without version. - deps=($(echo "${depends[@]} ${makedepends[@]}" | \ - sed "s/[=<>]\+[^ ]\+//g" | \ - tr ' ' "\n" | \ - sort -u)) - - for _dep in ${deps[@]}; do - - local found=false - local pkgdir=$(toru -p ${_dep}) - - if [ -n "$pkgdir" -a -d "${pkgdir}" ]; then - found=true - - pushd "${pkgdir}" > /dev/null -# runs itself on dep's PKGBUILD dir - $0 -c -d ${build_dir} -l ${next_level} - -# probable circular deps - [ $? -eq 20 ] && return 20 - popd > /dev/null - fi - - if ! (( found )); then - echo "dep_not_found:$_dep" >>$build_dir/log - fi - - done - -## End variable block - - unset next_level dir -} - -__build() { - pushd ${build_dir} >/dev/null - -# greater levels must be built first - build_packages=($(sort -gr $buildorder | cut -d: -f2)) - - while [ ${#build_packages[@]} -ge 1 ]; do - pushd $build_dir/${build_packages[0]} >/dev/null - source PKGBUILD - - msg2 "${pkgbase:-${pkgname[0]}} $pkgver-$pkgrel" - - msg2 "Checking for non free deps" - pkgbuild-check-nonfree || { -# this error means nonfree others means fail. - if [ $? -eq 15 ]; then - - echo "nonfree:$(basename $PWD)" >>$build_dir/log - -# take out package from $buildorder - remove_buildorder "$(basename $PWD)" $buildorder - -# build next package - continue - fi - } - - msg2 "Building $(basename $PWD)" - -# this buildcmd is on libretools.conf - $FULLBUILDCMD; r=$? - - case $r in - -## Succesfull build - 0) - - plain "The build was succesful." - if source .INFO && [ -n $repo ]; then - -# Calls a local release script if it's used - if [ ! -z $HOOKLOCALRELEASE ]; then - find -name "*.pkg.tar.?z" -print0 | xargs -0 $HOOKLOCALRELEASE $repo - fi - - librestage $repo || echo "unstaged:$(basename $PWD)" >>$build_dir/log - - msg "Updating pacman db and packages" - sudo pacman -Sy || true - - fi - - echo "built:$(basename $PWD)" >>$build_dir/log - ;; - -# # Build failed - *) - error "There were errors while trying to build the package." - echo "failed:$(basename $PWD)" >>$build_dir/log - ;; - esac - - remove_buildorder "${build_packages[0]}" $buildorder || true - -# which is next package? - build_packages=($(sort -gr $buildorder | cut -d: -f2)) - popd > /dev/null - done - - pkgs=($(grep "nonfree:" $build_dir/log)) && { - error "Those packages contain nonfree deps:" - echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 - } - - pkgs=($(grep "built:" $build_dir/log)) && { - msg "Those packages were built and staged:" - echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 - } - - pkgs=($(grep "failed:" $build_dir/log)) && { - error "Those packages failed to build:" - echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 - } - - pkgs=($(grep "unstaged:" $build_dir/log)) && { - error "Those packages couldn't be staged because of missing reponame:" - echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 - } - - popd >/dev/null -} - -# End inmediately but print a useful message -trap_exit() { - error "$@" - warning "Leftover files left on $build_dir" - - exit 1 -} - -# Trap signals from makepkg -set -E -trap 'cleanup' 0 -trap 'trap_exit "(prfullpkg:${level}) TERM signal caught. Exiting..."' TERM HUP QUIT -trap 'trap_exit "(prfullpkg:${level}) Aborted by user! Exiting..."' INT -trap 'trap_exit "(prfullpkg:${level}) An unknown error has occurred. Exiting..."' ERR - -force_build="" -level=0 -noupdate=false -build_only=false -check_deps_only=false -do_cleanup=false -max_level=21 - -while getopts 'ha:b:cCd:l:nm:r:' arg; do - case $arg in +while getopts 'haA:l:nm:' arg; do + case "$arg" in h) usage ;; - a) ABSROOT="$OPTARG" ;; - b) build_only=true - build_dir="$OPTARG" - - if [ -z "${build_dir}" ]; then - usage - fi - - if [ ! -r "${build_dir}/BUILDORDER" ] ; then - error "${build_dir}/BUILDORDER doesn't exist." - exit 1 - fi - - ;; - c) check_deps_only=true ;; - C) do_cleanup=true;; - d) build_dir="$OPTARG" ;; -# hidden option to know dep level. - l) level=$OPTARG ;; - n) noupdate=true;; - m) max_level=$OPTARG ;; - r) FULLBUILDCMD="$OPTARG" ;; esac done -if ! $build_only; then - -# Check if we are actually on a build directory. Do this early. - if [ ! -r PKGBUILD ]; then - error "This isn't a build directory" - usage - fi - -# Run the pre build hook - if [ ! -z "${HOOKPKGBUILDMOD}" ]; then - ${HOOKPKGBUILDMOD} - fi - -fi - -if [ ${level} -eq 0 ]; then - -# use -d option or else mktemp - build_dir="${build_dir:-$(mktemp -d /tmp/fullpkg.XXXXXX)}" - -# in case of custom -d option - if [ ! -d "${build_dir}" ]; then - mkdir -p "${build_dir}" - else -# files already there can screw find_deps - cleanup - fi - -# make files for log and buildorder - touch "${build_dir}"/{log,BUILDORDER} - buildorder="${build_dir}/BUILDORDER" - - if ! noupdate; then - - msg "Updating pacman db" - sudo pacman -Sy --noconfirm || true - - fi - - if $build_only; then - - msg "Building Packages" - - __build - - exit 0 - - fi - - msg "Checking dependencies" -fi - -# Probable circular deps -[ $level -ge $max_level ] && exit 20 - -# Find the dependencies on the ABS itself -find_deps || { - -# Probable circular deps - if [ $? -eq 20 ]; then - -# Show error only on level 0 - if [ $level -eq 0 ]; then - error "Check for circular deps on $build_dir/BUILDORDER"; - fi - - fi -# Pass message 20 - exit 20 -} - -# only build on level 0 -if (( check_deps_only )) || [ $level -gt 0 ]; then - exit 0 -fi - -# Build the packages -msg "Building packages:" -__build +shift $(( OPTIND - 1 )) -echo -msg2 "Check if your system works fine and librerelease if it does." +fullpkg-find "$1" && fullpkg-build -N "$1" exit 0 diff --git a/fullpkg-build b/fullpkg-build new file mode 100755 index 0000000..b497db5 --- /dev/null +++ b/fullpkg-build @@ -0,0 +1,211 @@ +#!/bin/bash +# set -x # uncomment for debug +# Builds packages from ABS recursively. It tries to find dependencies that +# aren't built or need update and then makepkg them in order. + +# TODO move __build to chroot + +source /etc/makepkg.conf +source /etc/libretools.conf + +if [ -e $XDG_CONFIG_HOME/libretools/libretools.conf ]; then + source $XDG_CONFIG_HOME/libretools/libretools.conf +fi + + +## List packages on log that are on status +## usage: list_pkgs +# +## status: nonfree, built, failed, unstaged +list_pkgs() { + msg="$2" + local pkgs=($(grep "$1:" $build_dir/log)) && { + msg "$2" + echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 + } +} + +# return : full version spec, including epoch (if necessary), pkgver, pkgrel +# usage : get_fullver( ${epoch:-0}, $pkgver, $pkgrel ) +get_fullver() { + if [[ $1 -eq 0 ]]; then +# zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi + +} + +## Check all build_dir, fails if one PKGBUILD is nonfree +check_nonfree() { + find "$build_dir" -name PKGBUILD \ + -exec pkgbuild-check-nonfree {} + + if [ "$?" -eq 15 ]; then + error "Some PKGBUILD have nonfree problems" + exit 15 + fi + +} + +# Removes a package from the buildorder +# $1 package name +# $2 buildorder file +remove_buildorder() { + grep -Evw "${1}" ${2} > ${2}2 + mv -f ${2}2 ${2} + + return $? +} + +succesfull_build() { + + if [ "$RUN" != "$FULLBUILDCMD" ]; then + return 0 # Custom command or download sources + fi + + if source .INFO && [ -n "$repo" ]; then + + if [ ! -z "$HOOKLOCALRELEASE" ]; then + find -name "*.pkg.tar.?z" -print0 | xargs -0 "$HOOKLOCALRELEASE" "$repo" + fi + + librestage $repo || echo "unstaged:$(basename $PWD)" >>$build_dir/log + + msg "Updating pacman db and packages" + sudo pacman -Sy || true + + fi + + echo "built:$(basename $PWD)" >>$build_dir/log +} + +build_description() { + list_pkgs "nonfree" "Those packages contain nonfree deps:" + list_pkgs "built" "Those packages were built and staged:" + list_pkgs "failed" "Those packages failed to build:" + list_pkgs "unstaged" "Those packages couldn't be staged (missing reponame):" +} + +__build() { + pushd ${build_dir} >/dev/null + + build_packages=($(sort -gr $buildorder | cut -d: -f2)) # greater levels must be built first + + while [ ${#build_packages[@]} -ge 1 ]; do + + pushd "$build_dir/${build_packages[0]}" >/dev/null + + if [ -n "${HOOKPKGBUILDMOD}" ]; then + ${HOOKPKGBUILDMOD} || true + fi + + eval "$RUN"; r=$? + + case $r in + + 0) succesfull_build ;; + + *) error "There were errors while trying to build the package." + echo "failed:$(basename $PWD)" >>$build_dir/log + ;; + esac + + remove_buildorder "${build_packages[0]}" $buildorder || true + +# which is next package? + build_packages=($(sort -gr $buildorder | cut -d: -f2)) + popd > /dev/null + done + + popd >/dev/null +} + +# End inmediately but print a useful message +trap_exit() { + error "$@" + warning "Leftover files left on $build_dir" + mv .BUILDORDER BUILDORDER + exit 1 +} + +# Trap signals from makepkg +set -E +trap 'trap_exit "(fullpkg-build) TERM signal caught. Exiting..."' TERM HUP QUIT +trap 'trap_exit "(fullpkg-build) Aborted by user! Exiting..."' INT +trap 'trap_exit "(fullpkg-build) An unknown error has occurred. Exiting..."' ERR + +CLEANUP="false" +CHECKNONFREE="true" +RUN="$FULLBUILDCMD" +MESSAGE="Building packages" + +usage() { + + echo "" + echo "$(basename $0) [options] " + echo "" + echo "Builds packages from build_dir, create a build_dir using:" + echo "'fullpkg-find '" + echo "" + echo "If no is specified, it uses the current directory." + echo "" + echo "OPTIONS:" + echo " -h : this message." + echo " -c : clean on succesfull build" + echo " -N : don't check for freedom issues." #Also made by fullpkg-find + echo " -r \"command\" : use this instead of \"$FULLBUILDCMD\"." + echo " -g : get sources for building packages on build_dir." + echo "" + exit 1 + +} + +while getopts 'hNr:g' arg; do + case $arg in + h) usage ;; + c) CLEAN ;; + N) CHECKNONFREE="false" ;; + r) RUN="$OPTARG" + MESSAGE="Executing custom action";; + g) RUN='makepkg -g > /dev/null' + MESSAGE="Downloading packages";; + esac +done + +shift $(( OPTIND - 1 )) +build_dir="${1:-`pwd`}" +buildorder="${build_dir}/BUILDORDER" + +if [ ! -e "$buildorder" ]; then + error "This is not a build_dir. Make one using fullpkg." + usage +else +# backup BUILDORDER + cp "$buildorder" "$build_dir/.BUILDORDER" +fi + +if "$CHECKNONFREE"; then + check_nonfree +fi + +if [ -z "$FULLBUILDCMD" ]; then + error "Set your FULLBUILDCMD on libretools.conf" +fi + +msg "$MESSAGE" +__build + +if [ "$RUN" != "$FULLBUILDCMD" ]; then + # Used for downloading or custom command + mv "$build_dir/.BUILDORDER" "$buildorder" + exit 0 +elif "$CLEANUP"; then + find "$build_dir" -mindepth 1 -delete +fi + +build_description + +plain "Test packages on and if they work fine librerelease." + +exit 0 diff --git a/fullpkg-find b/fullpkg-find new file mode 100644 index 0000000..25565ae --- /dev/null +++ b/fullpkg-find @@ -0,0 +1,194 @@ +#!/bin/bash +# set -x # uncomment for debug +# Builds packages from ABS recursively. It tries to find dependencies that +# aren't built or need update and then makepkg them in order. + +# TODO: fullpkg-find should find packages wich depend on the +# package to be build, so we can avoid "missing $name.so errors" + +# Get repo name. Asumes ${ABSROOT}/repo/package/PKGBUILD +guess_repo() { + basename $(dirname $(pwd)) +} + +# return : full version spec, including epoch (if necessary), pkgver, pkgrel +# usage : get_fullver( ${epoch:-0}, $pkgver, $pkgrel ) +get_fullver() { + if [[ $1 -eq 0 ]]; then +# zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi + +} + +# Checks ABSROOT and look for target pkg deps. Adds them if not built or outdated. +find_deps() { +# Check this level + source PKGBUILD + + local repo="${repo:-$(guess_repo)}" + local pkgbase="${pkgbase:-${pkgname[0]}}" + local fullver="$(get_fullver ${epoch:-0} ${pkgver} ${pkgrel})" + + if ! pkgbuild-check-nonfree > /dev/null 2> /dev/null; then + if [ "$?" -eq 15 ]; then + error "pkgbase" has nonfree issues + return 15 + fi + fi + + if is_built "${pkgbase}>=${fullver}"; then + exit 0 # pkg is built and updated + fi + +# greater levels are built first + echo "${LEVEL}:${pkgbase}" >>"$build_dir/BUILDORDER" +# PKGBUILD is already there + if [ -d "${build_dir}/${pkgbase}" ]; then + exit 0 +# Copy dir to build_dir + else + cp -r ../${pkgbase}/ ${build_dir}/ + +# to identify repo later + echo "repo=$repo" > "${build_dir}/${pkgbase}/.INFO" + fi + +# current package plus a space for every level + msg2 "%${LEVEL}s${pkgbase}-${fullver}" + +## Check next levels + declare -i next_level=$LEVEL+1 + +# All deps in separate line, only once, without version. + deps=($(echo "${depends[@]} ${makedepends[@]}" | \ + sed "s/[=<>]\+[^ ]\+//g" | \ + tr ' ' "\n" | \ + sort -u)) + + for _dep in ${deps[@]}; do + + local found=false + local pkgdir=$(toru -p ${_dep}) + + if [ -n "$pkgdir" -a -d "${pkgdir}" ]; then + found=true + + pushd "${pkgdir}" > /dev/null +# runs itself on dep's PKGBUILD dir + $0 -l ${next_level} ${build_dir} + +# probable circular deps + [ $? -eq 20 ] && return 20 + popd > /dev/null + fi + + if ! (( found )); then + echo "dep_not_found:$_dep" >>$build_dir/log + fi + + done + +## End variable block + + unset next_level dir +} + +source /etc/libretools.conf + +if [ -e $XDG_CONFIG_HOME/libretools/libretools.conf ]; then + source $XDG_CONFIG_HOME/libretools/libretools.conf +fi + +LEVEL=0 +MAXLEVEL=20 +CLEANFIRST='false' +UPDATEDB='true' + +usage() { + + echo "" + echo "cd to a dir containing a PKGBUILD and run:" + echo "$(basename $0) [options] " + echo "" + echo "This script will create a build_dir for recursive building" + echo "it tries to find dependencies that aren't built or need update." + echo "" + echo "If no is specified, the script works on a tempdir" + echo "" + echo "OPTIONS:" + echo " -h : this message." +# echo " -A : use this ABSROOT." # Is it needed anymore? + echo " -c : clean before working." + echo " -m : check deps until this level" + echo " -n : don't update pacman db." + echo "" + exit 1 + +} + +while getopts 'hA:l:cmn' arg; do + case "$arg" in + h) usage ;; +# A) ABSROOT="$OPTARG" ;; + l) LEVEL="$OPTARG" ;; # hidden option to know dep level. + c) CLEANFIRST='true' ;; + m) MAXLEVEL="$OPTARG" ;; + n) UPDATEDB='false' ;; + esac +done + +if [ ! -r PKGBUILD ]; then + error "This directory doesnt contain a PKGBUILD" + usage +fi + +shift $(( OPTIND - 1 )) +build_dir="${1}" + +if [ "$LEVEL" -eq 0 ]; then + + build_dir="${1:-$(mktemp -d /tmp/fullpkg.XXXXXX)}" + + if [ ! -d "$build_dir" ]; then + mkdir -p "$build_dir" + elif "$CLEANFIRST"; then + # Erase files already in dir + msg "Cleaning up files in dir" + find "$build_dir" -mindepth 1 -delete + fi + + if "$UPDATEDB"; then + msg "Updating pacman db" + sudo pacman -Sy --noconfirm || true + fi + +# make files for log and buildorder + touch "${build_dir}"/{log,BUILDORDER} + buildorder="${build_dir}/BUILDORDER" + + msg "Checking dependencies" +fi + +# Probable circular deps +[ "$LEVEL" -gt "$MAXLEVEL" ] && exit 20 + +# Find the dependencies on the ABS itself +find_deps || { + +# Probable circular deps + if [ "$?" -eq 20 ]; then + +# Show error only on level 0 + if [ "$LEVEL" -eq 0 ]; then + error "Check for circular deps on $build_dir/BUILDORDER"; + fi + + fi +# Pass message 20 + exit 20 +} + +exit 0 diff --git a/libretools.conf b/libretools.conf index 05971d3..9e7f938 100644 --- a/libretools.conf +++ b/libretools.conf @@ -19,9 +19,10 @@ ARCHES=('i686' 'x86_64' 'mips64el' 'any') CHROOTDIR=/home/chroot ## The working chroot -# A chroot is useful to build packages isolated from the current system and avoid -# unwanted (as in not in dependencies) automatic library linking -CHROOT=root +## A chroot is useful to build packages isolated from the current system and avoid +## unwanted (as in not in dependencies) automatic library linking +# CHROOT=$SUDO_USER +# CHROOT=root ## Obtains CacheDir from pacman.conf CACHEDIR=`grep "^#\?CacheDir" /etc/pacman.conf | cut -d'=' -f2` @@ -46,10 +47,11 @@ ABSLIBREGIT=http://projects.parabolagnulinux.org/abslibre.git #COMMITCMD=git #COMMITCMD=hg -## Build cmd for fullpkg-ng ## Uncomment one of those or make one of your choice -FULLBUILDCMD="sudo libremakepkg -cumL -M --noconfirm -M --nocheck" -#FULLBUILDCMD="here is a place for cross-compiling build cmd" +# Normal fullpkg +FULLBUILDCMD="sudo libremakepkg -cuN -- -d" +# Cross compiling fullkpg +# FULLBUILDCMD="sudo libremakepkg -cuN -d '/path/to/cross-compiling/chroot' -- -d" ## Toru # Section for toru's vars @@ -71,18 +73,14 @@ for VAR in CHROOTDIR CHROOT CACHEDIR PARABOLAHOST LIBREDESTDIR \ echo "Configure $VAR var in /etc/libretools.conf" ret=1 } - [ $ret -ne 0 ] && exit 1 + [ $ret -ne 0 ] && exit 1 done source /usr/bin/libremessages ## These are architecture specific files. -## Uncomment them if you installed libretools-arch -#source /etc/libretools.d/mips64el.conf -#source /etc/libretools.d/x86_64.conf -#source /etc/libretools.d/i686.conf - - +## Uncomment them if you installed libretools-mips64el +# source /etc/libretools.d/mips64el.conf ## Recommended SSH Config follows # SSH host, it's better if you have it configured on ~/.ssh/config diff --git a/mips64el/mips64el.conf b/mips64el/mips64el.conf index 0825fad..836b407 100644 --- a/mips64el/mips64el.conf +++ b/mips64el/mips64el.conf @@ -2,11 +2,11 @@ ## Run a command for PKGBUILD modifications before building ## Like adding 'mips64el' to arch if it's not there -HOOKPKGBUILDMOD="mips-add" +# HOOKPKGBUILDMOD="mips-add" ## 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" +# HOOKLOCALRELEASE="mipsrelease" diff --git a/pkgbuild-check-nonfree b/pkgbuild-check-nonfree index 6f365e3..bd6fa4b 100755 --- a/pkgbuild-check-nonfree +++ b/pkgbuild-check-nonfree @@ -111,7 +111,7 @@ function check_deps { # Check wheter a package depends on non-free return 1 # not PKGBUILD fi - msg "${pkgbase:-${pkgname[0]}} $pkgver $pkgrel ${epoch:-""}" # > "$logpipe" + msg2 "${pkgbase:-${pkgname[0]}} $pkgver $pkgrel ${epoch:-""}" # > "$logpipe" for pkg in ${pkgname[@]} ${depends[@]} ${makedepends[@]} ${checkdepends[@]}; do @@ -128,10 +128,10 @@ function check_deps { # Check wheter a package depends on non-free elif [ -n "$rep" ]; then if [ "$rep" = "$pkg" ]; then - msg2 "$pkg is repackaged with the same name." # > "$logpipe" + plain "$pkg is repackaged with the same name." # > "$logpipe" continue else - msg2 "$pkg -> $rep" # > "$logpipe" + plain "$pkg -> $rep" # > "$logpipe" continue fi @@ -188,7 +188,7 @@ shift $(( OPTIND - 1)) msg "Looking for unfree dependencies" -if [ $# -gt 1 ]; then +if [ $# -ge 1 ]; then for p in $@; do if [ -n "$p" ]; then -- cgit v1.2.3-54-g00ecf From 5dfcf97c54da649391d74c5bfc1f46c78a075081 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 31 Dec 2011 12:01:33 -0500 Subject: fix typo in usage output for librecommit --- librecommit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/librecommit b/librecommit index d3ddbff..1698bed 100755 --- a/librecommit +++ b/librecommit @@ -25,7 +25,7 @@ usage () { echo echo "$0 [optionally files to commit]" echo - echo "This script commits the package using name, pkgver an pkgver" + echo "This script commits the package using name, pkgver and pkgrel" echo exit 1 } -- cgit v1.2.3-54-g00ecf From cee8f02712f72cb64633ec872a0208995d4c6fc4 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 31 Dec 2011 16:39:09 -0500 Subject: Fix renamed variable in libremakepkg (s/CHROOTNAME/CHROOT/) --- libremakepkg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libremakepkg b/libremakepkg index 9af487f..99ab1a4 100755 --- a/libremakepkg +++ b/libremakepkg @@ -24,7 +24,7 @@ function copy_log { # copy logs if they exist - find "${CHROOTDIR}/${CHROOTNAME}/build/" -name "*\.log" -exec cp {} ./ \; + find "${CHROOTDIR}/${CHROOT}/build/" -name "*\.log" -exec cp {} ./ \; } -- cgit v1.2.3-54-g00ecf From 37ec8895a3ad8113c2664b94d03280f427b42507 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 31 Dec 2011 17:34:18 -0500 Subject: write libremkchroot --- libremkchroot | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100755 libremkchroot diff --git a/libremkchroot b/libremkchroot new file mode 100755 index 0000000..c1f2072 --- /dev/null +++ b/libremkchroot @@ -0,0 +1,67 @@ +#!/bin/bash +# LibreMkChroot +# Creates a chroot + +# Copyright 2011 Luke Shumaker + +# ---------- 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 . + +source /etc/libretools.conf + +if [ -e "$XDG_CONFIG_HOME/libretools/libretools.conf" ]; then + source "$XDG_CONFIG_HOME/libretools/libretools.conf" +fi + +#CHROOTNAME="${CHROOT:-${SUDO_USER:-root}}" + +cmd=${0##*/} + +function usage { + echo "Usage: $cmd [OPTIONS]" + echo 'This script will create a chroot to build packages in.' + echo "Use \`librechroot' to interact with the chroot after it is created." + echo '' + echo 'Options:' + echo ' -h Show this message' + echo '' + echo ' -f Force overwrite of files in the working-dir' + echo '' + echo ' -d Use this dir instead of "$CHROOTDIR".' + echo " -c Location of pacman cache. Default: \`/var/cache/pacman/pkg'." + echo ' -C Location of pacman config file.' + echo ' -M Location of makepkg config file.' +} + +mkchroot_args=''; +while getopts 'hfd:c:C:M:' arg; do + case "$arg" in + h) usage; exit 0 ;; + f) mkchroot_args="$mkchroot_args -$arg" ;; + c|C|M) mkchroot_args="$mkchroot_args -$arg $OPTARG" ;; + d) CHROOTDIR=$OPTARG ;; + ?) usage; exit 1 ;; + esac +done + +if (( EUID )); then + error "This script must be run as root" + exit 1 +fi + +mkdir -p "${CHROOTDIR}" +xargs -d'\n' mkarchroot $mkchroot_args "${CHROOTDIR}/root" < /etc/libretools.d/cleansystem -- cgit v1.2.3-54-g00ecf From 869ca57106526a8e6b2dd67d3fafbb3e7cee4a3b Mon Sep 17 00:00:00 2001 From: Nicolás Reynolds Date: Thu, 5 Jan 2012 18:07:01 -0300 Subject: Don't run as root, since it won't work if WORKDIR is not an absolute path --- librestage | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/librestage b/librestage index 65ee19b..d8eae19 100755 --- a/librestage +++ b/librestage @@ -21,10 +21,17 @@ # You should have received a copy of the GNU General Public License # along with Parabola. If not, see . + source /etc/libretools.conf custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf [[ -e $custom_config ]] && source $custom_config +if [ -w / ]; then + error "This script should be run as regular user" + exit 1 +fi + + # End Config usage() { -- cgit v1.2.3-54-g00ecf From 971e5b7d0cd614e1be3a82380ef16911f2d9cefe Mon Sep 17 00:00:00 2001 From: Nicolás Reynolds Date: Thu, 5 Jan 2012 18:10:51 -0300 Subject: Be more informative + don't allow empty SIGEXT --- librerelease | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/librerelease b/librerelease index c4584e1..f31bc3a 100755 --- a/librerelease +++ b/librerelease @@ -47,6 +47,11 @@ function list_packages { } function sign_packages { + if [ -z "${SIGEXT}" ]; then + SIGEXT=.sig + warning "Empty SIGEXT var, using default .sig" + fi + if [ -z "${GPG_AGENT_INFO}" ]; then warning "It's better to use gpg-agent to sign packages in batches" fi @@ -66,6 +71,7 @@ function sign_packages { fi fi + msg2 "Signing ${package}..." gpg --default-key "${SIGID}" --output "${package}${SIGEXT}" --detach-sig "${package}" done } -- cgit v1.2.3-54-g00ecf