Allow epoch to be more easily specified on a per instance basis

Change-Id: Iaa94588637b77353326c8c8511c76bca07193542
This commit is contained in:
Joshua Harlow 2016-04-19 16:15:35 -07:00
parent ec2067ec26
commit 703d5236ae
2 changed files with 15 additions and 10 deletions

View File

@ -102,23 +102,22 @@ class DependencyHandler(object):
ignore_pips.update(ignore_distro_pips)
self.ignore_pips = ignore_pips
def _python_eggs(self, priors):
egg_infos = []
def iter_instance_and_eggs(self, include_priors):
groups = [self.instances]
if priors:
if include_priors:
for _group, prior_instances in self.prior_groups:
groups.append(list(prior_instances.values()))
for instances in groups:
for i in instances:
try:
egg_infos.append(dict(i.egg_info))
yield i, dict(i.egg_info)
except AttributeError:
pass
return egg_infos
@property
def python_names(self):
return [e['name'] for e in self._python_eggs(True)]
return [egg['name']
for _instance, egg in self.iter_instance_and_eggs(True)]
@staticmethod
def _get_package_dirs(instances):
@ -181,7 +180,8 @@ class DependencyHandler(object):
sh.unlink(self.tracereader.filename())
def _scan_pip_requires(self, requires_files):
own_eggs = self._python_eggs(False)
own_eggs = [egg for _instance, egg
in self.iter_instance_and_eggs(False)]
def replace_forced_requirements(fn, forced_by_key):
old_lines = sh.load_file(fn).splitlines()

View File

@ -122,11 +122,16 @@ class YumDependencyHandler(base.DependencyHandler):
if not isinstance(epoch_skips, (list, tuple)):
epoch_skips = [i.strip() for i in epoch_skips.split(",")]
built_epochs = {}
for name in self.python_names:
for instance, egg in self.iter_instance_and_eggs(True):
name = egg['name']
epoch = None
if name in epoch_map:
built_epochs[name] = str(epoch_map.pop(name))
epoch = str(epoch_map.pop(name))
else:
built_epochs[name] = str(self.OPENSTACK_EPOCH)
epoch = instance.get_option('epoch')
if not epoch:
epoch = str(self.OPENSTACK_EPOCH)
built_epochs[name] = epoch
# Ensure epochs set by a yum searching (that are not in the list of
# epochs to provide) are correctly set when building dependent
# packages...