From 7b9a203f5c44e907bcfb0faac0743932cc8aa40c Mon Sep 17 00:00:00 2001 From: Nicolas Reynolds Date: Thu, 7 Apr 2011 20:38:11 -0300 Subject: First stub of ABS querying script. Toru is the name of Pacman designer :P **Not meant for use yet!!** --- toru | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 toru diff --git a/toru b/toru new file mode 100755 index 0000000..9716744 --- /dev/null +++ b/toru @@ -0,0 +1,47 @@ +#!/bin/bash +# Queries the ABS +# License: GPL3 + +# TODO +# * Add license text +# * Use libremessages + +source /etc/abs.conf +source /etc/libretools.conf + +TMPDIR=$(mktemp -d) + +[[ -z ${TMPDIR} ]] && exit 1 + +update() { + pushd ${ABSROOT} >/dev/null + +# Find all the PKGBUILDs newer than the last update + find * -type f -name 'PKGBUILD' -newer ${ABSROOT}/toru >> ${TMPDIR}/update.list + + while read _pkgbuild; do + pushd $(dirname ${_pkgbuild}) >/dev/null + + unset pkgbase pkgname pkgver pkgrel + + source PKGBUILD + + for _pkg in ${pkgbase:-${pkgname[@]}}; do + dir="${TMPDIR}/packages/${_pkg}-${pkgver}-${pkgver}" + mkdir -p "${dir}" + + echo "${ABSROOT}/${_pkgbuild}" >> "${dir}/path" + + done + + popd >/dev/null + done < ${TMPDIR}/update.list + + popd >/dev/null + + last_update +} + +last_update() { + touch ${ABSROOT}/toru +} -- cgit v1.2.2 From 99dad96bcc60136d6b99f797405e7cbdd5991d09 Mon Sep 17 00:00:00 2001 From: Nicolas Reynolds Date: Wed, 13 Apr 2011 13:17:30 -0300 Subject: FullPkg fixes, ban list, etc. --- fullpkg | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/fullpkg b/fullpkg index 794b191..ac5b005 100755 --- a/fullpkg +++ b/fullpkg @@ -11,7 +11,9 @@ 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 @@ -77,6 +79,18 @@ check_queue() { return 0 } +# 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" + return 0 + } + + grep -w $1 $ban_file >/dev/null 2>&1 + + return $? +} + # TODO keep track of spawned fullpkgs quit() { @@ -86,10 +100,21 @@ quit() { } source PKGBUILD -msg "Building ${pkgbase} ${pkgname[@]}" +msg ":: Building ${pkgbase:-${pkgname[@]}}" + +# is_built doesn't support version checking +#is_built ${pkgbase:-${pkgname[0]}}=${pkgver} && exit 0 +is_built ${pkgbase:-${pkgname[0]}} && exit 0 + +#sudo pacman -Sy trap "quit" SIGTERM SIGKILL +if is_banned ${pkgbase:-$pkgname}; then + echo "This package is banned from building. Check the ban list" + exit 1 +fi + check_queue || exit 1 failed=() @@ -113,15 +138,21 @@ deps=$(echo "${depends[@]} ${makedepends[@]} ${pkgdeps[@]}" | \ msg "Checking dependencies" plain "${deps[@]}" -msg "Syncing database" -sudo pacman -Sy +#msg "Syncing database" +#sudo pacman -Sy for _dep in ${deps[@]}; do is_built $_dep && continue + is_banned $_dep && continue for _repo in ${REPOS[@]}; do # TODO find split packages [[ -e "$ABSROOT/${_repo}/$_dep/PKGBUILD" ]] && { +# source "$ABSROOT/${_repo}/$_dep/PKGBUILD" + +# If this version is built, continue with the next dep +# is_built $_dep=$pkgver && continue 2 + cp -r "$ABSROOT/$_repo/$_dep" $tmp_dir/ || { error "Can't copy $_dep to the work dir." exit 1 @@ -173,12 +204,12 @@ pushd $tmp_dir/$(basename $PWD) >/dev/null msg "Syncing database" sudo pacman -Sy - -makepkg --noconfirm -sLcr ; r=$? +makepkg --noconfirm -sLcr $@ ; r=$? case $r in 0) msg "The build was succesful." mipsrelease *.pkg.tar.* + sudo pacman -Sy ;; 1) error "There were errors while trying to build the package." -- cgit v1.2.2 From 2434277d8cf73c7332b82e5fb8fd968990976fd0 Mon Sep 17 00:00:00 2001 From: Nicolas Reynolds Date: Thu, 14 Apr 2011 13:31:46 -0300 Subject: Version checking --- fullpkg | 16 +++++++++------- is_built | 6 ++++-- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/fullpkg b/fullpkg index ac5b005..c3c44a8 100755 --- a/fullpkg +++ b/fullpkg @@ -1,8 +1,8 @@ #!/bin/bash # TODO -# * Do version checking # * Detect circular builds # * Detect pkgnames by provides, replaces, etc. instead of dir tree +# * Detect package repo [[ ! -r PKGBUILD ]] && { echo "This isn't a build directory" @@ -102,9 +102,7 @@ quit() { source PKGBUILD msg ":: Building ${pkgbase:-${pkgname[@]}}" -# is_built doesn't support version checking -#is_built ${pkgbase:-${pkgname[0]}}=${pkgver} && exit 0 -is_built ${pkgbase:-${pkgname[0]}} && exit 0 +is_built "${pkgbase:-${pkgname[0]}}>=${pkgver}" && exit 0 #sudo pacman -Sy @@ -142,16 +140,20 @@ plain "${deps[@]}" #sudo pacman -Sy for _dep in ${deps[@]}; do - is_built $_dep && continue is_banned $_dep && continue for _repo in ${REPOS[@]}; do # TODO find split packages [[ -e "$ABSROOT/${_repo}/$_dep/PKGBUILD" ]] && { -# source "$ABSROOT/${_repo}/$_dep/PKGBUILD" + source "$ABSROOT/${_repo}/$_dep/PKGBUILD" + msg "Checking for $_dep>=$pkgver" # If this version is built, continue with the next dep -# is_built $_dep=$pkgver && continue 2 + + if is_built "$_dep>=$pkgver"; then + msg "No need to build this one" + break + fi cp -r "$ABSROOT/$_repo/$_dep" $tmp_dir/ || { error "Can't copy $_dep to the work dir." diff --git a/is_built b/is_built index 9dc5d1c..52888ce 100755 --- a/is_built +++ b/is_built @@ -1,7 +1,9 @@ #!/bin/bash # Detect is a package is installed or in a database -pacman -Qqi $1 >/dev/null 2>&1 || \ -pacman -Sqi $1 >/dev/null 2>&1 +# 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. +# Example usage: is_built "pcre>=20" +!(sudo pacman -T "$1" | egrep "*" >/dev/null) exit $? -- cgit v1.2.2 From 1a0d07ee6f649fa515236ee58830a864bb65e661 Mon Sep 17 00:00:00 2001 From: Nicolas Reynolds Date: Thu, 14 Apr 2011 13:45:35 -0300 Subject: Precedence order tip + correct error message on empty VAR --- libretools.conf | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libretools.conf b/libretools.conf index da8d9d8..00963e2 100644 --- a/libretools.conf +++ b/libretools.conf @@ -7,6 +7,9 @@ DIFFTOOL=vimdiff # The dir where you work on WORKDIR=/home/$USER/packages # The repos you'll be packaging for +# Tip: As early repos take precedence on $REPOS loops, you can use this as +# inverted order of precedence. Put testing repos first so fullpkg find new +# PKGBUILDs first, for instance. REPOS=('libre' 'libre-testing' 'core' 'community' 'extra' 'social' 'sugar') # The architectures @@ -76,7 +79,7 @@ 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 $0" + echo "Configure $VAR var in /etc/libretools.conf" exit 1 } done -- cgit v1.2.2 From 47970ad081939c1024a2a9358e647ed2358f6de6 Mon Sep 17 00:00:00 2001 From: Nicolas Reynolds Date: Thu, 14 Apr 2011 14:26:43 -0300 Subject: Remote version checking --- is_built | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/is_built b/is_built index 52888ce..f789e4f 100755 --- a/is_built +++ b/is_built @@ -3,7 +3,10 @@ # 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 -T "$1" | egrep "*" >/dev/null) || \ +sudo pacman -Sp "$1" --print-format "%n-%v" 2>/dev/null | egrep "*" >/dev/null exit $? -- cgit v1.2.2