[Qa-jenkins-scm] [jenkins.debian.net] 01/02: reproducible Arch Linux: add extremely simple scheduler
Holger Levsen
holger at layer-acht.org
Fri Dec 1 01:09:26 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 e901d066c405cc89621859d8ad90accc65517185
Author: Holger Levsen <holger at layer-acht.org>
Date: Fri Dec 1 00:49:34 2017 +0000
reproducible Arch Linux: add extremely simple scheduler
Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
bin/reproducible_archlinux_scheduler.sh | 60 +++++++++++++++++++++++++++++++++
bin/reproducible_build_archlinux_pkg.sh | 43 -----------------------
job-cfg/reproducible.yaml | 3 ++
3 files changed, 63 insertions(+), 43 deletions(-)
diff --git a/bin/reproducible_archlinux_scheduler.sh b/bin/reproducible_archlinux_scheduler.sh
new file mode 100755
index 0000000..b54c06f
--- /dev/null
+++ b/bin/reproducible_archlinux_scheduler.sh
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+# Copyright 2015-2017 Holger Levsen <holger at layer-acht.org>
+# released under the GPLv=2
+
+DEBUG=false
+. /srv/jenkins/bin/common-functions.sh
+common_init "$@"
+
+# common code
+. /srv/jenkins/bin/reproducible_common.sh
+
+set -e
+
+update_archlinux_repositories() {
+ # every day we check for new archlinux packages in all tested repositories
+ touch -d "$(date -d '1 day ago' '+%Y-%m-%d') 00:00 UTC" $DUMMY
+ local NEED_UPDATE=false
+ local REPO
+ for REPO in $ARCHLINUX_REPOS ; do
+ if [ ! -f ${ARCHLINUX_PKGS}_$REPO ] || [ $DUMMY -nt ${ARCHLINUX_PKGS}_$REPO ] ; then
+ NEED_UPDATE=true
+ fi
+ done
+ 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 %v' | \
+ while read repo pkgbase pkgname version; do
+ if [[ "$pkgbase" = "(null)" ]]; then
+ printf '%s %s %s\n' "$repo" "$pkgname" "$version"
+ else
+ printf '%s %s %s\n' "$repo" "$pkgbase" "$version"
+ fi
+ done | sort -u > "$ARCHLINUX_PKGS"_full_pkgbase_list
+
+ for REPO in $ARCHLINUX_REPOS ; do
+ echo "$(date -u ) - updating list of available packages in repository '$REPO'."
+ grep "^$REPO" "$ARCHLINUX_PKGS"_full_pkgbase_list | \
+ while read repo pkgbase version; do
+ printf '%s %s\n' "$pkgbase" "$version"
+ 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."
+ fi
+ rm $DUMMY > /dev/null
+}
+
+echo "$(date -u ) - Updating Arch Linux repositories."
+update_archlinux_repositories
+
+# vim: set sw=0 noet :
diff --git a/bin/reproducible_build_archlinux_pkg.sh b/bin/reproducible_build_archlinux_pkg.sh
index 06df943..399b1da 100755
--- a/bin/reproducible_build_archlinux_pkg.sh
+++ b/bin/reproducible_build_archlinux_pkg.sh
@@ -41,51 +41,8 @@ handle_remote_error() {
exit 0
}
-update_archlinux_repositories() {
- # every day we check for new archlinux packages in all tested repositories
- touch -d "$(date -d '1 day ago' '+%Y-%m-%d') 00:00 UTC" $DUMMY
- local NEED_UPDATE=false
- local REPO
- for REPO in $ARCHLINUX_REPOS ; do
- if [ ! -f ${ARCHLINUX_PKGS}_$REPO ] || [ $DUMMY -nt ${ARCHLINUX_PKGS}_$REPO ] ; then
- NEED_UPDATE=true
- fi
- done
- 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 %v' | \
- while read repo pkgbase pkgname version; do
- if [[ "$pkgbase" = "(null)" ]]; then
- printf '%s %s %s\n' "$repo" "$pkgname" "$version"
- else
- printf '%s %s %s\n' "$repo" "$pkgbase" "$version"
- fi
- done | sort -u > "$ARCHLINUX_PKGS"_full_pkgbase_list
-
- for REPO in $ARCHLINUX_REPOS ; do
- echo "$(date -u ) - updating list of available packages in repository '$REPO'."
- grep "^$REPO" "$ARCHLINUX_PKGS"_full_pkgbase_list | \
- while read repo pkgbase version; do
- printf '%s %s\n' "$pkgbase" "$version"
- 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."
- fi
- rm $DUMMY > /dev/null
-}
-
choose_package() {
echo "$(date -u ) - choosing package to be build."
- update_archlinux_repositories
local REPO
local PKG
for REPO in $(echo $ARCHLINUX_REPOS | sed -s "s# #\n#g" | sort -R | xargs echo ); do
diff --git a/job-cfg/reproducible.yaml b/job-cfg/reproducible.yaml
index 3803a59..0a9283b 100644
--- a/job-cfg/reproducible.yaml
+++ b/job-cfg/reproducible.yaml
@@ -555,6 +555,9 @@
- 'html_archlinux':
my_description: 'Build a simple webpage for Arch Linux reproducibility tests'
my_timed: ''
+ - 'archlinux_scheduler':
+ my_description: 'A simple scheduler for for Arch Linux reproducibility tests'
+ my_timed: '0 H/3 * * *'
- 'html_fedora-23_x86_64':
my_description: 'Build a simple webpage for Fedora 23 reproducibility tests'
my_timed: ''
--
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