|
|
@ -35,6 +35,10 @@ class BasePolicy(object):
|
|
|
|
logger_name = ".".join((self.__class__.__module__, self.__class__.__name__))
|
|
|
|
logger_name = ".".join((self.__class__.__module__, self.__class__.__name__))
|
|
|
|
self.logger = logging.getLogger(logger_name)
|
|
|
|
self.logger = logging.getLogger(logger_name)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
|
|
|
def state_dir(self):
|
|
|
|
|
|
|
|
return self.options.state_dir
|
|
|
|
|
|
|
|
|
|
|
|
def register_hints(self, hint_parser): # pragma: no cover
|
|
|
|
def register_hints(self, hint_parser): # pragma: no cover
|
|
|
|
"""Register new hints that this policy accepts
|
|
|
|
"""Register new hints that this policy accepts
|
|
|
|
|
|
|
|
|
|
|
@ -299,7 +303,7 @@ class AgePolicy(BasePolicy):
|
|
|
|
fallback_filename = os.path.join(self.suite_info.target_suite.path, 'Dates')
|
|
|
|
fallback_filename = os.path.join(self.suite_info.target_suite.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.state_dir, 'age-policy-dates')
|
|
|
|
if not os.path.exists(filename) and os.path.exists(fallback_filename):
|
|
|
|
if not os.path.exists(filename) and os.path.exists(fallback_filename):
|
|
|
|
filename = fallback_filename
|
|
|
|
filename = fallback_filename
|
|
|
|
else:
|
|
|
|
else:
|
|
|
@ -337,7 +341,7 @@ class AgePolicy(BasePolicy):
|
|
|
|
min_days_default = self._min_days_default
|
|
|
|
min_days_default = self._min_days_default
|
|
|
|
fallback_filename = os.path.join(self.suite_info.target_suite.path, 'Urgency')
|
|
|
|
fallback_filename = os.path.join(self.suite_info.target_suite.path, 'Urgency')
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
filename = os.path.join(self.options.state_dir, 'age-policy-urgencies')
|
|
|
|
filename = os.path.join(self.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):
|
|
|
|
filename = fallback_filename
|
|
|
|
filename = fallback_filename
|
|
|
|
except AttributeError:
|
|
|
|
except AttributeError:
|
|
|
@ -381,7 +385,7 @@ class AgePolicy(BasePolicy):
|
|
|
|
def _write_dates_file(self):
|
|
|
|
def _write_dates_file(self):
|
|
|
|
dates = self._dates
|
|
|
|
dates = self._dates
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
directory = self.options.state_dir
|
|
|
|
directory = self.state_dir
|
|
|
|
basename = 'age-policy-dates'
|
|
|
|
basename = 'age-policy-dates'
|
|
|
|
old_file = os.path.join(self.suite_info.target_suite.path, 'Dates')
|
|
|
|
old_file = os.path.join(self.suite_info.target_suite.path, 'Dates')
|
|
|
|
except AttributeError:
|
|
|
|
except AttributeError:
|
|
|
@ -433,8 +437,8 @@ class RCBugPolicy(BasePolicy):
|
|
|
|
fallback_unstable = os.path.join(source_suite.path, 'BugsV')
|
|
|
|
fallback_unstable = os.path.join(source_suite.path, 'BugsV')
|
|
|
|
fallback_testing = os.path.join(target_suite.path, 'BugsV')
|
|
|
|
fallback_testing = os.path.join(target_suite.path, 'BugsV')
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
filename_unstable = os.path.join(self.options.state_dir, 'rc-bugs-%s' % source_suite.name)
|
|
|
|
filename_unstable = os.path.join(self.state_dir, 'rc-bugs-%s' % source_suite.name)
|
|
|
|
filename_testing = os.path.join(self.options.state_dir, 'rc-bugs-%s' % target_suite.name)
|
|
|
|
filename_testing = os.path.join(self.state_dir, 'rc-bugs-%s' % target_suite.name)
|
|
|
|
if not os.path.exists(filename_unstable) and not os.path.exists(filename_testing) and \
|
|
|
|
if not os.path.exists(filename_unstable) and not os.path.exists(filename_testing) and \
|
|
|
|
os.path.exists(fallback_unstable) and os.path.exists(fallback_testing):
|
|
|
|
os.path.exists(fallback_unstable) and os.path.exists(fallback_testing):
|
|
|
|
filename_unstable = fallback_unstable
|
|
|
|
filename_unstable = fallback_unstable
|
|
|
@ -560,8 +564,8 @@ class PiupartsPolicy(BasePolicy):
|
|
|
|
source_suite = self.suite_info.primary_source_suite
|
|
|
|
source_suite = self.suite_info.primary_source_suite
|
|
|
|
target_suite = self.suite_info.target_suite
|
|
|
|
target_suite = self.suite_info.target_suite
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
filename_unstable = os.path.join(self.options.state_dir, 'piuparts-summary-%s.json' % source_suite.name)
|
|
|
|
filename_unstable = os.path.join(self.state_dir, 'piuparts-summary-%s.json' % source_suite.name)
|
|
|
|
filename_testing = os.path.join(self.options.state_dir, 'piuparts-summary-%s.json' % target_suite.name)
|
|
|
|
filename_testing = os.path.join(self.state_dir, 'piuparts-summary-%s.json' % target_suite.name)
|
|
|
|
except AttributeError as e: # pragma: no cover
|
|
|
|
except AttributeError as e: # pragma: no cover
|
|
|
|
raise RuntimeError("Please set STATE_DIR in the britney configuration") from e
|
|
|
|
raise RuntimeError("Please set STATE_DIR in the britney configuration") from e
|
|
|
|
self._piuparts['source'] = self._read_piuparts_summary(filename_unstable, keep_url=True)
|
|
|
|
self._piuparts['source'] = self._read_piuparts_summary(filename_unstable, keep_url=True)
|
|
|
|