[Qa-jenkins-scm] [jenkins.debian.net] 02/03: reproducible Arch Linux: atomically update the repos

Holger Levsen holger at layer-acht.org
Fri Dec 1 14:06:10 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 710a3d0438cc29906dd54345742c9a457dad15b9
Author: Holger Levsen <holger at layer-acht.org>
Date:   Fri Dec 1 14:01:03 2017 +0000

    reproducible Arch Linux: atomically update the repos
    
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 bin/reproducible_archlinux_scheduler.sh | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/bin/reproducible_archlinux_scheduler.sh b/bin/reproducible_archlinux_scheduler.sh
index c6d88d2..80bf4d0 100755
--- a/bin/reproducible_archlinux_scheduler.sh
+++ b/bin/reproducible_archlinux_scheduler.sh
@@ -28,12 +28,13 @@ update_archlinux_repositories() {
 		done | sort -u > "$ARCHLINUX_PKGS"_full_pkgbase_list
 
 	for REPO in $ARCHLINUX_REPOS ; do
+		TMPPKGLIST=$(mktemp -t archlinux-scheduler-XXXXXXXX)
 		echo "$(date -u ) - updating list of available packages in repository '$REPO'."
 		grep "^$REPO" "$ARCHLINUX_PKGS"_full_pkgbase_list | \
 			while read repo pkgbase version; do
 				if [ ! -d $BASE/archlinux/$REPO/$pkgbase ] ; then
 					let NEW+=1
-					echo -n "$(date -u ) - scheduling new package $REPO/$pkgbase... " >&2
+					echo -n "$(date -u ) - scheduling new package $REPO/$pkgbase... "
 					mkdir -p $BASE/archlinux/$REPO/$pkgbase
 					touch $BASE/archlinux/$REPO/$pkgbase/pkg.needs_build
 				else
@@ -41,14 +42,15 @@ update_archlinux_repositories() {
 					if [ "$VERSION" != "0.rb-unknown-1" ] && [ ! -f $BASE/archlinux/$REPO/$pkgbase/pkg.needs_build ] ; then
 						if [ "$(schroot --run-session -c $SESSION --directory /var/tmp -- vercmp $version $VERSION)" = "1" ] ; then
 							let UPDATED+=1
-							echo -n "$(date -u ) - we know about $REPO/$pkgbase $VERSION, but the repo has $version, so rescheduling... " >&2
+							echo -n "$(date -u ) - we know about $REPO/$pkgbase $VERSION, but the repo has $version, so rescheduling... "
 							mkdir -p $BASE/archlinux/$REPO/$pkgbase
 							touch $BASE/archlinux/$REPO/$pkgbase/pkg.needs_build
 						fi
 					fi
 				fi
-				printf '%s %s\n' "$pkgbase" "$version"
-			done > "$ARCHLINUX_PKGS"_"$REPO"
+				printf '%s %s\n' "$pkgbase" "$version" >> $TMPPKGLIST
+			done
+		mv $TMPPKGLIST "$ARCHLINUX_PKGS"_"$REPO"
 		echo "$(date -u ) - $(cat ${ARCHLINUX_PKGS}_$REPO | wc -l) packages in repository '$REPO' are known to us:"
 	done
 	rm "$ARCHLINUX_PKGS"_full_pkgbase_list

-- 
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