mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-05-11 18:41:30 +00:00
Allow blocking uploads by way of bugs with the block-proposed tag set
This commit is contained in:
parent
372c34783a
commit
78a4959597
12
britney.py
12
britney.py
@ -62,6 +62,9 @@ Other than source and binary packages, Britney loads the following data:
|
|||||||
* Hints, which contains lists of commands which modify the standard behaviour
|
* Hints, which contains lists of commands which modify the standard behaviour
|
||||||
of Britney (see Britney.read_hints).
|
of Britney (see Britney.read_hints).
|
||||||
|
|
||||||
|
* Blocks, which contains user-supplied blocks read from Launchpad bugs
|
||||||
|
(see LPBlockBugPolicy).
|
||||||
|
|
||||||
For a more detailed explanation about the format of these files, please read
|
For a more detailed explanation about the format of these files, please read
|
||||||
the documentation of the related methods. The exact meaning of them will be
|
the documentation of the related methods. The exact meaning of them will be
|
||||||
instead explained in the chapter "Excuses Generation".
|
instead explained in the chapter "Excuses Generation".
|
||||||
@ -209,7 +212,7 @@ from britney_util import (old_libraries_format, undo_changes,
|
|||||||
create_provides_map,
|
create_provides_map,
|
||||||
ensuredir,
|
ensuredir,
|
||||||
)
|
)
|
||||||
from policies.policy import AgePolicy, RCBugPolicy, PolicyVerdict
|
from policies.policy import AgePolicy, RCBugPolicy, LPBlockBugPolicy, PolicyVerdict
|
||||||
|
|
||||||
# Check the "check_field_name" reflection before removing an import here.
|
# Check the "check_field_name" reflection before removing an import here.
|
||||||
from consts import (SOURCE, SOURCEVER, ARCHITECTURE, CONFLICTS, DEPENDS,
|
from consts import (SOURCE, SOURCEVER, ARCHITECTURE, CONFLICTS, DEPENDS,
|
||||||
@ -528,6 +531,7 @@ class Britney(object):
|
|||||||
|
|
||||||
self.policies.append(AgePolicy(self.options, MINDAYS))
|
self.policies.append(AgePolicy(self.options, MINDAYS))
|
||||||
self.policies.append(RCBugPolicy(self.options))
|
self.policies.append(RCBugPolicy(self.options))
|
||||||
|
self.policies.append(LPBlockBugPolicy(self.options))
|
||||||
|
|
||||||
for policy in self.policies:
|
for policy in self.policies:
|
||||||
policy.register_hints(self._hint_parser)
|
policy.register_hints(self._hint_parser)
|
||||||
@ -1673,6 +1677,12 @@ class Britney(object):
|
|||||||
excuse.addhtml("%s introduces new bugs, so still ignored (even "
|
excuse.addhtml("%s introduces new bugs, so still ignored (even "
|
||||||
"though it fixes more than it introduces, whine at debian-release)" % src)
|
"though it fixes more than it introduces, whine at debian-release)" % src)
|
||||||
|
|
||||||
|
if 'block-bugs' in policy_info:
|
||||||
|
for bug, date in policy_info['block-bugs'].items():
|
||||||
|
excuse.addhtml("Not touching package as requested in <a href=\"https://launchpad.net/bugs/%s\">bug %s</a> on %s" %
|
||||||
|
(bug, bug, time.asctime(time.gmtime(date))))
|
||||||
|
excuse.addreason("block")
|
||||||
|
|
||||||
all_binaries = self.all_binaries
|
all_binaries = self.all_binaries
|
||||||
|
|
||||||
if suite in ('pu', 'tpu') and source_t:
|
if suite in ('pu', 'tpu') and source_t:
|
||||||
|
@ -511,3 +511,46 @@ class RCBugPolicy(BasePolicy):
|
|||||||
bugs[pkg] = set()
|
bugs[pkg] = set()
|
||||||
bugs[pkg].update(l[1].split(","))
|
bugs[pkg].update(l[1].split(","))
|
||||||
return bugs
|
return bugs
|
||||||
|
|
||||||
|
|
||||||
|
class LPBlockBugPolicy(BasePolicy):
|
||||||
|
"""block-proposed Launchpad bug policy for source migrations
|
||||||
|
|
||||||
|
This policy will read an user-supplied "Blocks" file from the unstable
|
||||||
|
directory (provided by an external script) with rows of the following
|
||||||
|
format:
|
||||||
|
|
||||||
|
<source-name> <bug> <date>
|
||||||
|
|
||||||
|
The dates are expressed as the number of seconds from the Unix epoch
|
||||||
|
(1970-01-01 00:00:00 UTC).
|
||||||
|
"""
|
||||||
|
def __init__(self, options):
|
||||||
|
super().__init__('block-bugs', options, {'unstable'})
|
||||||
|
|
||||||
|
def initialise(self, britney):
|
||||||
|
super().initialise(britney)
|
||||||
|
self.blocks = {} # srcpkg -> [(bug, date), ...]
|
||||||
|
|
||||||
|
filename = os.path.join(self.options.unstable, "Blocks")
|
||||||
|
self.log("Loading user-supplied block data from %s" % filename)
|
||||||
|
for line in open(filename):
|
||||||
|
l = line.split()
|
||||||
|
if len(l) != 3:
|
||||||
|
self.log("Blocks, ignoring malformed line %s" % line, type='W')
|
||||||
|
continue
|
||||||
|
try:
|
||||||
|
self.blocks.setdefault(l[0], [])
|
||||||
|
self.blocks[l[0]].append((l[1], int(l[2])))
|
||||||
|
except ValueError:
|
||||||
|
self.log("Blocks, unable to parse \"%s\"" % line, type='E')
|
||||||
|
|
||||||
|
def apply_policy_impl(self, block_bugs_info, suite, source_name, source_data_tdist, source_data_srcdist):
|
||||||
|
try:
|
||||||
|
blocks = self.blocks[source_name]
|
||||||
|
except KeyError:
|
||||||
|
return PolicyVerdict.PASS
|
||||||
|
|
||||||
|
for bug, date in blocks:
|
||||||
|
block_bugs_info[bug] = date
|
||||||
|
return PolicyVerdict.REJECTED_PERMANENTLY
|
||||||
|
Loading…
x
Reference in New Issue
Block a user