[Qa-jenkins-scm] [jenkins.debian.net] 01/02: repro-al build: Use expac to get a full list of actual pkgbases

Holger Levsen holger at layer-acht.org
Thu Nov 23 13:45:01 UTC 2017


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch master
in repository jenkins.debian.net.

commit 6489c3aa01d774842484852c16d8c1adb137e825
Author: Johannes Löthberg <johannes at kyriasis.com>
Date:   Wed Nov 22 17:36:13 2017 +0100

    repro-al build: Use expac to get a full list of actual pkgbases
    
    Previously we would just use whatever `pacman -Slq` outputs, but that is
    full of split packages that aren't valid pkgbases, leading to lots of
    uslessly failed builds.  Instead we should use something like expac to
    get only a list of valid pkgbases.
    
    Signed-off-by: Johannes Löthberg <johannes at kyriasis.com>
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 bin/reproducible_build_archlinux_pkg.sh     | 27 ++++++++++++++++++++-------
 bin/reproducible_setup_archlinux_schroot.sh |  2 +-
 2 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/bin/reproducible_build_archlinux_pkg.sh b/bin/reproducible_build_archlinux_pkg.sh
index ab75153..68579f1 100755
--- a/bin/reproducible_build_archlinux_pkg.sh
+++ b/bin/reproducible_build_archlinux_pkg.sh
@@ -54,15 +54,28 @@ update_archlinux_repositories() {
 	if $NEED_UPDATE ; then
 		local SESSION="archlinux-scheduler-$RANDOM"
 		schroot --begin-session --session-name=$SESSION -c jenkins-reproducible-archlinux
+		schroot --run-session -c $SESSION --directory /var/tmp -- sudo pacman -Syu --noconfirm
+		# Get a list of unique package bases.  Non-split packages don't have a pkgbase set
+		# so we need to use the pkgname for them instead.
+		schroot --run-session -c $SESSION --directory /var/tmp -- expac -S '%r %e %n' | \
+			while read repo pkgbase pkgname; do
+				if [[ "$pkgbase" = "(null)" ]]; then
+					printf '%s %s\n' "$repo" "$pkgname"
+				else
+					printf '%s %s\n' "$repo" "$pkgbase"
+				fi
+			done | sort -u > "$ARCHLINUX_PKGS"_full_pkgbase_list
+
 		for REPO in $ARCHLINUX_REPOS ; do
-			if [ ! -f ${ARCHLINUX_PKGS}_$REPO ] || [ $DUMMY -nt ${ARCHLINUX_PKGS}_$REPO ] ; then
-				echo "$(date -u ) - updating list of available packages in repository '$REPO'."
-				schroot --run-session -c $SESSION --directory /var/tmp -- sudo pacman -Syu --noconfirm
-				schroot --run-session -c $SESSION --directory /var/tmp -- pacman -Slq "$REPO" | xargs echo > ${ARCHLINUX_PKGS}_$REPO
-				echo "$(date -u ) - these packages in repository '$REPO' are known to us:"
-				cat ${ARCHLINUX_PKGS}_$REPO
-			fi
+			echo "$(date -u ) - updating list of available packages in repository '$REPO'."
+			grep "^$REPO" "$ARCHLINUX_PKGS"_full_pkgbase_list | \
+				while read repo pkgbase; do
+					printf '%s\n' "$pkgbase"
+				done > "$ARCHLINUX_PKGS"_"$REPO"
+			echo "$(date -u ) - these packages in repository '$REPO' are known to us:"
+			cat ${ARCHLINUX_PKGS}_$REPO
 		done
+		rm "$ARCHLINUX_PKGS"_full_pkgbase_list
 		schroot --end-session -c $SESSION
 	else
 		echo "$(date -u ) - repositories recent enough, no update needed."
diff --git a/bin/reproducible_setup_archlinux_schroot.sh b/bin/reproducible_setup_archlinux_schroot.sh
index f7c1611..3b59e45 100755
--- a/bin/reproducible_setup_archlinux_schroot.sh
+++ b/bin/reproducible_setup_archlinux_schroot.sh
@@ -124,7 +124,7 @@ $ROOTCMD cat /etc/makepkg.conf
 echo "============================================================================="
 
 $ROOTCMD bash -l -c 'pacman -Syu --noconfirm'
-$ROOTCMD bash -l -c 'pacman -S --noconfirm base-devel devtools fakechroot asciidoc asp'
+$ROOTCMD bash -l -c 'pacman -S --noconfirm base-devel devtools fakechroot asciidoc asp expac'
 $ROOTCMD bash -l -c 'yes | pacman -S gcc-multilib lib32-fakeroot lib32-libltdl'
 # configure sudo
 echo 'jenkins ALL= NOPASSWD: /usr/sbin/pacman *' | $ROOTCMD tee -a /etc/sudoers

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list