From f33f1f0ed91fb33e7681291f7f6b260447fcfb86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Sat, 30 Apr 2011 03:29:17 -0500 Subject: pkgbuild-check-nonfree can check if a nonfree has a -libre replacement --- libremakepkg | 2 +- pkgbuild-check-nonfree | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/libremakepkg b/libremakepkg index 8cce89d..988b6f2 100755 --- a/libremakepkg +++ b/libremakepkg @@ -27,7 +27,7 @@ fi 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 diff --git a/pkgbuild-check-nonfree b/pkgbuild-check-nonfree index c55e7f6..67c562d 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,15 @@ 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 + 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 + warning "$item -> $item-libre" + else + ev=15 msg2 "found $item" + fi fi done -- cgit v1.2.3-2-g168b 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-2-g168b From d7e07174e2dae3d1bd9ec79c90cba9912f2cef0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Tue, 10 May 2011 17:00:22 -0500 Subject: * Clean cache option for libremakepkg --- libremakepkg | 12 ++++++------ librerepkg | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libremakepkg b/libremakepkg index 6b996dc..ef276f3 100755 --- a/libremakepkg +++ b/libremakepkg @@ -39,13 +39,15 @@ usage() { } CLEAN="" +CLEAN_CACHE="" update_first=0 chrootname=${CHCOPY} -while getopts 'hcun' arg; do +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" ;; @@ -62,17 +64,15 @@ pkgbuild-check-nonfree ||{ fi } -mount -o bind ${CACHEDIR} \ - ${CHROOTDIR}/${chrootname}/var/cache/pacman/pkg || exit 1 - if [ $update_first -eq 1 ]; then msg "Updating the main chroot" - mkarchroot $CLEAN ${CACHEDIR} -u -- ${CHROOTDIR}/${CHROOT} + # -c option in mkarchroot indicates cache + mkarchroot -c ${CACHEDIR} -u -- ${CHROOTDIR}/${CHROOT} fi msg "Creating the package" -makechrootpkg $CLEAN -r ${CHROOTDIR} -l ${chrootname} -- $MAKEPKG_ARGS +makechrootpkg $CLEAN -r ${CHROOTDIR} -l ${chrootname} -- $CLEAN_CACHE $MAKEPKG_ARGS umount ${CHROOTDIR}/${chrootname}/var/cache/pacman/pkg diff --git a/librerepkg b/librerepkg index 08451bd..0a38e00 100755 --- a/librerepkg +++ b/librerepkg @@ -48,5 +48,5 @@ mv rePKGBUILD PKGBUILD msg2 "Updating md5sums" makepkg -g >> PKGBUILD msg "Repackaging using libremakepkg" -sudo libremakepkg -cu - +sudo libremakepkg -cu -L +stdnull "popd ${tempdir}" -- cgit v1.2.3-2-g168b From 2dbaa71d3fd9092e5fa5d79671ada8ceed9bdf69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Tue, 10 May 2011 17:35:29 -0500 Subject: libretools.conf updated --- libretools.conf | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/libretools.conf b/libretools.conf index 0999040..8a7769f 100644 --- a/libretools.conf +++ b/libretools.conf @@ -50,7 +50,20 @@ ABSLIBREGIT=http://projects.parabolagnulinux.org/abslibre.git/ #COMMITCMD=git #COMMITCMD=hg -# Recommended SSH Config +# Checks if vars aren't empty +# +for VAR in CHROOTDIR CHROOT CHCOPY CACHEDIR PARABOLAHOST LIBREDESTDIR \ + LIBRESRCDIR BLACKLIST WORKDIR PATCHDIR REPOS ARCHES ABSLIBREGIT COMMITCMD DIFFTOOL; do + + [[ -z ${!VAR} ]] && { + echo "Configure $VAR var in /etc/libretools.conf" + exit 1 + } +done + +source /usr/bin/libremessages + +## Recommended SSH Config follows # SSH host, it's better if you have it configured on ~/.ssh/config # with ControlMaster auto (and a shell opened somewhere else) # @@ -73,17 +86,3 @@ ABSLIBREGIT=http://projects.parabolagnulinux.org/abslibre.git/ # HostName parabolagnulinux.org # User parabola # IdentityFile ~/.ssh/id_rsa - - -# Checks if vars aren't empty -# -for VAR in CHROOTDIR CHROOT CHCOPY CACHEDIR PARABOLAHOST LIBREDESTDIR \ - LIBRESRCDIR BLACKLIST WORKDIR PATCHDIR REPOS ARCHES ABSLIBREGIT COMMITCMD DIFFTOOL; do - - [[ -z ${!VAR} ]] && { - echo "Configure $VAR var in /etc/libretools.conf" - exit 1 - } -done - -source /usr/bin/libremessages -- cgit v1.2.3-2-g168b From 79dfb33774ec1d789c6f1b306f607cf0eeea7a6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Tue, 10 May 2011 17:52:19 -0500 Subject: fixed libremakepkg error --- libremakepkg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libremakepkg b/libremakepkg index ef276f3..2e75288 100755 --- a/libremakepkg +++ b/libremakepkg @@ -47,7 +47,7 @@ while getopts 'hcCun' arg; do case "${arg}" in h) usage ;; c) CLEAN="-c" ;; - C) CLEAN_CACHE="-C" + C) CLEAN_CACHE="-C" ;; u) update_first=1 ;; n) chrootname="$OPTARG" ;; *) MAKEPKG_ARGS="$MAKEPKG_ARGS -$arg $OPTARG" ;; -- cgit v1.2.3-2-g168b From 78a08b6b6a1b7a156c998a4c6777041450d893e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Tue, 10 May 2011 21:05:43 -0500 Subject: Cleaning --- libremakepkg | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libremakepkg b/libremakepkg index 2e75288..556314e 100755 --- a/libremakepkg +++ b/libremakepkg @@ -40,15 +40,14 @@ usage() { CLEAN="" CLEAN_CACHE="" -update_first=0 +update_first="n" chrootname=${CHCOPY} while getopts 'hcCun' arg; do case "${arg}" in h) usage ;; c) CLEAN="-c" ;; - C) CLEAN_CACHE="-C" ;; - u) update_first=1 ;; + u) update_first="y" ;; n) chrootname="$OPTARG" ;; *) MAKEPKG_ARGS="$MAKEPKG_ARGS -$arg $OPTARG" ;; esac @@ -59,12 +58,11 @@ pkgbuild-check-nonfree ||{ if [[ $? -eq 15 ]]; then error "PKGBUILD contains non-free issues" exit 15 - else exit $? fi } -if [ $update_first -eq 1 ]; then +if [ $update_first = y ]; then msg "Updating the main chroot" # -c option in mkarchroot indicates cache mkarchroot -c ${CACHEDIR} -u -- ${CHROOTDIR}/${CHROOT} @@ -74,6 +72,4 @@ fi msg "Creating the package" makechrootpkg $CLEAN -r ${CHROOTDIR} -l ${chrootname} -- $CLEAN_CACHE $MAKEPKG_ARGS -umount ${CHROOTDIR}/${chrootname}/var/cache/pacman/pkg - exit 0 -- cgit v1.2.3-2-g168b From 1c4ec45a3ae479267319f72e4b5b1616ee85aa63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Tue, 10 May 2011 21:07:35 -0500 Subject: Clean 2 --- libremakepkg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libremakepkg b/libremakepkg index 556314e..c268f1f 100755 --- a/libremakepkg +++ b/libremakepkg @@ -70,6 +70,6 @@ fi msg "Creating the package" -makechrootpkg $CLEAN -r ${CHROOTDIR} -l ${chrootname} -- $CLEAN_CACHE $MAKEPKG_ARGS +makechrootpkg $CLEAN -r ${CHROOTDIR} -l ${chrootname} -- $MAKEPKG_ARGS exit 0 -- cgit v1.2.3-2-g168b From 6dfbe0e2ab6178a243a732aab721da6d2b583745 Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernandez Date: Wed, 11 May 2011 22:37:58 -0500 Subject: Some message changes and cleanup --- fullpkg | 39 ++++++++------------------------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/fullpkg b/fullpkg index c292bdd..f74c0b5 100755 --- a/fullpkg +++ b/fullpkg @@ -86,7 +86,7 @@ check_queue() { # Checks if the package is banned from building is_banned() { rsync -e ssh -aq $PARABOLAHOST:mips64el/ban $ban_file >/dev/null 2>&1 || { - echo ":: Failed to get ban list" + plain ":: Failed to get ban list" return 0 } @@ -95,7 +95,6 @@ is_banned() { return $? } - # TODO keep track of spawned fullpkgs quit() { remove_queue @@ -108,9 +107,8 @@ repo=${1:-$(guess_repo)} source PKGBUILD msg "Building ${repo:-missing repo}/${pkgbase:-${pkgname[@]}}: $pkgdesc" -is_built "${pkgbase:-${pkgname[0]}}>=${pkgver}-${pkgrel}" && exit 0 - -#sudo pacman -Sy +is_built "${pkgbase:-${pkgname[0]}}>=${pkgver}-${pkgrel}" && \ + msg2 "This package is built." && exit 0 trap "quit" TERM KILL INT @@ -129,15 +127,6 @@ if ! grep mips64el PKGBUILD >/dev/null; then sed -i "s/^\(arch=([^)anym]\+\))/\1 'mips64el')/" "PKGBUILD" fi -# Gets the dependency list from the package_* functions -#pkgdeps=($(cat PKGBUILD | \ -# tr -d "\n" | \ -# sed -n "s/depends=(\([^)]\+\))/\n::\1\n/pg" | \ -# grep --color=never "^::" | \ -# tr -d [:\'\"] | \ -# tr " " "\n" | \ -# sort -u)) - # Clean version checking deps=$(echo "${depends[@]} ${makedepends[@]} ${pkgdeps[@]}" | \ sed "s/[=<>]\+[^ ]\+//g" | \ @@ -145,10 +134,6 @@ deps=$(echo "${depends[@]} ${makedepends[@]} ${pkgdeps[@]}" | \ sort -u) msg "Checking dependencies" -plain "${deps[@]}" - -#msg "Syncing database" -#sudo pacman -Sy for _dep in ${deps[@]}; do is_banned $_dep && continue @@ -162,7 +147,7 @@ for _dep in ${deps[@]}; do # If this version is built, continue with the next dep if is_built "$_dep>=$pkgver-$pkgrel"; then - msg2 "No need to build this one" + plain "No need to build this one" break fi @@ -194,18 +179,10 @@ for _dep in ${deps[@]}; do done # TODO probably not elegant enough -# [[ ${#failed[@]} -gt 0 ]] || [[ ${#missing[@]} -gt 0 ]] && { - [[ ${#failed[@]} -gt 0 ]] && { - error "This packages failed to build: ${failed[@]}" - exit 1 - } - -# [[ ${#missing[@]} -gt 0 ]] && { -# echo ":: This packages are missing: ${missing[@]}" -# } - -# exit 1 -#} +[[ ${#failed[@]} -gt 0 ]] && { + error "This packages failed to build: ${failed[@]}" + exit 1 +} # Let everybody know we're building this update_queue || { -- cgit v1.2.3-2-g168b From 4cf996cfd6dfccae0c6b36de78def6e747aae89d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Thu, 12 May 2011 12:57:10 -0500 Subject: cleaned libremakepkg --- libremakepkg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libremakepkg b/libremakepkg index c268f1f..aa29572 100755 --- a/libremakepkg +++ b/libremakepkg @@ -43,7 +43,7 @@ CLEAN_CACHE="" update_first="n" chrootname=${CHCOPY} -while getopts 'hcCun' arg; do +while getopts 'hcun' arg; do case "${arg}" in h) usage ;; c) CLEAN="-c" ;; -- cgit v1.2.3-2-g168b From fe0d876c4930180e6604b754cb8287ae042127da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Thu, 12 May 2011 14:42:34 -0500 Subject: stdnull needs quotes --- aur | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aur b/aur index e300dd1..38b2e2e 100755 --- a/aur +++ b/aur @@ -14,7 +14,7 @@ for _pkg in ${@}; do continue } - stdnull pushd $_pkg + stdnull "pushd $_pkg" source PKGBUILD -- cgit v1.2.3-2-g168b From 92d1fe72f7ec9deea70772aa41ec1e29072599c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Thu, 12 May 2011 14:54:49 -0500 Subject: little fix --- aur | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/aur b/aur index 38b2e2e..44ac650 100755 --- a/aur +++ b/aur @@ -19,13 +19,15 @@ for _pkg in ${@}; do source PKGBUILD pkgbuild-check-nonfree || { - warning "This PKGBUILD links to known unfree packages" + if [ $? -eq 15 ]; then + warning "This PKGBUILD links to known unfree packages" + fi } msg2 "Checking license..." free=0 for _license in ${license[@]}; do - if ! -d /usr/share/licenses/common/$_license; then + if [ ! -d /usr/share/licenses/common/$_license ]; then warning "License $_license is not a common license" free=1 fi -- cgit v1.2.3-2-g168b From 0fa9894cbc10f0742c3076666524956f7279e8af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Sat, 14 May 2011 20:24:53 -0500 Subject: * libremessages use chrootname optarg indeed --- libremakepkg | 12 ++++++------ libremessages | 3 +-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/libremakepkg b/libremakepkg index aa29572..f2b523d 100755 --- a/libremakepkg +++ b/libremakepkg @@ -43,12 +43,12 @@ CLEAN_CACHE="" update_first="n" chrootname=${CHCOPY} -while getopts 'hcun' arg; do +while getopts 'hcun:' arg; do case "${arg}" in - h) usage ;; + h) usage; exit 0 ;; c) CLEAN="-c" ;; u) update_first="y" ;; - n) chrootname="$OPTARG" ;; + n) chrootname="$OPTARG"; echo $chrootname ;; *) MAKEPKG_ARGS="$MAKEPKG_ARGS -$arg $OPTARG" ;; esac done @@ -60,16 +60,16 @@ pkgbuild-check-nonfree ||{ exit 15 exit $? fi -} +} if [ $update_first = y ]; then msg "Updating the main chroot" # -c option in mkarchroot indicates cache - mkarchroot -c ${CACHEDIR} -u -- ${CHROOTDIR}/${CHROOT} + mkarchroot -c ${CACHEDIR} -u "${CHROOTDIR}/${CHROOT}" fi msg "Creating the package" -makechrootpkg $CLEAN -r ${CHROOTDIR} -l ${chrootname} -- $MAKEPKG_ARGS +makechrootpkg $CLEAN -r ${CHROOTDIR} -l "${chrootname}" -- $MAKEPKG_ARGS exit 0 diff --git a/libremessages b/libremessages index 9fbbc2b..c297f2d 100755 --- a/libremessages +++ b/libremessages @@ -46,8 +46,7 @@ else fi stdnull() { - local action=$1; - eval "${action} >/dev/null 2>&1" + eval "$@ >/dev/null 2>&1" } plain() { -- cgit v1.2.3-2-g168b From 7f118f53283d7e228c40a40076815ce94ebb94a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Mon, 16 May 2011 00:44:39 -0500 Subject: Cleaned up some things, added option parse to some scripts. --- aur | 14 ++++++++++++++ createworkdir | 12 +----------- librechroot | 39 ++++++++++++++++++++++++++------------- libremakepkg | 40 ++++++++++++++++++++++------------------ librerelease | 56 +++++++++++++++++++++++++++++++++++++++++++------------- librerepkg | 10 +++++++++- 6 files changed, 115 insertions(+), 56 deletions(-) diff --git a/aur b/aur index 44ac650..b7ad018 100755 --- a/aur +++ b/aur @@ -3,6 +3,20 @@ source /etc/libretools.conf source /etc/abs.conf +function usage { + echo "Usage: $0 pkgname-from-aur1 [pkgname-from-aur2 ...]" + echo + echo "This script will download packages from aur to the current dir" + echo "and check their license for nonfree issues." +} + +while getopts 'h' arg; do + case $arg in + h) usage; exit 0 ;; + *) usage; exit 1 ;; + esac +done + missing_deps=() for _pkg in ${@}; do msg "Downloading $_pkg..." diff --git a/createworkdir b/createworkdir index 8680215..a28d198 100755 --- a/createworkdir +++ b/createworkdir @@ -47,8 +47,7 @@ custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf } -# Create the staging and repo dirs -_repodir=${WORKDIR}/repos +# Create the staging dirs for _repo in ${REPOS[@]}; do [[ ! -d ${WORKDIR}/staging/${_repo} ]] && { stdnull "mkdir -p ${WORKDIR}/staging/${_repo}" || { @@ -56,15 +55,6 @@ for _repo in ${REPOS[@]}; do exit 1 } } - - for _arch in ${ARCHES[@]}; do - [[ ! -d ${_repodir}/${_repo}/${_arch} ]] && { - stdnull "mkdir -p ${_repodir}/${_repo}/${_arch}" || { - error "Can't create ${_repodir}/${_repo}/${_arch}" - exit 1 - } - } - done done msg "Finished, your packaging dir tree looks like this now:" diff --git a/librechroot b/librechroot index ec437de..b308b7d 100755 --- a/librechroot +++ b/librechroot @@ -23,6 +23,19 @@ source /etc/libretools.conf +function usage { + echo "Usage: $0 chrootname" + echo "Change to a chroot in $CHROOTDIR. Use it as root." + echo + echo "Default chroot name: $CHCOPY" +} + +while getopts 'h' arg; do + case $arg in + h) usage; exit 0 ;; + esac +done + [[ "$UID" != "0" ]] && { error "This script must be run as root." exit 1 @@ -32,28 +45,28 @@ custom_config=${XDG_CONFIG_HOME}/libretools/libretools.conf [[ -e ${custom_config} ]] && source ${custom_config} # Enter the chroot copy by default -root=${1:-$CHCOPY} +chrootname=${1:-$CHCOPY} CACHEDIR=${CACHEDIR:-/var/cache/pacman/pkg} -[[ ! -d ${CHROOTDIR}/${root} ]] && { - error "${CHROOTDIR}/$root is not a dir." +[[ ! -d ${CHROOTDIR}/${chrootname} ]] && { + error "${CHROOTDIR}/${chrootname} is not a dir." exit 1 } -mount -t proc proc ${CHROOTDIR}/${root}/proc/ -mount -t sysfs sys ${CHROOTDIR}/${root}/sys/ -mount -o bind /dev ${CHROOTDIR}/${root}/dev/ +mount -t proc proc ${CHROOTDIR}/${chrootname}/proc/ +mount -t sysfs sys ${CHROOTDIR}/${chrootname}/sys/ +mount -o bind /dev ${CHROOTDIR}/${chrootname}/dev/ # Share pacman cache -mount -o bind ${CACHEDIR} ${CHROOTDIR}/${root}/var/cache/pacman/pkg +mount -o bind ${CACHEDIR} ${CHROOTDIR}/${chrootname}/var/cache/pacman/pkg -cp -L /etc/resolv.conf ${CHROOTDIR}/${root}/etc/resolv.conf +cp -L /etc/resolv.conf ${CHROOTDIR}/${chrootname}/etc/resolv.conf -chroot ${CHROOTDIR}/${root} /bin/bash +chroot ${CHROOTDIR}/${chrootname} /bin/bash -umount ${CHROOTDIR}/${root}/proc/ -umount ${CHROOTDIR}/${root}/sys/ -umount ${CHROOTDIR}/${root}/dev/ -umount ${CHROOTDIR}/${root}/var/cache/pacman/pkg +umount ${CHROOTDIR}/${chrootname}/proc/ +umount ${CHROOTDIR}/${chrootname}/sys/ +umount ${CHROOTDIR}/${chrootname}/dev/ +umount ${CHROOTDIR}/${chrootname}/var/cache/pacman/pkg exit 0 diff --git a/libremakepkg b/libremakepkg index f2b523d..272e61d 100755 --- a/libremakepkg +++ b/libremakepkg @@ -21,47 +21,50 @@ source /etc/libretools.conf -if [ $UID -ne 0 ]; then - error "This script must be run as root" - exit 1 -fi - -usage() { +function usage { 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 CHCOPY and cachedir" - echo " -u : updates before building" - echo " -n chrootname : use this dir instead of CHCOPY" + echo " -h : show this message." + echo " -c : cleans CHCOPY and cachedir." + echo " -u : updates before building." + echo " -n : use this dir instead of CHCOPY." + echo " -I pkgname : install this package, use it as many times needed." + echo } -CLEAN="" +_CLEAN="" CLEAN_CACHE="" update_first="n" chrootname=${CHCOPY} - -while getopts 'hcun:' arg; do +_PKGINSTALL="" +while getopts 'hcun:I:' arg; do case "${arg}" in h) usage; exit 0 ;; - c) CLEAN="-c" ;; + c) _CLEAN="-c" ;; u) update_first="y" ;; n) chrootname="$OPTARG"; echo $chrootname ;; - *) MAKEPKG_ARGS="$MAKEPKG_ARGS -$arg $OPTARG" ;; + I) _PKGINSTALL+="-I $OPTARG " ;; + *) _MAKEPKG_ARGS="$MAKEPKG_ARGS -$arg $OPTARG" ;; esac done +if [ $UID -ne 0 ]; then + error "This script must be run as root" + exit 1 +fi + msg "Checking PKGBUILD for non-free issues" pkgbuild-check-nonfree ||{ if [[ $? -eq 15 ]]; then error "PKGBUILD contains non-free issues" exit 15 - exit $? fi - } + if [ $update_first = y ]; then msg "Updating the main chroot" # -c option in mkarchroot indicates cache @@ -70,6 +73,7 @@ fi msg "Creating the package" -makechrootpkg $CLEAN -r ${CHROOTDIR} -l "${chrootname}" -- $MAKEPKG_ARGS +makechrootpkg $_CLEAN -r ${CHROOTDIR} -l "${chrootname}" $_PKGINSTALL \ + -- $_MAKEPKG_ARGS exit 0 diff --git a/librerelease b/librerelease index 39d3e2d..2359de8 100755 --- a/librerelease +++ b/librerelease @@ -24,29 +24,59 @@ source /etc/libretools.conf custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf -usage () { - printf "$(gettext "Usage: %s")" "$0" +function usage { + echo "$(gettext "Usage: $0")" echo - printf "$(gettext "This script")" + echo "$(gettext "This script uploads packages on $WORKDIR/stagging")" + echo "$(gettext "to parabola server.")" + echo + echo "$(gettext "OPTIONS:")" + echo "$(gettext " -h this message.")" + echo "$(gettext " -l only list packages but not upload them.")" + echo "$(gettext " -c clean $WORKDIR/staging.")" +} + +function list_packages { + find $WORKDIR/staging/ -type f -print0 +} + +function clean_non_packages { + find $WORKDIR/staging/ -type -f \! -iname "*.pkg.tar.*" -delete } +function clean_packages { + find ${WORKDIR}/staging/ -iname "*.pkg.tar.*" -delete +} + +while getopts 'hl' arg; do + case $arg in + h) usage; exit 0 ;; + l) list_packages; exit 0 ;; + c) clean_packages; exit $? ;; + esac +done + [[ -e $custom_config ]] && source $custom_config [[ ! -z ${HOOKPRERELEASE} ]] && bash -c "${HOOKPRERELEASE}" +clean_non_packages msg "Uploading packages..." rsync --recursive \ - --copy-links \ - --hard-links \ - --partial \ - --prune-empty-dirs \ - --human-readable \ - --progress \ - -e "ssh " \ - ${WORKDIR}/staging \ - ${PARABOLAHOST}:${LIBREDESTDIR}/ || exit 1 + --copy-links \ + --hard-links \ + --partial \ + --prune-empty-dirs \ + --human-readable \ + --progress \ + -e "ssh " \ + ${WORKDIR}/staging \ + ${PARABOLAHOST}:${LIBREDESTDIR}/ || { + error "Sync failed, try again" + exit 1 +} msg "Removing packages from local [staging]" -find ${WORKDIR}/staging/ -iname "*.pkg.tar.*" -delete +clean_packages exit 0 diff --git a/librerepkg b/librerepkg index 0a38e00..79a3e1d 100755 --- a/librerepkg +++ b/librerepkg @@ -36,9 +36,17 @@ source rePKGBUILD usage() { echo "cd to a dir with a rePKGBUILD and other file info and run" - echo $0 + echo "$0 " + echo + echo "This script will repackage an arch package without compiling" } +while getopts 'h' arg; do + case $arg in + h) usage; exit 0 ;; + esac +done + stdnull "tempdir=$(mktemp -d /tmp/$(basename $PWD).XXXXX)" msg "Repackaging: $pkgname $pkgver-$pkgrel ($(date -u))" -- cgit v1.2.3-2-g168b From 1b59d6008a5a47969f3395ac7d68e1c0c22dcf43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Mon, 16 May 2011 10:22:09 -0500 Subject: librestage to use arch from pkgbuild librerelease to print nice format --- librerelease | 2 +- librestage | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/librerelease b/librerelease index 2359de8..1e323c3 100755 --- a/librerelease +++ b/librerelease @@ -37,7 +37,7 @@ function usage { } function list_packages { - find $WORKDIR/staging/ -type f -print0 + find $WORKDIR/staging/ -type f -printf "%f\n" } function clean_non_packages { diff --git a/librestage b/librestage index fa72098..498801b 100755 --- a/librestage +++ b/librestage @@ -44,6 +44,12 @@ EOU repos=$@ +while getopts 'h' arg; do + case $arg in + h) usage; exit 0 ;; + esac +done + if [ ${#repos} -eq 0 ]; then usage exit 1; @@ -55,10 +61,10 @@ fi } # Source the needed files -source ./PKGBUILD -[[ -e ./rePKGBUILD ]] && source ./rePKGBUILD source /etc/makepkg.conf [[ -e ~/.makepkg.conf ]] && source ~/.makepkg.conf +source ./PKGBUILD +[[ -e ./rePKGBUILD ]] && source ./rePKGBUILD # Default package location PKGDEST=${PKGDEST:-.} @@ -67,7 +73,7 @@ SRCPKGDEST=${SRCPKGDEST:-.} PKGEXT=".pkg.tar.?z" # Copies the packages to the specified repos inside staging -for _arch in ${ARCHES[@]}; do +for _arch in ${arch[@]}; do for pkg in ${pkgname[@]}; do pkgpath=$(find ${PKGDEST}/ -type f -name "${pkg}-${pkgver}-${pkgrel}-${_arch}${PKGEXT}") -- cgit v1.2.3-2-g168b From 3b059a61e44fe0670b210b2f85ab1185c3102138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Mon, 16 May 2011 10:40:45 -0500 Subject: libremakepkg to accept makepkg options --- libremakepkg | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libremakepkg b/libremakepkg index 272e61d..54a5578 100755 --- a/libremakepkg +++ b/libremakepkg @@ -41,7 +41,12 @@ CLEAN_CACHE="" update_first="n" chrootname=${CHCOPY} _PKGINSTALL="" -while getopts 'hcun:I:' arg; do +#libremakepkg own args +libremakepkgargs='hcun:I:' +#now makepkg args +libremakepkgargs+='ACdefiLmoprRs' + +while getopts ${libremakepkgargs} arg ; do case "${arg}" in h) usage; exit 0 ;; c) _CLEAN="-c" ;; @@ -73,7 +78,6 @@ fi msg "Creating the package" -makechrootpkg $_CLEAN -r ${CHROOTDIR} -l "${chrootname}" $_PKGINSTALL \ - -- $_MAKEPKG_ARGS +makechrootpkg $_CLEAN -r ${CHROOTDIR} -l "${chrootname}" $_PKGINSTALL -- $_MAKEPKG_ARGS exit 0 -- cgit v1.2.3-2-g168b From 254af17f2eb70468d4b1b5d385a2e8154b45ea87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Mon, 16 May 2011 10:47:29 -0500 Subject: librerelease use c option for cleaning packages --- librerelease | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/librerelease b/librerelease index 1e323c3..1505098 100755 --- a/librerelease +++ b/librerelease @@ -33,7 +33,7 @@ function usage { echo "$(gettext "OPTIONS:")" echo "$(gettext " -h this message.")" echo "$(gettext " -l only list packages but not upload them.")" - echo "$(gettext " -c clean $WORKDIR/staging.")" + echo "$(gettext " -c clean packages on $WORKDIR/staging.")" } function list_packages { @@ -48,7 +48,7 @@ function clean_packages { find ${WORKDIR}/staging/ -iname "*.pkg.tar.*" -delete } -while getopts 'hl' arg; do +while getopts 'hlc' arg; do case $arg in h) usage; exit 0 ;; l) list_packages; exit 0 ;; -- cgit v1.2.3-2-g168b From 76c75b8971e4ad2f6c336c9413088e6fd0e70f69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Mon, 16 May 2011 10:51:42 -0500 Subject: librestage uses an error message when no package is staged --- librestage | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/librestage b/librestage index 498801b..e51975b 100755 --- a/librestage +++ b/librestage @@ -72,6 +72,7 @@ SRCPKGDEST=${SRCPKGDEST:-.} PKGEXT=".pkg.tar.?z" +staged='n' # Copies the packages to the specified repos inside staging for _arch in ${arch[@]}; do for pkg in ${pkgname[@]}; do @@ -95,6 +96,7 @@ for _arch in ${arch[@]}; do exit 1 } && { msg2 "${pkg} staged on [${_repo}]" + staged='y' } } || { ln "${canonical}" "${WORKDIR}/staging/${_repo}/${pkgfile}" || { @@ -102,6 +104,7 @@ for _arch in ${arch[@]}; do exit 1 } && { msg2 "${pkg} staged on [${_repo}]" + staged='y' } } done @@ -109,4 +112,9 @@ for _arch in ${arch[@]}; do done done +if [ $staged = 'n' ]; then + error "No package was staged" + exit 1 +fi + exit 0 -- cgit v1.2.3-2-g168b From f01335a45638dd713dd4c91d85f881eb21d3d354 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Mon, 16 May 2011 19:12:23 -0300 Subject: Fixed diff-unfree to correctly use community PKGBUILDs. Be aware the order of parameters changed: $repo goes first now. --- diff-unfree | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/diff-unfree b/diff-unfree index 2cc3ac7..86a537f 100755 --- a/diff-unfree +++ b/diff-unfree @@ -27,7 +27,7 @@ custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf msg "Diff-Unfree helps you diff build scripts from ABSLibre against (Unfree) ABS. Package name and repo will we guessed if you don't specify them." - msg2 "Usage: $0 [unfree-package] [repo]" + msg2 "Usage: $0 [repo] [unfree-package]" exit 0 } @@ -38,11 +38,10 @@ custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf package_guess=$(basename $PWD) -package=${1:-${package_guess/-libre}} -repo=${2:-$(basename $(dirname $PWD))} +repo=${1:-$(basename $(dirname $PWD))} +package=${2:-${package_guess/-libre}} tmp_dir=$(mktemp -d /tmp/${package}.XXXXXX) -unfree_dir="${tmp_dir}/packages/${package}/trunk" svnrepo="packages" case $repo in @@ -56,6 +55,8 @@ case $repo in ;; esac +unfree_dir="${tmp_dir}/${svnrepo}/${package}/trunk" + [[ ! -d "${tmp_dir}" ]] && { error "Can't create temp dir" exit 1 @@ -67,7 +68,7 @@ msg "Getting diff from $repo/$package..." stdnull 'svn checkout --depth=empty svn://svn.archlinux.org/$svnrepo' -cd packages +cd ${svnrepo} svn update ${package} # Back to start dir -- cgit v1.2.3-2-g168b From 56e183631d6e4e12df4990d119456dd81423938e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Mon, 16 May 2011 19:12:49 -0300 Subject: Fixed pkgbuild-check-nonfree on libremakepkg --- libremakepkg | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libremakepkg b/libremakepkg index 8cce89d..af0b7a9 100755 --- a/libremakepkg +++ b/libremakepkg @@ -26,10 +26,10 @@ if [ $UID -ne 0 ]; then fi msg "Checking PKGBUILD for non-free issues" -pkgbuild-check-nonfree ||{ - if [[$?=15]]; then - error "PKGBUILD contains non-free issues" - exit 15 +pkgbuild-check-nonfree || { + if [[ $? = 15 ]]; then + error "PKGBUILD contains non-free issues" + exit 15 else error "Check failed, continuing" fi -- cgit v1.2.3-2-g168b From 451039258fa50b27488455329ac5fd93d3885847 Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernandez Date: Wed, 18 May 2011 01:01:25 -0500 Subject: librerelease clean_non_packages fixed --- librerelease | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/librerelease b/librerelease index 1505098..c34abaf 100755 --- a/librerelease +++ b/librerelease @@ -41,7 +41,7 @@ function list_packages { } function clean_non_packages { - find $WORKDIR/staging/ -type -f \! -iname "*.pkg.tar.*" -delete + find $WORKDIR/staging/ -type f \! -iname "*.pkg.tar.*" -delete } function clean_packages { -- cgit v1.2.3-2-g168b From 64a0772ca0f9d542ab8a94bd16a1edc78f5b40db Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernandez Date: Wed, 18 May 2011 11:22:59 -0500 Subject: libremakepkg pass -p $OPTARG to makepkg --- libremakepkg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libremakepkg b/libremakepkg index 54a5578..8af1581 100755 --- a/libremakepkg +++ b/libremakepkg @@ -29,8 +29,8 @@ function usage { echo "OPTIONS:" echo echo " -h : show this message." - echo " -c : cleans CHCOPY and cachedir." - echo " -u : updates before building." + echo " -c : cleans CHCOPY before building." + echo " -u : updates CHROOT before building." echo " -n : use this dir instead of CHCOPY." echo " -I pkgname : install this package, use it as many times needed." echo @@ -44,7 +44,7 @@ _PKGINSTALL="" #libremakepkg own args libremakepkgargs='hcun:I:' #now makepkg args -libremakepkgargs+='ACdefiLmoprRs' +libremakepkgargs+='ACdefiLmop:rRs' while getopts ${libremakepkgargs} arg ; do case "${arg}" in -- cgit v1.2.3-2-g168b From 2e4d78c7768119a75bba8ae5eab98c1a6026ea89 Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernandez Date: Thu, 19 May 2011 02:02:22 -0500 Subject: * fullpkg uses options and librerelease * librerelease tell wich repo for each pkg when listing --- fullpkg | 124 ++++++++++++++++++++++++++++++++++++----------------------- librerelease | 11 ++++-- mipsrelease | 2 +- 3 files changed, 84 insertions(+), 53 deletions(-) diff --git a/fullpkg b/fullpkg index f74c0b5..41bc5c5 100755 --- a/fullpkg +++ b/fullpkg @@ -4,23 +4,57 @@ # * Detect circular builds # * Detect pkgnames by provides, replaces, etc. instead of dir tree +source /etc/makepkg.conf +source /etc/abs.conf +source /etc/libretools.conf + +[[ -r ~/.config/libretools/libretools.conf ]] && \ + source ~/.config/libretools/libretools.conf + +function 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 "OPTIONS:" + echo " -h : this message." + echo " -f : build even when a package has been built." + echo " -n : set ABSROOT to this dir" + echo " -r reponame : set repo name to reponame" + echo +} + +force_build='n' + +while getopts 'hfn:r' arg; do + case $arg in + h) usage; exit 0 ;; + f) force_build='y' ;; + n) ABSROOT="$OPTARG" ;; + r) repo="$OPTARG" ;; + esac +done + [[ ! -r PKGBUILD ]] && { - echo "This isn't a build directory" + error "This isn't a build directory" + echo + usage exit 1 } tmp_dir=$(mktemp -d /tmp/$(basename $PWD).XXXXXX) queue_file=$(mktemp /tmp/queue.XXXXXX) ban_file=$(mktemp) -[[ ! -w $queue_file ]] && exit 1 -[[ ! -w $ban_file ]] && exit 1 - -source /etc/makepkg.conf -source /etc/abs.conf -source /etc/libretools.conf +if [[ ! -w $queue_file ]]; then + error "can't write queue file" + exit 1 +elif [[ ! -w $ban_file ]] ; then + error "can't write ban file" + exit 1 +fi -[[ -r ~/.config/libretools/libretools.conf ]] && \ - source ~/.config/libretools/libretools.conf +## START FUNCTIONS ## # Queue Management # * Always get the queue list from the server @@ -30,10 +64,6 @@ source /etc/libretools.conf # TODO # * Check for concurrence -guess_repo() { - basename $(dirname $(pwd)) -} - # Get the queue list from the server get_queue() { rsync -e ssh -aq $PARABOLAHOST:mips64el/queue $queue_file >/dev/null 2>&1 || { @@ -66,7 +96,7 @@ remove_queue() { grep -vw "^$(basename $PWD)" $queue_file > $queue_file.2 cat $queue_file.2 > $queue_file - put_queue || return $? + put_queue && rm $queue_file{,.2} && return 0 || return $? } # Checks if a package is listed @@ -83,32 +113,45 @@ check_queue() { return 0 } +# END Queue Management # + # Checks if the package is banned from building is_banned() { rsync -e ssh -aq $PARABOLAHOST:mips64el/ban $ban_file >/dev/null 2>&1 || { - plain ":: Failed to get ban list" + plain "Failed to get ban list" return 0 } grep -w $1 $ban_file >/dev/null 2>&1 + local rt=$? + rm $ban_file + return $rt +} - return $? +guess_repo() { + basename $(dirname $(pwd)) } # TODO keep track of spawned fullpkgs quit() { remove_queue - exit 1 } -repo=${1:-$(guess_repo)} +## END FUNCTIONS ## + +repo=${repo:-$(guess_repo)} source PKGBUILD msg "Building ${repo:-missing repo}/${pkgbase:-${pkgname[@]}}: $pkgdesc" -is_built "${pkgbase:-${pkgname[0]}}>=${pkgver}-${pkgrel}" && \ - msg2 "This package is built." && exit 0 +if is_built "${pkgbase:-${pkgname[0]}}>=${pkgver}-${pkgrel}"; then + msg2 "This package is built." + if [ $force_build == 'n' ]; then + exit 0 + fi + plain "Building anyway ..." +fi trap "quit" TERM KILL INT @@ -144,10 +187,8 @@ for _dep in ${deps[@]}; do source "$ABSROOT/${_repo}/$_dep/PKGBUILD" msg2 "Checking for $_dep>=$pkgver-$pkgrel" -# If this version is built, continue with the next dep - if is_built "$_dep>=$pkgver-$pkgrel"; then - plain "No need to build this one" + plain "this package is built" break fi @@ -158,22 +199,13 @@ for _dep in ${deps[@]}; do # Enter the work dir and run this command in it pushd $tmp_dir/$_dep >/dev/null - $0 $_repo + $0 -r $_repo [[ $? -ne 0 ]] && { failed=(${failed[@]} $_dep) } popd >/dev/null - - break -# } || { -# The package can't be found -# This can happen if: -# * The package is built inside a split package -# * The package is provided by some other package (ie by *-libre packages) -# echo "==> Missing package $_dep" -# missing=(${missing[@]} $_dep) } done done @@ -194,25 +226,19 @@ pushd $tmp_dir/$(basename $PWD) >/dev/null msg "Syncing database" sudo pacman -Syu --noconfirm -makepkg --noconfirm -sLcr ; r=$? +makepkg --noconfirm --nocheck -sLcr ; r=$? case $r in - 0) - msg "The build was succesful." - mipsrelease *.pkg.tar.* - - librestage $repo - - sudo pacman -Sy - ;; - 1) - error "There were errors while trying to build the package." - ;; - 2) - error "The build failed." - ;; + 0) msg "The build was succesful." + #TODO: mipsrelease should upload to a local db + mipsrelease *.pkg.tar.* + librestage $repo + librerelease + sudo pacman -Sy ;; + 1) error "There were errors while trying to build the package." ;; + 2) error "The build failed." ;; esac -# Remove from queue remove_queue exit $r + diff --git a/librerelease b/librerelease index c34abaf..4e7c491 100755 --- a/librerelease +++ b/librerelease @@ -37,15 +37,20 @@ function usage { } function list_packages { - find $WORKDIR/staging/ -type f -printf "%f\n" + repos=($(find "$WORKDIR/staging/" -mindepth 1 -type d \! -empty -printf '%f ' 2>/dev/null)) + for _repo in ${repos[@]}; do + msg2 "$_repo" + find ${WORKDIR}/staging/${_repo} -type f -printf "%f\n" + done + unset repos } function clean_non_packages { - find $WORKDIR/staging/ -type f \! -iname "*.pkg.tar.*" -delete + find $WORKDIR/staging/ -type f \! -iname "*.pkg.tar.?z" -delete } function clean_packages { - find ${WORKDIR}/staging/ -iname "*.pkg.tar.*" -delete + find ${WORKDIR}/staging/ -iname "*.pkg.tar.?z" -delete } while getopts 'hlc' arg; do diff --git a/mipsrelease b/mipsrelease index 97e12d2..925748f 100755 --- a/mipsrelease +++ b/mipsrelease @@ -4,7 +4,7 @@ source /etc/makepkg.conf pushd ${PKGDEST} >/dev/null - +#TODO: repo-add should stage to a local db and not stage3 repo-add stage3.db.tar.gz $@ popd >/dev/null -- cgit v1.2.3-2-g168b From af81fffea91ae472a9b0bbee7ed88317fbff468a Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernandez Date: Thu, 19 May 2011 02:29:20 -0500 Subject: Fullpkg cleanup and exec quit on exit --- fullpkg | 61 ++++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/fullpkg b/fullpkg index 41bc5c5..692ddb0 100755 --- a/fullpkg +++ b/fullpkg @@ -26,6 +26,8 @@ function usage { } force_build='n' +failed=() +missing=() while getopts 'hfn:r' arg; do case $arg in @@ -45,14 +47,8 @@ done tmp_dir=$(mktemp -d /tmp/$(basename $PWD).XXXXXX) queue_file=$(mktemp /tmp/queue.XXXXXX) -ban_file=$(mktemp) -if [[ ! -w $queue_file ]]; then - error "can't write queue file" - exit 1 -elif [[ ! -w $ban_file ]] ; then - error "can't write ban file" - exit 1 -fi +ban_file=$(mktemp /tmp/ban.XXXXXX) +repo=${repo:-$(guess_repo)} ## START FUNCTIONS ## @@ -124,7 +120,6 @@ is_banned() { grep -w $1 $ban_file >/dev/null 2>&1 local rt=$? - rm $ban_file return $rt } @@ -138,32 +133,44 @@ quit() { exit 1 } -## END FUNCTIONS ## +function cleanup { + rm $ban_file $queue_file + rm -rf $tmp_dir +} -repo=${repo:-$(guess_repo)} +## END FUNCTIONS ## source PKGBUILD msg "Building ${repo:-missing repo}/${pkgbase:-${pkgname[@]}}: $pkgdesc" -if is_built "${pkgbase:-${pkgname[0]}}>=${pkgver}-${pkgrel}"; then - msg2 "This package is built." - if [ $force_build == 'n' ]; then +# Pre build tests +if [ $force_build == 'n' ]; then + + # Be able to write files + if [[ ! -w $queue_file ]]; then + error "can't write queue file" + exit 1 + elif [[ ! -w $ban_file ]] ; then + error "can't write ban file" + exit 1 + fi + + if is_built "${pkgbase:-${pkgname[0]}}>=${pkgver}-${pkgrel}"; then + msg2 "This package is built." exit 0 fi - plain "Building anyway ..." -fi -trap "quit" TERM KILL INT + if is_banned ${pkgbase:-$pkgname}; then + error "This package is banned from building. Check the ban list" + exit 1 + fi + + check_queue || exit 1 -if is_banned ${pkgbase:-$pkgname}; then - error "This package is banned from building. Check the ban list" - exit 1 fi -check_queue || exit 1 - -failed=() -missing=() +# This will be executed at exit for any reason. +trap "quit" EXIT INT QUIT TERM KILL HUP if ! grep mips64el PKGBUILD >/dev/null; then msg "Adding mips64el arch" @@ -233,12 +240,12 @@ case $r in mipsrelease *.pkg.tar.* librestage $repo librerelease - sudo pacman -Sy ;; + sudo pacman -Sy + # cleanup is only on succesfull build so failed can be inspected + cleanup;; 1) error "There were errors while trying to build the package." ;; 2) error "The build failed." ;; esac -remove_queue - exit $r -- cgit v1.2.3-2-g168b From 69b193a18370aa18c1f59715f7909821f2bf2310 Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernandez Date: Thu, 19 May 2011 02:38:37 -0500 Subject: * guess_repo executed after it is declared --- fullpkg | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fullpkg b/fullpkg index 692ddb0..8bc29d9 100755 --- a/fullpkg +++ b/fullpkg @@ -48,7 +48,6 @@ done tmp_dir=$(mktemp -d /tmp/$(basename $PWD).XXXXXX) queue_file=$(mktemp /tmp/queue.XXXXXX) ban_file=$(mktemp /tmp/ban.XXXXXX) -repo=${repo:-$(guess_repo)} ## START FUNCTIONS ## @@ -142,6 +141,7 @@ function cleanup { source PKGBUILD msg "Building ${repo:-missing repo}/${pkgbase:-${pkgname[@]}}: $pkgdesc" +repo=${repo:-$(guess_repo)} # Pre build tests if [ $force_build == 'n' ]; then @@ -184,7 +184,6 @@ deps=$(echo "${depends[@]} ${makedepends[@]} ${pkgdeps[@]}" | \ sort -u) msg "Checking dependencies" - for _dep in ${deps[@]}; do is_banned $_dep && continue -- cgit v1.2.3-2-g168b From ec04d0e7dbfad8840869b64167b824c197806ddd Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernandez Date: Thu, 19 May 2011 02:41:39 -0500 Subject: * is_banned always returns false --- fullpkg | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fullpkg b/fullpkg index 8bc29d9..95d0080 100755 --- a/fullpkg +++ b/fullpkg @@ -116,10 +116,8 @@ is_banned() { plain "Failed to get ban list" return 0 } - grep -w $1 $ban_file >/dev/null 2>&1 - local rt=$? - return $rt + return $? } guess_repo() { -- cgit v1.2.3-2-g168b From fc33a9740b0142e24049afc6d485db1d689bba9a Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernandez Date: Thu, 19 May 2011 02:54:00 -0500 Subject: * fullpkg printing repo all the times is confusing --- fullpkg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fullpkg b/fullpkg index 95d0080..35916d3 100755 --- a/fullpkg +++ b/fullpkg @@ -138,8 +138,8 @@ function cleanup { ## END FUNCTIONS ## source PKGBUILD -msg "Building ${repo:-missing repo}/${pkgbase:-${pkgname[@]}}: $pkgdesc" repo=${repo:-$(guess_repo)} +msg "Building ${repo:-missing repo}/${pkgbase:-${pkgname[@]}}: $pkgdesc" # Pre build tests if [ $force_build == 'n' ]; then -- cgit v1.2.3-2-g168b From a5a2d6019d8cdcc6f5c6173c5785292639e38caa Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernandez Date: Thu, 19 May 2011 10:07:36 -0500 Subject: librestage search in ARCHES from libretools.conf --- librestage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/librestage b/librestage index e51975b..6ecb19c 100755 --- a/librestage +++ b/librestage @@ -74,7 +74,7 @@ PKGEXT=".pkg.tar.?z" staged='n' # Copies the packages to the specified repos inside staging -for _arch in ${arch[@]}; do +for _arch in ${ARCHES[@]}; do for pkg in ${pkgname[@]}; do pkgpath=$(find ${PKGDEST}/ -type f -name "${pkg}-${pkgver}-${pkgrel}-${_arch}${PKGEXT}") -- cgit v1.2.3-2-g168b From 5636a97ca66e432cc59a0dcaf2b05398150b4e1f Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernandez Date: Thu, 19 May 2011 11:26:54 -0500 Subject: is_banned should be false if no ban list is downloaded --- fullpkg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fullpkg b/fullpkg index 35916d3..0088045 100755 --- a/fullpkg +++ b/fullpkg @@ -114,7 +114,7 @@ check_queue() { is_banned() { rsync -e ssh -aq $PARABOLAHOST:mips64el/ban $ban_file >/dev/null 2>&1 || { plain "Failed to get ban list" - return 0 + return 1 } grep -w $1 $ban_file >/dev/null 2>&1 return $? -- cgit v1.2.3-2-g168b From d53c7ad69c8f52513ee6c2f82b07af9b486c6d85 Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernandez Date: Thu, 19 May 2011 13:25:47 -0500 Subject: * fullpkg can be asked to rebuild some package if it's a dep --- fullpkg | 51 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/fullpkg b/fullpkg index 0088045..911a11c 100755 --- a/fullpkg +++ b/fullpkg @@ -18,21 +18,25 @@ function usage { printf "and stage the packages on it's repo." echo echo "OPTIONS:" - echo " -h : this message." - echo " -f : build even when a package has been built." - echo " -n : set ABSROOT to this dir" + echo " -h : this message." + echo " -f : build even when a package has been built." + echo " -n absdir : set ABSROOT to this dir" echo " -r reponame : set repo name to reponame" + echo " -R pkgname : build pkgname if it is a dep" echo } force_build='n' +force_array=() +_fullpkgargs="" failed=() missing=() -while getopts 'hfn:r' arg; do +while getopts 'hfn:r:R:' arg; do case $arg in h) usage; exit 0 ;; f) force_build='y' ;; + R) force_array=(${force_array[@]} $OPTARG); _fullpkgargs+="-R $OPTARG ";; n) ABSROOT="$OPTARG" ;; r) repo="$OPTARG" ;; esac @@ -124,8 +128,20 @@ guess_repo() { basename $(dirname $(pwd)) } -# TODO keep track of spawned fullpkgs -quit() { +# usage : in_array( $needle, $haystack ) +# return : 0 - found +# 1 - not found +function in_array { + [[ $2 ]] || return 1 + local needle=$1; shift + local item + for item in "$@"; do + [[ ${item#@} = $needle ]] && return 0 + done + return 1 # Not Found +} + +function quit { remove_queue exit 1 } @@ -135,6 +151,8 @@ function cleanup { rm -rf $tmp_dir } +# TODO keep track of spawned fullpkgs + ## END FUNCTIONS ## source PKGBUILD @@ -190,12 +208,16 @@ for _dep in ${deps[@]}; do [[ -e "$ABSROOT/${_repo}/$_dep/PKGBUILD" ]] && { source "$ABSROOT/${_repo}/$_dep/PKGBUILD" msg2 "Checking for $_dep>=$pkgver-$pkgrel" - - if is_built "$_dep>=$pkgver-$pkgrel"; then - plain "this package is built" - break - fi - + + if ! in_array $_dep ${force_array[@]}; then + if is_built "$_dep>=$pkgver-$pkgrel"; then + plain "this package is built" + break + fi + else + _fullpkgargs+="-f " + fi + cp -r "$ABSROOT/$_repo/$_dep" $tmp_dir/ || { error "Can't copy $_dep to the work dir." exit 1 @@ -203,7 +225,8 @@ for _dep in ${deps[@]}; do # Enter the work dir and run this command in it pushd $tmp_dir/$_dep >/dev/null - $0 -r $_repo + + $0 -r $_repo $_fullpkgargs [[ $? -ne 0 ]] && { failed=(${failed[@]} $_dep) @@ -215,6 +238,8 @@ for _dep in ${deps[@]}; do done # TODO probably not elegant enough +# TODO only the last fullpkg should show this message +# and it should contain all failed pkgs [[ ${#failed[@]} -gt 0 ]] && { error "This packages failed to build: ${failed[@]}" exit 1 -- cgit v1.2.3-2-g168b From 1332457128ce015dc46561e531740c725c23299e Mon Sep 17 00:00:00 2001 From: Joshua Ismael Haase Hernandez Date: Thu, 19 May 2011 14:37:31 -0500 Subject: * fullpkg clean $_fullpkgargs and $force_array when use them --- fullpkg | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fullpkg b/fullpkg index 911a11c..d5c7468 100755 --- a/fullpkg +++ b/fullpkg @@ -216,6 +216,8 @@ for _dep in ${deps[@]}; do fi else _fullpkgargs+="-f " + _fullpkgargs="$(echo $_fullpkgargs | sed s/"-R $_dep "//)" + force_array=( $(echo ${forcearray[@]} | tr " " "\n" | grep -vw "^$_dep") ) fi cp -r "$ABSROOT/$_repo/$_dep" $tmp_dir/ || { -- cgit v1.2.3-2-g168b From 162fb6af8d91a83b4e270a1c7e0b94f0cf821d87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Sun, 22 May 2011 11:04:04 -0300 Subject: LibreRePkg just uses makepkg --- librerepkg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/librerepkg b/librerepkg index 79a3e1d..ba8dea1 100755 --- a/librerepkg +++ b/librerepkg @@ -55,6 +55,6 @@ stdnull "pushd ${tempdir}" mv rePKGBUILD PKGBUILD msg2 "Updating md5sums" makepkg -g >> PKGBUILD -msg "Repackaging using libremakepkg" -sudo libremakepkg -cu -L +msg "Repackaging using makepkg" +makepkg -Lc stdnull "popd ${tempdir}" -- cgit v1.2.3-2-g168b From 3c53f6e6e8a9dc767680c5a53969e3d9aa3c5d81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Sun, 22 May 2011 11:11:59 -0300 Subject: FullPKG already uses a local db called stage3 and it's URL is file://$PKGDEST --- fullpkg | 1 - mipsrelease | 1 - 2 files changed, 2 deletions(-) diff --git a/fullpkg b/fullpkg index d5c7468..d66067e 100755 --- a/fullpkg +++ b/fullpkg @@ -260,7 +260,6 @@ sudo pacman -Syu --noconfirm makepkg --noconfirm --nocheck -sLcr ; r=$? case $r in 0) msg "The build was succesful." - #TODO: mipsrelease should upload to a local db mipsrelease *.pkg.tar.* librestage $repo librerelease diff --git a/mipsrelease b/mipsrelease index 925748f..400e9f1 100755 --- a/mipsrelease +++ b/mipsrelease @@ -4,7 +4,6 @@ source /etc/makepkg.conf pushd ${PKGDEST} >/dev/null -#TODO: repo-add should stage to a local db and not stage3 repo-add stage3.db.tar.gz $@ popd >/dev/null -- cgit v1.2.3-2-g168b