From dfaf0c63c3abfd13ca78299ff1914b9afb5326ae Mon Sep 17 00:00:00 2001 From: Niels Thykier Date: Sun, 23 Oct 2016 12:28:12 +0000 Subject: [PATCH] Pull defaults for Components and Architectures from Release Why duplicate that in the configuration when Britney can just pull it in the Release file for testing? :) Closes: Debian/britney2#11 Signed-off-by: Niels Thykier --- britney.conf | 11 ++++++++--- britney.conf.template | 12 ++++++++---- britney.py | 22 ++++++++++++++++++++-- britney_nobreakall.conf | 11 ++++++++--- 4 files changed, 44 insertions(+), 12 deletions(-) diff --git a/britney.conf b/britney.conf index 836ba11..9f5b0a5 100644 --- a/britney.conf +++ b/britney.conf @@ -6,7 +6,10 @@ TPU = /srv/mirrors/debian/dists/testing-proposed-updates PU = /srv/mirrors/debian/dists/proposed-updates UNSTABLE = /srv/mirrors/debian/dists/unstable -COMPONENTS = main, non-free, contrib +# Defaults to the value from testing's Release file (if present) +# - Not used with the legacy layout. +# +#COMPONENTS = main, non-free, contrib # Output NONINST_STATUS = /srv/release.debian.org/britney/var/data-b2/non-installable-status @@ -24,8 +27,10 @@ STATIC_INPUT_DIR = /srv/release.debian.org/britney/input # (e.g. urgency information). STATE_DIR = /srv/release.debian.org/britney/state -# List of release architectures -ARCHITECTURES = i386 amd64 arm64 armel armhf mips mipsel mips64el ppc64el s390x +# List of architectures that Britney should consider. +# - defaults to the value in testing's Release file (if it is present). +# - Required for the legacy layout. +#ARCHITECTURES = i386 amd64 arm64 armel armhf mips mipsel mips64el ppc64el s390x # if you're not in this list, arch: all packages are allowed to break on you NOBREAKALL_ARCHES = i386 amd64 diff --git a/britney.conf.template b/britney.conf.template index bcb6723..b3ae659 100644 --- a/britney.conf.template +++ b/britney.conf.template @@ -9,8 +9,10 @@ TESTING = /path/to/target/suite # TPU = /path/to/secondary-source/suite # PU = /path/to/another-source/suite -# List of components to work with -COMPONENTS = main, non-free, contrib +# Defaults to the value from testing's Release file (if present) +# - Not used with the legacy layout. +# +#COMPONENTS = main, non-free, contrib # Output NONINST_STATUS = /path/to/britneys-output-dir/non-installable-status @@ -29,8 +31,10 @@ HEIDI_DELTA_OUTPUT = /path/to/britneys-output-dir/HeidiResultDelta # (e.g. urgency information). STATE_DIR = /path/to/britey/state-dir -# List of architectures Britney should consider -ARCHITECTURES = i386 amd64 arm64 armel armhf mips mipsel powerpc ppc64el s390x +# List of architectures that Britney should consider. +# - defaults to the value in testing's Release file (if it is present). +# - Required for the legacy layout. +#ARCHITECTURES = i386 amd64 arm64 armel armhf mips mipsel mips64el powerpc ppc64el s390x # if you're not in this list, arch: all packages are allowed to break on you NOBREAKALL_ARCHES = i386 amd64 diff --git a/britney.py b/britney.py index f53ae97..002a761 100755 --- a/britney.py +++ b/britney.py @@ -473,9 +473,18 @@ class Britney(object): elif not hasattr(self.options, k.lower()) or \ not getattr(self.options, k.lower()): setattr(self.options, k.lower(), v) + try: + release_file = read_release_file(self.options.testing) + self.log("Found a Release file in testing - using that for defaults") + except FileNotFoundError: + self.log("Testing does not have a Release file.") + release_file = None if getattr(self.options, "components", None): self.options.components = [s.strip() for s in self.options.components.split(",")] + elif release_file and not self.options.control_files: + self.options.components = release_file['Components'].split() + self.log("Using components listed in Release file: %s" % ' '.join(self.options.components)) else: self.options.components = None @@ -493,8 +502,17 @@ class Britney(object): self.options.break_arches = self.options.break_arches.split() self.options.new_arches = self.options.new_arches.split() - # Sort the architecture list - allarches = sorted(self.options.architectures.split()) + if getattr(self.options, "architectures", None): + # Sort the architecture list + allarches = sorted(self.options.architectures.split()) + else: + if not release_file: + self.log("No configured architectures and there is no release file for testing", type="E") + self.log("Please check if there is a \"Release\" file in %s" % self.options.testing, type="E") + self.log("or if the config file contains a non-empty \"ARCHITECTURES\" field", type="E") + sys.exit(1) + allarches = sorted(release_file['Architectures'].split()) + self.log("Using architectures listed in Release file: %s" % ' '.join(allarches)) arches = [x for x in allarches if x in self.options.nobreakall_arches] arches += [x for x in allarches if x not in arches and x not in self.options.outofsync_arches] arches += [x for x in allarches if x not in arches and x not in self.options.break_arches] diff --git a/britney_nobreakall.conf b/britney_nobreakall.conf index 4d153f0..b6e38b4 100644 --- a/britney_nobreakall.conf +++ b/britney_nobreakall.conf @@ -6,7 +6,10 @@ TPU = /srv/mirrors/debian/dists/testing-proposed-updates PU = /srv/mirrors/debian/dists/proposed-updates UNSTABLE = /srv/mirrors/debian/dists/unstable -COMPONENTS = main, non-free, contrib +# Defaults to the value from testing's Release file (if present) +# - Not used with the legacy layout. +# +#COMPONENTS = main, non-free, contrib # Output NONINST_STATUS = /srv/release.debian.org/britney/var/data-b2/non-installable-status @@ -24,8 +27,10 @@ STATIC_INPUT_DIR = /srv/release.debian.org/britney/input # (e.g. urgency information). STATE_DIR = /srv/release.debian.org/britney/state -# List of release architectures -ARCHITECTURES = i386 amd64 arm64 armel armhf mips mipsel mips64el ppc64el s390x +# List of architectures that Britney should consider. +# - defaults to the value in testing's Release file (if it is present). +# - Required for the legacy layout. +#ARCHITECTURES = i386 amd64 arm64 armel armhf mips mipsel mips64el ppc64el s390x # if you're not in this list, arch: all packages are allowed to break on you NOBREAKALL_ARCHES = i386 amd64 arm64 armel armhf mips mipsel mips64el ppc64el s390x