From c86e1f7e9c306d50b54b57699891085102c7f25d Mon Sep 17 00:00:00 2001 From: Niels Thykier Date: Sat, 24 Sep 2016 07:38:07 +0000 Subject: [PATCH] britney: Skip architectures not listed in Release files As a side effect, remove mips64el from NEW_ARCHES as we no longer need that as a work around. Closes: Debian/britney2#12 Signed-off-by: Niels Thykier --- britney.conf | 2 +- britney.py | 16 ++++++++-------- britney2/utils.py | 16 ++++++++++++++++ britney_nobreakall.conf | 2 +- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/britney.conf b/britney.conf index ba35201..836ba11 100644 --- a/britney.conf +++ b/britney.conf @@ -37,7 +37,7 @@ OUTOFSYNC_ARCHES = BREAK_ARCHES = # if you're in this list, you are a new architecture -NEW_ARCHES = mips64el +NEW_ARCHES = # priorities and delays MINDAYS_LOW = 10 diff --git a/britney.py b/britney.py index 448fe0f..f53ae97 100755 --- a/britney.py +++ b/britney.py @@ -207,7 +207,7 @@ from britney2.utils import (old_libraries_format, undo_changes, write_excuses, write_heidi_delta, write_controlfiles, old_libraries, is_nuninst_asgood_generous, clone_nuninst, check_installability, - create_provides_map, + create_provides_map, read_release_file, ) __author__ = 'Fabio Tranchitella and the Debian Release Team' @@ -999,21 +999,21 @@ class Britney(object): arch2packages = {} if self.options.components: + release_file = read_release_file(basedir) + listed_archs = set(release_file['Architectures'].split()) for arch in architectures: packages = {} + if arch not in listed_archs: + self.log("Skipping arch %s for %s: It is not listed in the Release file" % (arch, distribution)) + arch2packages[arch] = ({}, {}) + continue for component in self.options.components: binary_dir = "binary-%s" % arch filename = os.path.join(basedir, component, binary_dir, 'Packages') - try: - filename = possibly_compressed(filename) - except FileNotFoundError: - if arch not in self.options.new_arches: - raise - self.log("Ignoring missing file for new arch %s: %s" % (arch, filename)) - continue + filename = possibly_compressed(filename) udeb_filename = os.path.join(basedir, component, "debian-installer", diff --git a/britney2/utils.py b/britney2/utils.py index c7c16da..5a11c61 100644 --- a/britney2/utils.py +++ b/britney2/utils.py @@ -21,6 +21,7 @@ # GNU General Public License for more details. +import apt_pkg import errno import os import time @@ -670,3 +671,18 @@ def create_provides_map(packages): provides[provided_pkg].add((pkg, provided_version)) return provides + + +def read_release_file(suite_dir): + """Parses a given "Release" file + + :param suite_dir: The directory to the suite + :return: A dict of the first (and only) paragraph in an Release file + """ + release_file = os.path.join(suite_dir, 'Release') + with open(release_file) as fd: + tag_file = iter(apt_pkg.TagFile(fd)) + result = next(tag_file) + if next(tag_file, None) is not None: + raise TypeError("%s has more than one paragraph" % release_file) + return result diff --git a/britney_nobreakall.conf b/britney_nobreakall.conf index 915eaf8..4d153f0 100644 --- a/britney_nobreakall.conf +++ b/britney_nobreakall.conf @@ -37,7 +37,7 @@ OUTOFSYNC_ARCHES = BREAK_ARCHES = # if you're in this list, you are a new architecture -NEW_ARCHES = mips64el +NEW_ARCHES = # priorities and delays MINDAYS_LOW = 10