reproducible_create_meta_pkg_sets.sh 20.7 KB
Newer Older
1 2
#!/bin/bash

Holger Levsen's avatar
Holger Levsen committed
3
# Copyright 2015-2018 Holger Levsen <holger@layer-acht.org>
4 5
# released under the GPLv=2

6
DEBUG=false
7 8 9 10 11 12
. /srv/jenkins/bin/common-functions.sh
common_init "$@"

# common code defining db access
. /srv/jenkins/bin/reproducible_common.sh

13 14
# we only generate the meta pkg sets on amd64
# (else this script would need a lot of changes for little gain)
15
# but these are source package sets so differences happen only very rarely anyway
16
ARCH=amd64
17

18 19 20 21
# everything should be ok…
WARNING=false
ABORT=false

22
# helper functions
23 24 25
packages_list_to_deb822() {
	ALL_PKGS=$(cat $TMPFILE | cut -d ":" -f1 | sed "s#([^()]*)##g ; s#\[[^][]*\]##g ; s#,##g ; s# #\n#g"  |sort -u | tr '\n' '|')
	grep-dctrl -F Package -e '^('"$ALL_PKGS"')$' $PACKAGES > $TMPFILE
26
}
27

28 29 30 31 32 33
tails_build_manifest_to_deb822() {
	tmpfile="$1"
	packages="$2"
	ALL_PKGS=$(python3 - "$tmpfile" <<EOF
import sys
import yaml
34 35 36
try:
	with open(sys.argv[1]) as fd:
		manifest = yaml.load(fd)
37 38 39 40 41 42 43

	seen = set()
	for pkg in (manifest['packages']['binary'] + manifest['packages']['source']):
		pkgname = pkg['package']
		if pkgname not in seen:
			print(pkgname, end='|')
			seen.add(pkgname)
44 45
except Exception as exc:
	print("Warning: something went wrong while parsing the build manifest as YAML file: {}".format(exc))
46 47 48 49 50
EOF
)
	grep-dctrl -F Package -e '^('"$ALL_PKGS"')$' $packages > "$tmpfile"
}

51
convert_from_deb822_into_source_packages_only() {
52 53 54 55 56 57 58
	# given a Packages file in deb822 format on standard input, the
	# following perl "oneliner" outputs the associated (unversioned)
	# source package names, one per line
	perl -e 'use Dpkg::Control;while(1){$c=Dpkg::Control->new();' \
		-e 'last if not $c->parse(STDIN);$p=$c->{"Package"};' \
		-e '$s=$c->{"Source"};if (not defined $s){print "$p\n"}' \
		-e 'else{$s=~s/\s*([\S]+)\s+.*/\1/;print "$s\n"}}' \
59 60
		> ${TMPFILE2} < $TMPFILE
	sort -u ${TMPFILE2} > $TMPFILE
61
	rm -f ${TMPFILE2}
62
}
63 64

update_target() {
65
	local MESSAGE="$1"
66
	mv $TMPFILE $TARGET
67
	echo "$(date -u) - $TARGET ($MESSAGE) updated."
68 69
}

70 71 72
update_if_similar() {
	# this is mostly done to not accidently overwrite the lists
	# with garbage, eg. when external services are down
73
	if [ -s $TMPFILE ] ; then
74 75
		sort -u $TMPFILE > ${TMPFILE2}
		mv ${TMPFILE2} $TMPFILE
76 77 78 79 80
		TARGET=$TPATH/$1
		if [ -f $TARGET ] ; then
			LENGTH=$(cat $TARGET | wc -w)
			NEWLEN=$(cat $TMPFILE | wc -w)
			PERCENT=$(echo "$LENGTH*100/$NEWLEN"|bc)
81
			if [ $PERCENT -gt 110 ] || [ $PERCENT -lt 90 ] ; then
82 83
				mv $TMPFILE $TARGET.new
				echo
84
				echo "Warning: too much difference for $TARGET, aborting. Please investigate and update manually:"
85
				WARNING=true
86
				echo
87 88
				echo diff -u $TARGET $TARGET.new
				diff -u $TARGET $TARGET.new || true
89
				echo
90
				KEEP=$(mktemp --tmpdir=$TEMPDIR pkg-set-check-XXXXXXXXXX)
91 92
				mv $TARGET.new $KEEP
				echo "The new pkg-set has been saved as $KEEP for further investigation."
93
				echo "wc -l $TARGET $KEEP)"
94 95 96 97 98 99
				wc -l $TARGET $KEEP | grep -v " total"
				echo
				echo "To update the package set run:"
				echo "cp $KEEP $TARGET"
				echo
				echo "============================================================================="
100
			else
101
				update_target "old: $LENGTH source packages, new: $NEWLEN"
102
			fi
103 104
		else
			# target does not exist, create it
105
			update_target "newly created"
106
		fi
107
	else
Holger Levsen's avatar
Holger Levsen committed
108
		echo "$(date -u) - $TARGET not updated, $TMPFILE is empty."
109 110 111
	fi
}

112 113
get_installable_set() {
	set +e
114
	echo "$(date -u) - Calculating the installable set for ${META_PKGSET[$index]}."
115
	dose-deb-coinstall --deb-native-arch=$ARCH --bg=$PACKAGES --fg=${TMPFILE2} > $TMPFILE
116 117
	RESULT=$?
	if [ $RESULT -ne 0 ] ; then
118
		rm -f $TMPFILE
119 120
		MESSAGE="Warning: dose-deb-coinstall cannot calculate the installable set for $1"
		irc_message debian-reproducible $MESSAGE
121
		dose-deb-coinstall --explain --failures --deb-native-arch=$ARCH --bg=$PACKAGES --fg=${TMPFILE2}
122
		ABORT=true
123
	fi
124
	rm -f ${TMPFILE2}
125 126 127
	set -e
}

128
progress_info_begin() {
129
	local table=$1
130
	echo "$(date -u) - Checking ${META_PKGSET[$table]}.pkgset for updates in $SUITE."
131 132 133 134
}

progress_info_end() {
	local table=$1
135
	echo "$(date -u) - work on ${META_PKGSET[$table]}.pkgset done."
136
	echo "============================================================================="
137 138
}

139
use_previous_sets_build_depends() {
140
	local src_set=$index
141
	let src_set-=1
142

143 144 145 146 147
	for PKG in $(cat $TPATH/${META_PKGSET[$src_set]}.pkgset) ; do
		grep-dctrl -sBuild-Depends -n -X -FPackage $PKG $SOURCES | sed "s#([^()]*)##g ; s#\[[^][]*\]##g ; s#,##g" | sort -u >> $TMPFILE
	done
	packages_list_to_deb822
	convert_from_deb822_into_source_packages_only
148 149
}

150
update_pkg_set_specific() {
151
	#
152
	# bin/reproducible_pkgsets.csv defines the names of the packages set and their ordering
153
	#
154 155 156
	case ${META_PKGSET[$index]} in
		essential)
			# the essential package set
157
			chdist --data-dir=$CHPATH grep-dctrl-packages $DISTNAME -X -FEssential yes > $TMPFILE
158
			convert_from_deb822_into_source_packages_only
159
			;;
160 161
		required)
			# the required package set
162
			chdist --data-dir=$CHPATH grep-dctrl-packages $DISTNAME -X -FPriority required > $TMPFILE
163
			convert_from_deb822_into_source_packages_only
164
			;;
165 166
		build-essential)
			# build-essential
167 168 169 170 171 172 173
			chdist --data-dir=$CHPATH grep-dctrl-packages $DISTNAME -X \( -FBuild-Essential yes --or -FPackage build-essential \) > ${TMPFILE2}
			# here we want the installable set:
			get_installable_set
			if [ -f $TMPFILE ] ; then
				convert_from_deb822_into_source_packages_only
			fi
			;;
174 175
		build-essential-depends)
			# build-essential-depends
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
			#
			# This set is created using the following procedure:
			#
			#  1. take the binary package build-essential and put it into set S
			#  2. go over every package in S and
			#      2.1. if it is a binary package
			#          2.1.1 add all its strong dependencies to S
			#          2.1.2 add the source package it builds from to S
			#      2.2. if it is a source package add all its strong dependencies
			#           to S
			#  3. if step 2 added new packages, repeat step 2, otherwise exit
			#
			# Strong dependencies are those direct or indirect dependencies of
			# a package without which the package cannot be installed.
			#
			# This set is important because a package can only be trusted if
			# also all its dependencies, all its build dependencies and
			# recursively their own dependencies and build dependencies can be
			# trusted.
			# So making this set reproducible is required to make anything
			# in the essential or build-essential set trusted.
			# Since this is only the strong set, it is a minimal set. In reality
			# more packages are needed to build build-essential
			grep-dctrl --exact-match --field Package build-essential "$PACKAGES" \
200 201 202 203 204
				| botch-latest-version - - \
				| botch-bin2src --deb-native-arch="$ARCH" - "$SOURCES" \
				| botch-create-graph --deb-drop-b-d-indep --quiet --deb-native-arch="$ARCH" --strongtype --bg "$SOURCES" "$PACKAGES" - \
				| botch-buildgraph2packages - "$PACKAGES" \
				| botch-bin2src --deb-native-arch="$ARCH" - "$SOURCES" \
205 206
				| grep-dctrl --no-field-names --show-field=Package '' > $TMPFILE
			;;
207 208
		popcon_top1337-installed-sources)
			# popcon top 1337 installed sources
209 210 211 212 213 214 215
			SQL_QUERY="SELECT popcon_src.source FROM popcon_src ORDER BY popcon_src.insts DESC LIMIT 1337;"
			PGPASSWORD=public-udd-mirror \
				psql -U public-udd-mirror \
				-h public-udd-mirror.xvm.mit.edu -p 5432 \
				-t \
				udd -c"${SQL_QUERY}" > $TMPFILE
			;;
216 217
		key_packages)
			# key packages (same for all suites)
218 219 220 221 222 223 224
			SQL_QUERY="SELECT source FROM key_packages;"
			PGPASSWORD=public-udd-mirror \
				psql -U public-udd-mirror \
				-h public-udd-mirror.xvm.mit.edu -p 5432 \
				-t \
				udd -c"${SQL_QUERY}" > $TMPFILE
			;;
225 226
		installed_on_debian.org)
			# installed on one or more .debian.org machines
227
			# one day we will get a proper data provider from DSA...
228
			# currently we get a manual "dpkg --get-selections" from all machines
229
			cat /srv/jenkins/bin/reproducible_installed_on_debian.org > $TMPFILE
230 231
			packages_list_to_deb822
			convert_from_deb822_into_source_packages_only
232
			;;
233 234
		had_a_DSA)
			# packages which had a DSA
235
			DSA=$(mktemp --tmpdir=$TEMPDIR pkg-sets-XXXXXXXXX -u)
Holger Levsen's avatar
Holger Levsen committed
236
			git clone --depth 1 https://salsa.debian.org/security-tracker-team/security-tracker $DSA
237
			cp $DSA/data/DSA/list ${TMPFILE2}
238
			grep "^\[" ${TMPFILE2} | grep "DSA-" | cut -d " " -f5 > $TMPFILE
239
			rm $DSA -r
240
			;;
241 242
		cii-census)
			# packages from the cii-census
243 244 245 246 247 248 249
			CII=$(mktemp --tmpdir=$TEMPDIR pkg-sets-XXXXXXXXX -u)
			git clone --depth 1 https://github.com/linuxfoundation/cii-census.git $CII
			csvtool -t ',' col 1 $CII/results.csv | grep -v "project_name" > $TMPFILE
			MISSES=""
			# convert binary packages into source packages
			for i in $(cat $TMPFILE) ; do
				chdist --data-dir=$CHPATH apt-cache $DISTNAME show $i >> ${TMPFILE2} 2>/dev/null || MISSES="$i $MISSES"
250
			done
251 252 253 254 255
			echo "The following unknown packages have been ignored: $MISSES"
			mv ${TMPFILE2} $TMPFILE
			rm $CII -r
			convert_from_deb822_into_source_packages_only
			;;
256
		gnome)	# gnome and everything it depends on
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271
			#
			# The build-depends of X tasks can be solved once dose-ceve is able to read
			# Debian source packages (possible in dose3 git but needs a new dose3 release
			# and upload to unstable)
			#
			# Ignoring parsing issues, the current method is unable to resolve virtual
			# build dependencies
			#
			# The current method also ignores Build-Depends-Indep and Build-Depends-Arch
			chdist --data-dir=$CHPATH grep-dctrl-packages $DISTNAME -X \( -FPriority required --or -FPackage gnome \) > ${TMPFILE2}
			get_installable_set
			if [ -f $TMPFILE ] ; then
				convert_from_deb822_into_source_packages_only
			fi
			;;
272
		*_build-depends)
273
			# all build depends of the previous set (as defined in bin/reproducible_pkgsets.csv)
274 275
			use_previous_sets_build_depends
			;;
276
		kde)	# kde and everything it depends on
277 278 279 280 281 282 283 284 285 286
			chdist --data-dir=$CHPATH grep-dctrl-packages $DISTNAME -X \( -FPriority required --or -FPackage kde-full --or -FPackage kde-standard \) > ${TMPFILE2}
			get_installable_set
			if [ -f $TMPFILE ] ; then
				convert_from_deb822_into_source_packages_only
				# also add the packages maintained by those teams
				# (maybe add the depends of those packages too?)
				grep-dctrl -sPackage -n -FMaintainer,Uploaders debian-qt-kde@lists.debian.org $SOURCES >> $TMPFILE
				grep-dctrl -sPackage -n -FMaintainer,Uploaders pkg-kde-extras@lists.alioth.debian.org $SOURCES >> $TMPFILE
			fi
			;;
287
		mate)	# mate and everything it depends on
288 289 290 291 292 293 294 295 296
			chdist --data-dir=$CHPATH grep-dctrl-packages $DISTNAME -X \( -FPriority required --or -FPackage mate-desktop-environment --or -FPackage mate-desktop-environment-extras \) > ${TMPFILE2}
			get_installable_set
			if [ -f $TMPFILE ] ; then
				convert_from_deb822_into_source_packages_only
				# also add the packages maintained by the team
				# (maybe add the depends of those packages too?)
				grep-dctrl -sPackage -n -FMaintainer,Uploaders pkg-mate-team@lists.alioth.debian.org $SOURCES >> $TMPFILE
			fi
			;;
297
		xfce)	# xfce and everything it depends on
298 299 300 301 302 303
			chdist --data-dir=$CHPATH grep-dctrl-packages $DISTNAME -X \( -FPriority required --or -FPackage xfce4 \) > ${TMPFILE2}
			get_installable_set
			if [ -f $TMPFILE ] ; then
				convert_from_deb822_into_source_packages_only
			fi
			;;
304 305 306 307 308 309 310 311
		CIP)
			# installed by the Core Infrastructure Plattform
			# one day we might get a proper data provider from them...
			# (so far it was send via email)
			cat /srv/jenkins/bin/reproducible_installed_by_CIP > $TMPFILE
			packages_list_to_deb822
			convert_from_deb822_into_source_packages_only
			;;
312 313
		debian-edu)
			# Debian Edu
314 315 316 317 318 319 320 321 322 323 324 325 326 327
			# all recommends of the education-* packages
			# (the Debian Edu metapackages don't use depends but recommends…)
			chdist --data-dir=$CHPATH grep-dctrl-packages $DISTNAME -n -sRecommends -r -FPackage education-*  |sed "s#([^()]*)##g ; s#\[[^][]*\]##g ; s#,##g" | sort -u > ${TMPFILE}
			packages_list_to_deb822
			mv $TMPFILE ${TMPFILE3}
			# required and maintained by Debian Edu
			chdist --data-dir=$CHPATH grep-dctrl-packages $DISTNAME \( -FPriority required --or -FMaintainer debian-edu@lists.debian.org \) > ${TMPFILE2}
			get_installable_set
			mv $TMPFILE ${TMPFILE2}
			cat ${TMPFILE2} ${TMPFILE3} > $TMPFILE
			if [ -f $TMPFILE ] ; then
				convert_from_deb822_into_source_packages_only
			fi
			;;
328 329
		freedombox)
			# freedombox-setup and plinth and everything they depend on
330 331 332 333 334 335 336 337 338 339 340 341
			chdist --data-dir=$CHPATH grep-dctrl-packages $DISTNAME -X \( -FPriority required --or -FPackage freedombox-setup --or -FPackage plinth \) > ${TMPFILE2}
			get_installable_set
			if [ -f $TMPFILE ] ; then
				convert_from_deb822_into_source_packages_only
				# hardcoded list of source packages
				# derived from looking at "@package.required" in $src-plinth/plinth/modules/*py
				# see https://wiki.debian.org/FreedomBox/Manual/Developer#Specifying_module_dependencies
				for PKG in avahi deluge easy-rsa ejabberd ez-ipupdate firewalld ikiwiki jwchat monkeysphere mumble network-manager ntp obfs4proxy openvpn owncloud php-dropbox php5 postgresql-common privoxy python-letsencrypt quassel roundcube shaarli sqlite3 tor torsocks transmission unattended-upgrades ; do
					echo $PKG >> $TMPFILE
				done
			fi
			;;
342
		grml)	# grml
343 344 345 346 347 348 349 350
			URL="http://grml.org/files/grml64-full_latest/dpkg.selections"
			echo "Downloading $URL now."
			curl $URL | cut -f1 > $TMPFILE
			if ! grep '404 Not Found' $TMPFILE ; then
				echo "parsing $TMPFILE now..."
				packages_list_to_deb822
				convert_from_deb822_into_source_packages_only
			else
351
				rm $TMPFILE
352 353 354 355 356
				MESSAGE="Warning: could not download grml's latest dpkg.selections file, skipping pkg set..."
				irc_message debian-reproducible $MESSAGE
				ABORT=true
			fi
			;;
357
		tails)	# tails
358
			URL="https://nightly.tails.boum.org/build_Tails_ISO_devel/lastSuccessful/archive/latest.iso.build-manifest"
359 360 361 362
			echo "Downloading $URL now."
			curl $URL > $TMPFILE
			if ! grep '404 Not Found' $TMPFILE ; then
				echo "parsing $TMPFILE now..."
363 364
				tails_build_manifest_to_deb822 "$TMPFILE" "$PACKAGES"
				convert_from_deb822_into_source_packages_only
365
			else
366
				rm $TMPFILE
367 368 369 370 371
				MESSAGE="Warning: could not download tail's latest packages file(s), skipping tails pkg set..."
				irc_message debian-reproducible $MESSAGE
				ABORT=true
			fi
			;;
372 373
		subgraph_OS)
			# installed by Subgraph OS
Holger Levsen's avatar
Holger Levsen committed
374
			# one day we will get a proper data provider from Subgraph OS...
375 376
			# (so far it was a manual "dpkg -l")
			cat /srv/jenkins/bin/reproducible_installed_by_subgraphos > $TMPFILE
377
			packages_list_to_deb822
378
			convert_from_deb822_into_source_packages_only
379
			;;
380 381 382 383
		maint_debian-accessibility)
			# debian-accessibility@l.d.o maintainers
			grep-dctrl -sPackage -n -FMaintainer,Uploaders debian-accessibility@lists.debian.org $SOURCES > $TMPFILE
			;;
384 385
		maint_debian-boot)
			# debian-boot@l.d.o maintainers
386 387
			grep-dctrl -sPackage -n -FMaintainer,Uploaders debian-boot@lists.debian.org $SOURCES > $TMPFILE
			;;
388 389 390 391 392
		maint_debian-lua)
			# lua packages
			grep-dctrl -sPackage -n -FPackage -e ^lua.* $SOURCES > $TMPFILE
			grep-dctrl -sPackage -n -FBuild-Depends dh-lua $SOURCES | sed "s#([^()]*)##g ; s#\[[^][]*\]##g ; s#,##g" | sort -u >> $TMPFILE
			;;
393 394
		maint_debian-med)
			# Debian Med Packaging Team <debian-med-packaging@lists.alioth.debian.org>
395 396
			grep-dctrl -sPackage -n -FMaintainer,Uploaders debian-med-packaging@lists.alioth.debian.org $SOURCES > $TMPFILE
			;;
397 398
		maint_debian-ocaml)
			# debian-ocaml-maint@l.d.o maintainers
399 400
			grep-dctrl -sPackage -n -FMaintainer,Uploaders debian-ocaml-maint@lists.debian.org $SOURCES > $TMPFILE
			;;
401 402
		maint_debian-python)
			# debian python maintainers
403 404 405
			grep-dctrl -sPackage -n -FMaintainer,Uploaders python-modules-team@lists.alioth.debian.org $SOURCES > $TMPFILE
			grep-dctrl -sPackage -n -FMaintainer,Uploaders python-apps-team@lists.alioth.debian.org $SOURCES >> $TMPFILE
			;;
406 407
		maint_debian-qa)
			# debian-qa maintainers
408 409
			grep-dctrl -sPackage -n -FMaintainer,Uploaders packages@qa.debian.org $SOURCES > $TMPFILE
			;;
410 411
		maint_debian-science)
			# Debian Science Team
412 413
			grep-dctrl -sPackage -n -FMaintainer,Uploaders debian-science-maintainers@lists.alioth.debian.org $SOURCES > $TMPFILE
			;;
414 415
		maint_debian-x)
			# debian-x@l.d.o maintainers
416 417
			grep-dctrl -sPackage -n -FMaintainer,Uploaders debian-x@lists.debian.org $SOURCES > $TMPFILE
			;;
418 419 420 421
		maint_pkg-android-tools-maintainers)
			# Android Tools Team
			grep-dctrl -sPackage -n -FMaintainer,Uploaders android-tools-devel@lists.alioth.debian.org $SOURCES > $TMPFILE
			;;
422 423
		maint_pkg-fonts-devel)
			# pkg-fonts-devel
424 425
			grep-dctrl -sPackage -n -FMaintainer,Uploaders pkg-fonts-devel@lists.alioth.debian.org $SOURCES > $TMPFILE
			;;
426 427
		maint_pkg-games-devel)
			# pkg-games-devel
428 429
			grep-dctrl -sPackage -n -FMaintainer,Uploaders pkg-games-devel@lists.alioth.debian.org $SOURCES > $TMPFILE
			;;
430 431
		maint_pkg-golang-maintainers)
			# pkg-golang-maintainers
432 433 434
			grep-dctrl -sPackage -n -FMaintainer,Uploaders pkg-golang-devel@lists.alioth.debian.org $SOURCES > $TMPFILE
			grep-dctrl -sPackage -n -FBuild-Depends golang-go $SOURCES | sed "s#([^()]*)##g ; s#\[[^][]*\]##g ; s#,##g" | sort -u >> $TMPFILE
			;;
435 436 437 438
		maint_pkg-grass-devel)
			# pkg-games-devel
			grep-dctrl -sPackage -n -FMaintainer,Uploaders pkg-grass-devel@lists.alioth.debian.org $SOURCES > $TMPFILE
			;;
439 440
		maint_pkg-haskell-maintainers)
			# pkg-haskell-maintainers
441 442 443
			grep-dctrl -sPackage -n -FMaintainer,Uploaders pkg-haskell-maintainers@lists.alioth.debian.org $SOURCES > $TMPFILE
			grep-dctrl -sPackage -n -FBuild-Depends ghc $SOURCES | sed "s#([^()]*)##g ; s#\[[^][]*\]##g ; s#,##g" | sort -u >> $TMPFILE
			;;
444 445
		maint_pkg-java-maintainers)
			# pkg-java-maintainers
446 447 448 449
			grep-dctrl -sPackage -n -FMaintainer,Uploaders pkg-java-maintainers@lists.alioth.debian.org $SOURCES > $TMPFILE
			grep-dctrl -sPackage -n -FMaintainer,Uploaders openjdk@lists.launchpad.net $SOURCES >> $TMPFILE
			grep-dctrl -sPackage -n -FBuild-Depends default-jdk -o -FBuild-Depends-Indep default-jdk $SOURCES | sed "s#([^()]*)##g ; s#\[[^][]*\]##g ; s#,##g" | sort -u >> $TMPFILE
			;;
450 451
		maint_pkg-javascript-devel)
			# pkg-javascript-devel
452 453
			grep-dctrl -sPackage -n -FMaintainer,Uploaders pkg-javascript-devel@lists.alioth.debian.org $SOURCES > $TMPFILE
			;;
454 455
		maint_pkg-multimedia-maintainers)
			# pkg-multimedia-maintainers
456 457
			grep-dctrl -sPackage -n -FMaintainer,Uploaders pkg-multimedia-maintainers@lists.alioth.debian.org $SOURCES > $TMPFILE
			;;
458 459
		maint_pkg-perl-maintainers)
			# pkg-perl-maintainers
460 461
			grep-dctrl -sPackage -n -FMaintainer,Uploaders pkg-perl-maintainers@lists.alioth.debian.org $SOURCES > $TMPFILE
			;;
462 463
		maint_pkg-php-pear)
			# pkg-php-pear
464 465
			grep-dctrl -sPackage -n -FMaintainer,Uploaders pkg-php-pear@lists.alioth.debian.org $SOURCES > $TMPFILE
			;;
466 467
		maint_pkg-ruby-extras-maintainers)
			# pkg-ruby-extras-maintainers
468 469
			grep-dctrl -sPackage -n -FMaintainer,Uploaders pkg-ruby-extras-maintainers@lists.alioth.debian.org $SOURCES > $TMPFILE
			;;
470 471 472 473
		maint_pkg-openstack)
			# pkg-openstack
			grep-dctrl -sPackage -n -FMaintainer,Uploaders openstack-devel@lists.alioth.debian.org $SOURCES > $TMPFILE
			;;
474 475
	esac
}
476

477
update_pkg_sets() {
478 479
	# loop through all defined package sets…
	for index in $(seq 1 ${#META_PKGSET[@]}) ; do
480 481 482 483 484 485 486 487
		progress_info_begin $index
		if [ ! -z $(find $TPATH -maxdepth 1 -mtime +0 -name ${META_PKGSET[$index]}.pkgset) ] || [ ! -f $TPATH/${META_PKGSET[$index]}.pkgset ] ; then
			update_pkg_set_specific
			update_if_similar ${META_PKGSET[$index]}.pkgset
		fi
		progress_info_end index
		rm -f $TMPFILE ${TMPFILE2} ${TMPFILE3}
	done
488 489
}

490
# define some global variables…
491 492
TMPFILE=$(mktemp --tmpdir=$TEMPDIR pkg-sets-XXXXXXXXX)
TMPFILE2=$(mktemp --tmpdir=$TEMPDIR pkg-sets-XXXXXXXXX)
493
TMPFILE3=$(mktemp --tmpdir=$TEMPDIR pkg-sets-XXXXXXXXX)
494 495 496
index=0

# loop through all suites
497 498 499 500
for SUITE in $SUITES ; do
	if [ "$SUITE" = "experimental" ] ; then
		# no pkg sets in experimental
		continue
501 502 503
	elif [ "$SUITE" = "stretch" ] ; then
		# let's not update the stretch pkg sets anymore
		continue
504
	fi
505 506
	echo "============================================================================="
	echo "$(date -u) - Creating meta package sets for $SUITE now."
507 508 509 510
	echo

	DISTNAME="$SUITE-$ARCH"
	TPATH=/srv/reproducible-results/meta_pkgsets-$SUITE
511
	mkdir -p $TPATH
512

513 514
	PACKAGES=$(ls $CHPATH/$DISTNAME/var/lib/apt/lists/*_dists_${SUITE}_main_binary-${ARCH}_Packages)
	SOURCES=$(ls $CHPATH/$DISTNAME/var/lib/apt/lists/*_dists_${SUITE}_main_source_Sources)
515 516 517
	echo "============================================================================="
	echo "$(date -u) - Creating meta package sets for $SUITE now."
	echo "============================================================================="
518 519
	update_pkg_sets

520 521 522
	echo
	echo "============================================================================="
	echo "$(date -u) - Done updating all meta package sets for $SUITE."
523
done
524

525
echo
526 527 528 529 530 531

# abort the job if there are problems we cannot do anything about (except filing bugs! (but these are unrelated to reproducible builds...))
if "$ABORT" && ! "$WARNING" ; then
	exec /srv/jenkins/bin/abort.sh
fi
# (if there are warnings, we want to see them. aborting a job disables its notifications...)