Ability to set the launchpad project name

Some projects use share a common Launchpad project for
reporting bugs (they don't always have split out
projects for these things). This patch updates
reviewday the --project-file format to support
specifying an altername 'launchpad_project' default.

Change-Id: I66afed988afe4c0cfa37d269fd397bcbb9e5badf
This commit is contained in:
Dan Prince 2015-09-25 15:22:04 -04:00
parent 3971f290fe
commit 540225b34d
3 changed files with 15 additions and 4 deletions

View File

@ -45,6 +45,12 @@ a valid YAML/JSON file formatted like this:
projects:
- name: dib-utils
- name: diskimage-builder
- name: tripleo-heat-templates
launchpad_project: tripleo
- name: tripleo-image-elements
launchpad_project: tripleo
- name: tripleo-incubator
launchpad_project: tripleo
## License

View File

@ -74,12 +74,16 @@ PROJECTS = [
]
proj_names = PROJECTS
lp_projects = {}
if options.project_file:
if os.path.exists(options.project_file):
with open(options.project_file) as cf:
proj_names = []
for proj in yaml.load(cf.read()).get("projects"):
proj_names.append(proj['name'])
name = proj['name']
proj_names.append(name)
if 'launchpad_project' in proj:
lp_projects[name] = proj['launchpad_project']
for project in proj_names:
if project not in projects:

View File

@ -25,11 +25,11 @@ class MergeProp(object):
# FIXME: bug.importance doesn't seem to work but it should?
cause = '%s bugfix' % bug.bug_tasks[0].importance
elif self.topic.find('bp/') == 0:
spec = lp.specification(self.project, self.topic[3:])
spec = lp.specification(self.lp_proj_name, self.topic[3:])
if spec:
cause = '%s feature' % spec.priority
else:
spec = lp.specification(self.project, self.topic)
spec = lp.specification(self.lp_proj_name, self.topic)
if spec:
cause = '%s feature' % spec.priority
except:
@ -52,11 +52,12 @@ class MergeProp(object):
score = score + days_old_score
return (cause, reason, score)
def __init__(self, lp, review, cur_timestamp):
def __init__(self, lp, review, cur_timestamp, launchpad_proj_name=None):
self.owner_name = review['owner']['name']
self.url = '%s/#change,%s' % tuple(review['url'].rsplit('/', 1))
self.subject = review['subject']
self.project = review['project'][10:]
self.lp_proj_name = launchpad_proj_name or review['project'][10:]
if 'topic' in review:
self.topic = review['topic']
else: