Browse Source

SuiteLoader: Support Release files only "Codename" fields

The spec for Release files says that (at least) one of "Suite" and
"Codename" will be defined.  This implies that "Suite" is optional
in some cases and SuiteLoader now correctly falls back to using
"Codename" in that case.

Closes: https://bugs.debian.org/942104
Signed-off-by: Niels Thykier <niels@thykier.net>
devuan-deployment
Niels Thykier 1 year ago
parent
commit
a6e3581195
No known key found for this signature in database GPG Key ID: A65B78DBE67C7AAC
1 changed files with 13 additions and 2 deletions
  1. +13
    -2
      britney2/inputs/suiteloader.py

+ 13
- 2
britney2/inputs/suiteloader.py View File

@@ -134,6 +134,17 @@ class DebMirrorLikeSuiteContentLoader(SuiteContentLoader):
# building items/keys - by intern strings we reduce memory (considerably).
self._architectures = [sys.intern(arch) for arch in allarches]

def _get_suite_name(self, suite, release_file):
for name in ('Suite', 'Codename'):
try:
return release_file[name]
except KeyError:
pass
self.logger.warning("Either of the fields \"Suite\" or \"Codename\" should be present in a release file.")
self.logger.error("Release file for suite %s is missing both the \"Suite\" and the \"Codename\" fields.",
suite.name)
raise KeyError('Suite')

def _update_suite_name(self, suite):
try:
release_file = read_release_file(suite.path)
@@ -143,8 +154,8 @@ class DebMirrorLikeSuiteContentLoader(SuiteContentLoader):
release_file = None

if release_file is not None:
suite.name = release_file['Suite']
self.logger.info("Using suite name from Release file: %s", release_file['Suite'])
suite.name = self._get_suite_name(suite, release_file)
self.logger.info("Using suite name from Release file: %s", suite.name)

def _check_release_file(self, target_suite, missing_config_msg):
try:


Loading…
Cancel
Save