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 c0bb90f5818ae2c5d40f125f3c5982b92358c68c Mon Sep 17 00:00:00 2001 From: Nicolas Reynolds Date: Sun, 1 May 2011 22:47:56 -0300 Subject: Fixed way of finding packages on librestage. Also it just searchs for ARCHES instead of PKGBUILD architectures. Added 'any' to libretools.conf --- librestage | 12 +++++++++--- libretools.conf | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/librestage b/librestage index 6d7b45e..fa72098 100755 --- a/librestage +++ b/librestage @@ -64,11 +64,17 @@ source /etc/makepkg.conf PKGDEST=${PKGDEST:-.} SRCPKGDEST=${SRCPKGDEST:-.} +PKGEXT=".pkg.tar.?z" + # Copies the packages to the specified repos inside staging -for _arch in ${arch[@]}; do +for _arch in ${ARCHES[@]}; do for pkg in ${pkgname[@]}; do - pkgfile="$pkg-$pkgver-$pkgrel-$_arch$PKGEXT" - pkgpath="$PKGDEST/$pkgfile" + + pkgpath=$(find ${PKGDEST}/ -type f -name "${pkg}-${pkgver}-${pkgrel}-${_arch}${PKGEXT}") + + [[ -z ${pkgpath} ]] && continue; + + pkgfile=$(basename ${pkgpath}) if [ -e "${pkgpath}" ]; then msg "Found ${pkgfile}" diff --git a/libretools.conf b/libretools.conf index 2485be3..0999040 100644 --- a/libretools.conf +++ b/libretools.conf @@ -13,7 +13,7 @@ WORKDIR=/home/$USER/packages REPOS=('libre' 'libre-testing' 'core' 'community' 'extra' 'social' 'sugar') # The architectures -ARCHES=('i686' 'x86_64' 'mips64el') +ARCHES=('i686' 'x86_64' 'mips64el' 'any') ## The directory where the chroots are stored CHROOTDIR=/home/chroot -- cgit v1.2.3-2-g168b From d12f9a0ac7ce2ff20ce59e3603ce0783c473ffb6 Mon Sep 17 00:00:00 2001 From: Nicolas Reynolds Date: Sun, 8 May 2011 21:57:10 -0300 Subject: Add mips64el to arch array if missing, check is_built with pkgrel --- fullpkg | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/fullpkg b/fullpkg index 696e97f..c292bdd 100755 --- a/fullpkg +++ b/fullpkg @@ -108,7 +108,7 @@ repo=${1:-$(guess_repo)} source PKGBUILD msg "Building ${repo:-missing repo}/${pkgbase:-${pkgname[@]}}: $pkgdesc" -is_built "${pkgbase:-${pkgname[0]}}>=${pkgver}" && exit 0 +is_built "${pkgbase:-${pkgname[0]}}>=${pkgver}-${pkgrel}" && exit 0 #sudo pacman -Sy @@ -124,6 +124,11 @@ check_queue || exit 1 failed=() missing=() +if ! grep mips64el PKGBUILD >/dev/null; then + msg "Adding mips64el arch" + sed -i "s/^\(arch=([^)anym]\+\))/\1 'mips64el')/" "PKGBUILD" +fi + # Gets the dependency list from the package_* functions #pkgdeps=($(cat PKGBUILD | \ # tr -d "\n" | \ @@ -152,11 +157,11 @@ for _dep in ${deps[@]}; do # TODO find split packages [[ -e "$ABSROOT/${_repo}/$_dep/PKGBUILD" ]] && { source "$ABSROOT/${_repo}/$_dep/PKGBUILD" - msg2 "Checking for $_dep>=$pkgver" + msg2 "Checking for $_dep>=$pkgver-$pkgrel" # If this version is built, continue with the next dep - if is_built "$_dep>=$pkgver"; then + if is_built "$_dep>=$pkgver-$pkgrel"; then msg2 "No need to build this one" break fi -- cgit v1.2.3-2-g168b From 0e929530a592dec84439a1c71ca57513517b8e94 Mon Sep 17 00:00:00 2001 From: Nicolas Reynolds Date: Sun, 8 May 2011 21:58:10 -0300 Subject: stdnull doesn't require quoting. first stab at aur client --- aur | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ mipsrelease | 22 ++++------------------ 2 files changed, 60 insertions(+), 18 deletions(-) create mode 100755 aur diff --git a/aur b/aur new file mode 100755 index 0000000..e300dd1 --- /dev/null +++ b/aur @@ -0,0 +1,56 @@ +#!/bin/bash + +source /etc/libretools.conf +source /etc/abs.conf + +missing_deps=() +for _pkg in ${@}; do + msg "Downloading $_pkg..." + wget -O - -q http://aur.archlinux.org/packages/$_pkg/$_pkg.tar.gz | \ + tar xzf - >/dev/null 2>&1 + + [[ $? -ne 0 ]] && { + error "Couldn't get $_pkg" + continue + } + + stdnull pushd $_pkg + + source PKGBUILD + + pkgbuild-check-nonfree || { + warning "This PKGBUILD links to known unfree packages" + } + + msg2 "Checking license..." + free=0 + for _license in ${license[@]}; do + if ! -d /usr/share/licenses/common/$_license; then + warning "License $_license is not a common license" + free=1 + fi + done + + if [ $free -eq 1 ]; then + plain "Please check that the license is included in the package and + *specially* that it respects your freedom." + fi + + for _dep in ${depends[@]} ${makedepends[@]}; do + if ! is_built $_dep; then + if ! find ${ABSROOT} -maxdepth 2 -type d -name "$_dep" | egrep "*" >/dev/null ; then + missing_deps=(${missing_deps} $_dep) + fi + fi + done + + stdnull popd + +done + +[[ ${#missing_deps[*]} -gt 0 ]] && { + msg2 "Retrieving missing deps: ${missing_deps[@]}" + $0 ${missing_deps[@]} +} + +exit 0 diff --git a/mipsrelease b/mipsrelease index 07d27ec..97e12d2 100755 --- a/mipsrelease +++ b/mipsrelease @@ -2,25 +2,11 @@ # Temporary script for uploading mips64el packages to the server source /etc/makepkg.conf -source /etc/libretools.conf -msg "Uploading packages" -for pkg in $@; do - msg2 "$pkg" - scp $pkg ${PARABOLAHOST}:mips64el/stage3/ ||{ - error "Failed to upload ${pkg}" - plain "Try running this command again:" - echo - plain "$0 $@" - exit 1 - } -done +pushd ${PKGDEST} >/dev/null -msg "Updating db" -scp ${PARABOLAHOST}:mips64el/stage3/stage3.db.tar.gz ${SRCDEST}/ && \ -repo-add ${SRCDEST}/stage3.db.tar.gz $@ && \ -scp ${SRCDEST}/stage3.db.tar.gz ${PARABOLAHOST}:mips64el/stage3/ || { - error "Could not update db" -} +repo-add stage3.db.tar.gz $@ + +popd >/dev/null exit $? -- 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 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