mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-05-11 02:21:33 +00:00
Collect suite metadata in a new member hash
Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
parent
dfaf0c63c3
commit
50d4d45c59
46
britney.py
46
britney.py
@ -261,6 +261,13 @@ BinaryPackage = namedtuple('BinaryPackage', [
|
|||||||
'pkg_id',
|
'pkg_id',
|
||||||
])
|
])
|
||||||
|
|
||||||
|
SuiteInfo = namedtuple('SuiteInfo', [
|
||||||
|
'name',
|
||||||
|
'path',
|
||||||
|
'excuses_suffix',
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
class Britney(object):
|
class Britney(object):
|
||||||
"""Britney, the Debian testing updater script
|
"""Britney, the Debian testing updater script
|
||||||
|
|
||||||
@ -288,6 +295,7 @@ class Britney(object):
|
|||||||
# parse the command line arguments
|
# parse the command line arguments
|
||||||
self.policies = []
|
self.policies = []
|
||||||
self._hint_parser = HintParser(self)
|
self._hint_parser = HintParser(self)
|
||||||
|
self.suite_info = {}
|
||||||
self.__parse_arguments()
|
self.__parse_arguments()
|
||||||
MigrationItem.set_architectures(self.options.architectures)
|
MigrationItem.set_architectures(self.options.architectures)
|
||||||
|
|
||||||
@ -301,7 +309,7 @@ class Britney(object):
|
|||||||
try:
|
try:
|
||||||
self.read_hints(self.options.hintsdir)
|
self.read_hints(self.options.hintsdir)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
self.read_hints(os.path.join(self.options.unstable, 'Hints'))
|
self.read_hints(os.path.join(self.suite_info['unstable'].path, 'Hints'))
|
||||||
|
|
||||||
if self.options.nuninst_cache:
|
if self.options.nuninst_cache:
|
||||||
self.log("Not building the list of non-installable packages, as requested", type="I")
|
self.log("Not building the list of non-installable packages, as requested", type="I")
|
||||||
@ -312,8 +320,8 @@ class Britney(object):
|
|||||||
|
|
||||||
self.all_binaries = {}
|
self.all_binaries = {}
|
||||||
# read the source and binary packages for the involved distributions
|
# read the source and binary packages for the involved distributions
|
||||||
self.sources['testing'] = self.read_sources(self.options.testing)
|
self.sources['testing'] = self.read_sources(self.suite_info['testing'].path)
|
||||||
self.sources['unstable'] = self.read_sources(self.options.unstable)
|
self.sources['unstable'] = self.read_sources(self.suite_info['unstable'].path)
|
||||||
for suite in ('tpu', 'pu'):
|
for suite in ('tpu', 'pu'):
|
||||||
if hasattr(self.options, suite):
|
if hasattr(self.options, suite):
|
||||||
self.sources[suite] = self.read_sources(getattr(self.options, suite))
|
self.sources[suite] = self.read_sources(getattr(self.options, suite))
|
||||||
@ -325,10 +333,10 @@ class Britney(object):
|
|||||||
self.binaries['tpu'] = {}
|
self.binaries['tpu'] = {}
|
||||||
self.binaries['pu'] = {}
|
self.binaries['pu'] = {}
|
||||||
|
|
||||||
self.binaries['unstable'] = self.read_binaries(self.options.unstable, "unstable", self.options.architectures)
|
self.binaries['unstable'] = self.read_binaries(self.suite_info['unstable'].path, "unstable", self.options.architectures)
|
||||||
for suite in ('tpu', 'pu'):
|
for suite in ('tpu', 'pu'):
|
||||||
if hasattr(self.options, suite):
|
if suite in self.suite_info:
|
||||||
self.binaries[suite] = self.read_binaries(getattr(self.options, suite), suite, self.options.architectures)
|
self.binaries[suite] = self.read_binaries(self.suite_info[suite].path, suite, self.options.architectures)
|
||||||
else:
|
else:
|
||||||
# _build_installability_tester relies on this being
|
# _build_installability_tester relies on this being
|
||||||
# properly initialised, so insert two empty dicts
|
# properly initialised, so insert two empty dicts
|
||||||
@ -337,7 +345,7 @@ class Britney(object):
|
|||||||
self.binaries[suite][arch] = ({}, {})
|
self.binaries[suite][arch] = ({}, {})
|
||||||
# Load testing last as some live-data tests have more complete information in
|
# Load testing last as some live-data tests have more complete information in
|
||||||
# unstable
|
# unstable
|
||||||
self.binaries['testing'] = self.read_binaries(self.options.testing, "testing", self.options.architectures)
|
self.binaries['testing'] = self.read_binaries(self.suite_info['testing'].path, "testing", self.options.architectures)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
constraints_file = os.path.join(self.options.static_input_dir, 'constraints')
|
constraints_file = os.path.join(self.options.static_input_dir, 'constraints')
|
||||||
@ -473,8 +481,20 @@ class Britney(object):
|
|||||||
elif not hasattr(self.options, k.lower()) or \
|
elif not hasattr(self.options, k.lower()) or \
|
||||||
not getattr(self.options, k.lower()):
|
not getattr(self.options, k.lower()):
|
||||||
setattr(self.options, k.lower(), v)
|
setattr(self.options, k.lower(), v)
|
||||||
|
|
||||||
|
for suite in ('testing', 'unstable', 'pu', 'tpu'):
|
||||||
|
suffix = suite if suite in {'pu', 'tpu'} else ''
|
||||||
|
if hasattr(self.options, suite):
|
||||||
|
suite_path = getattr(self.options, suite)
|
||||||
|
self.suite_info[suite] = SuiteInfo(name=suite, path=suite_path, excuses_suffix=suffix)
|
||||||
|
else:
|
||||||
|
if suite in {'testing', 'unstable'}:
|
||||||
|
self.log("Mandatory configuration %s is not set in the config" % suite.upper(), type='E')
|
||||||
|
sys.exit(1)
|
||||||
|
self.log("Optional suite %s is not defined (config option: %s) " % (suite, suite.upper()))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
release_file = read_release_file(self.options.testing)
|
release_file = read_release_file(self.suite_info['testing'].path)
|
||||||
self.log("Found a Release file in testing - using that for defaults")
|
self.log("Found a Release file in testing - using that for defaults")
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
self.log("Testing does not have a Release file.")
|
self.log("Testing does not have a Release file.")
|
||||||
@ -508,7 +528,7 @@ class Britney(object):
|
|||||||
else:
|
else:
|
||||||
if not release_file:
|
if not release_file:
|
||||||
self.log("No configured architectures and there is no release file for testing", type="E")
|
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("Please check if there is a \"Release\" file in %s" % self.suite_info['testing'].path, type="E")
|
||||||
self.log("or if the config file contains a non-empty \"ARCHITECTURES\" field", type="E")
|
self.log("or if the config file contains a non-empty \"ARCHITECTURES\" field", type="E")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
allarches = sorted(release_file['Architectures'].split())
|
allarches = sorted(release_file['Architectures'].split())
|
||||||
@ -525,8 +545,8 @@ class Britney(object):
|
|||||||
self.options.ignore_cruft == "0":
|
self.options.ignore_cruft == "0":
|
||||||
self.options.ignore_cruft = False
|
self.options.ignore_cruft = False
|
||||||
|
|
||||||
self.policies.append(AgePolicy(self.options, MINDAYS))
|
self.policies.append(AgePolicy(self.options, self.suite_info, MINDAYS))
|
||||||
self.policies.append(RCBugPolicy(self.options))
|
self.policies.append(RCBugPolicy(self.options, self.suite_info))
|
||||||
|
|
||||||
for policy in self.policies:
|
for policy in self.policies:
|
||||||
policy.register_hints(self._hint_parser)
|
policy.register_hints(self._hint_parser)
|
||||||
@ -2752,9 +2772,9 @@ class Britney(object):
|
|||||||
# re-write control files
|
# re-write control files
|
||||||
if self.options.control_files:
|
if self.options.control_files:
|
||||||
self.log("Writing new testing control files to %s" %
|
self.log("Writing new testing control files to %s" %
|
||||||
self.options.testing)
|
self.suite_info['testing'].path)
|
||||||
write_controlfiles(self.sources, self.binaries,
|
write_controlfiles(self.sources, self.binaries,
|
||||||
'testing', self.options.testing)
|
'testing', self.suite_info['testing'].path)
|
||||||
|
|
||||||
for policy in self.policies:
|
for policy in self.policies:
|
||||||
policy.save_state(self)
|
policy.save_state(self)
|
||||||
|
@ -38,7 +38,7 @@ class PolicyVerdict(Enum):
|
|||||||
|
|
||||||
class BasePolicy(object):
|
class BasePolicy(object):
|
||||||
|
|
||||||
def __init__(self, policy_id, options, applicable_suites):
|
def __init__(self, policy_id, options, suite_info, applicable_suites):
|
||||||
"""The BasePolicy constructor
|
"""The BasePolicy constructor
|
||||||
|
|
||||||
:param policy_id An string identifying the policy. It will
|
:param policy_id An string identifying the policy. It will
|
||||||
@ -52,6 +52,7 @@ class BasePolicy(object):
|
|||||||
"""
|
"""
|
||||||
self.policy_id = policy_id
|
self.policy_id = policy_id
|
||||||
self.options = options
|
self.options = options
|
||||||
|
self.suite_info = suite_info
|
||||||
self.applicable_suites = applicable_suites
|
self.applicable_suites = applicable_suites
|
||||||
self.hints = None
|
self.hints = None
|
||||||
|
|
||||||
@ -204,8 +205,8 @@ class AgePolicy(BasePolicy):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, options, mindays):
|
def __init__(self, options, suite_info, mindays):
|
||||||
super().__init__('age', options, {'unstable'})
|
super().__init__('age', options, suite_info, {'unstable'})
|
||||||
self._min_days = mindays
|
self._min_days = mindays
|
||||||
if options.default_urgency not in mindays:
|
if options.default_urgency not in mindays:
|
||||||
raise ValueError("Missing age-requirement for default urgency (MINDAYS_%s)" % options.default_urgency)
|
raise ValueError("Missing age-requirement for default urgency (MINDAYS_%s)" % options.default_urgency)
|
||||||
@ -295,7 +296,7 @@ class AgePolicy(BasePolicy):
|
|||||||
def _read_dates_file(self):
|
def _read_dates_file(self):
|
||||||
"""Parse the dates file"""
|
"""Parse the dates file"""
|
||||||
dates = self._dates
|
dates = self._dates
|
||||||
fallback_filename = os.path.join(self.options.testing, 'Dates')
|
fallback_filename = os.path.join(self.suite_info['testing'].path, 'Dates')
|
||||||
using_new_name = False
|
using_new_name = False
|
||||||
try:
|
try:
|
||||||
filename = os.path.join(self.options.state_dir, 'age-policy-dates')
|
filename = os.path.join(self.options.state_dir, 'age-policy-dates')
|
||||||
@ -331,7 +332,7 @@ class AgePolicy(BasePolicy):
|
|||||||
def _read_urgencies_file(self, britney):
|
def _read_urgencies_file(self, britney):
|
||||||
urgencies = self._urgencies
|
urgencies = self._urgencies
|
||||||
min_days_default = self._min_days_default
|
min_days_default = self._min_days_default
|
||||||
fallback_filename = os.path.join(self.options.testing, 'Urgency')
|
fallback_filename = os.path.join(self.suite_info['testing'].path, 'Urgency')
|
||||||
try:
|
try:
|
||||||
filename = os.path.join(self.options.state_dir, 'age-policy-urgencies')
|
filename = os.path.join(self.options.state_dir, 'age-policy-urgencies')
|
||||||
if not os.path.exists(filename) and os.path.exists(fallback_filename):
|
if not os.path.exists(filename) and os.path.exists(fallback_filename):
|
||||||
@ -373,9 +374,9 @@ class AgePolicy(BasePolicy):
|
|||||||
try:
|
try:
|
||||||
directory = self.options.state_dir
|
directory = self.options.state_dir
|
||||||
basename = 'age-policy-dates'
|
basename = 'age-policy-dates'
|
||||||
old_file = os.path.join(self.options.testing, 'Dates')
|
old_file = os.path.join(self.suite_info['testing'].path, 'Dates')
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
directory = self.options.testing
|
directory = self.suite_info['testing'].path
|
||||||
basename = 'Dates'
|
basename = 'Dates'
|
||||||
old_file = None
|
old_file = None
|
||||||
filename = os.path.join(directory, basename)
|
filename = os.path.join(directory, basename)
|
||||||
@ -408,8 +409,8 @@ class RCBugPolicy(BasePolicy):
|
|||||||
- This file needs to be updated externally.
|
- This file needs to be updated externally.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, options):
|
def __init__(self, options, suite_info):
|
||||||
super().__init__('rc-bugs', options, {'unstable'})
|
super().__init__('rc-bugs', options, suite_info, {'unstable'})
|
||||||
self._bugs = {}
|
self._bugs = {}
|
||||||
|
|
||||||
def register_hints(self, hint_parser):
|
def register_hints(self, hint_parser):
|
||||||
@ -420,8 +421,8 @@ class RCBugPolicy(BasePolicy):
|
|||||||
|
|
||||||
def initialise(self, britney):
|
def initialise(self, britney):
|
||||||
super().initialise(britney)
|
super().initialise(britney)
|
||||||
fallback_unstable = os.path.join(self.options.unstable, 'BugsV')
|
fallback_unstable = os.path.join(self.suite_info['unstable'].path, 'BugsV')
|
||||||
fallback_testing = os.path.join(self.options.testing, 'BugsV')
|
fallback_testing = os.path.join(self.suite_info['testing'].path, 'BugsV')
|
||||||
try:
|
try:
|
||||||
filename_unstable = os.path.join(self.options.state_dir, 'rc-bugs-unstable')
|
filename_unstable = os.path.join(self.options.state_dir, 'rc-bugs-unstable')
|
||||||
filename_testing = os.path.join(self.options.state_dir, 'rc-bugs-testing')
|
filename_testing = os.path.join(self.options.state_dir, 'rc-bugs-testing')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user