Skip to content

Commit

Permalink
Merge "Adding proper version dependency in the control file with depe…
Browse files Browse the repository at this point in the history
…ndency in or list."
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Apr 30, 2015
2 parents 9817362 + 0798835 commit 7612b7c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tools/scripts/add_dependency_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,26 @@ def read_config(self):
self.control.readfp(self.cfg_fp)

def cset_cond(self, pkg):
return 'contrail' in pkg and pkg != 'contrail-vrouter'
return '|' not in pkg and 'contrail' in pkg and pkg != 'contrail-vrouter'

def cset_or_cond(self, pkg):
return '|' in pkg and 'contrail' in pkg and pkg != 'contrail-vrouter'

def partition(self, pred, ittr):
t1, t2 = tee(ittr)
return filter(bool, ifilterfalse(pred, t1)), filter(pred, t2)

def add_version_to_or_depends(self, depends):
return [dep.strip() + ' (>= %s)' % self._version for dep in depends.split('|')]

def change_config(self):
dep_list = map(lambda x: x.strip(), self.control.get('dummysection', 'Depends').split(','))
dummy_set, ch_or_set = self.partition(self.cset_or_cond, dep_list)
im_set, ch_set = self.partition(self.cset_cond, dep_list)
new_set = map(lambda x: x + ' (>= %s)' % self._version, ch_set)
new_or_set = map(lambda x: ' | '.join(self.add_version_to_or_depends(x)), ch_or_set)
self.control.set('dummysection', 'Depends', ',\n '.join(new_set
+ list(im_set)))
+ list(new_or_set) + list(im_set)))

def format_key(self, key):
t = key.split('-')
Expand Down

0 comments on commit 7612b7c

Please sign in to comment.