summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorHolger Levsen <holger@layer-acht.org>2014-10-05 03:43:04 +0200
committerHolger Levsen <holger@layer-acht.org>2014-10-05 05:06:12 +0200
commit38080e1ef219cf505098d99758e498dcee4e29ed (patch)
tree792c3eca9beb1c92f4d4e0136713da0a7ce9c407 /bin
parent7c8d5a50eb1617f71e98d887d25253a92d07d7d5 (diff)
downloadjenkins.debian.net-38080e1ef219cf505098d99758e498dcee4e29ed.tar.xz
reproducible: refactor
Diffstat (limited to 'bin')
-rwxr-xr-xbin/reproducible_build.sh16
1 files changed, 9 insertions, 7 deletions
diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh
index 3c3943ce..b9c878f0 100755
--- a/bin/reproducible_build.sh
+++ b/bin/reproducible_build.sh
@@ -22,11 +22,18 @@ grep deb-src /etc/apt/sources.list | grep sid
# try apt-get update twice, else fail gracefully, aka not.
sudo apt-get update || ( sleep $(( $RANDOM % 70 + 30 )) ; sudo apt-get update || true )
+# update sources table in db
+TMPFILE=$(mktemp)
+curl http://ftp.de.debian.org/debian/dists/sid/main/source/Sources.xz > $TMPFILE
+CSVFILE=$(mktemp)
+(xzcat $TMPFILE | egrep "(^Package:|^Version:)" | sed -s "s#^Version: ##g; s#Package: ##g; s#\n# #g"| while read PKG ; do read VERSION ; echo "$PKG,$VERSION" ; done) > $CSVFILE
+sqlite3 -csv -init $INIT ${PACKAGES_DB} "DELETE from sources"
+echo ".import $CSVFILE sources" | sqlite3 -csv -init $INIT ${PACKAGES_DB}
+rm $CSVFILE # $TMPFILE is still being used
+
set +x
# if $1 is an integer, build $1 random packages
if [[ $1 =~ ^-?[0-9]+$ ]] ; then
- TMPFILE=$(mktemp)
- curl http://ftp.de.debian.org/debian/dists/sid/main/source/Sources.xz > $TMPFILE
AMOUNT=$1
if [ $AMOUNT -gt 0 ] ; then
REAL_AMOUNT=0
@@ -46,11 +53,6 @@ if [[ $1 =~ ^-?[0-9]+$ ]] ; then
AMOUNT=$REAL_AMOUNT
else
# this is kind of a hack: if $1 is 0, then schedule 33 failed packages which were randomly picked and where a new version is available
- CSVFILE=$(mktemp)
- sqlite3 -csv -init $INIT ${PACKAGES_DB} "DELETE from sources"
- (xzcat $TMPFILE | egrep "(^Package:|^Version:)" | sed -s "s#^Version: ##g; s#Package: ##g; s#\n# #g"| while read PKG ; do read VERSION ; echo "$PKG,$VERSION" ; done) > $CSVFILE
- echo ".import $CSVFILE sources" | sqlite3 -csv -init $INIT ${PACKAGES_DB}
- rm $CSVFILE
AMOUNT=33
PACKAGES=$(sqlite3 -init $INIT ${PACKAGES_DB} "SELECT DISTINCT source_packages.name FROM source_packages,sources WHERE sources.version IN (SELECT version FROM sources WHERE name=source_packages.name ORDER by sources.version DESC LIMIT 1) AND (( source_packages.status = 'unreproducible' OR source_packages.status = 'FTBFS') AND source_packages.name = sources.name AND source_packages.version < sources.version) ORDER BY source_packages.build_date LIMIT $AMOUNT" | xargs -r echo)
echo "Info: Only unreproducible and FTBFS packages with a new version available are selected from this job."