Merge "teach list-deliverables to filter on governance tags"
This commit is contained in:
commit
2aacb993bf
@ -63,6 +63,12 @@ def main():
|
|||||||
'--type',
|
'--type',
|
||||||
help='deliverable type, such as "library" or "service"',
|
help='deliverable type, such as "library" or "service"',
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--tag',
|
||||||
|
default=[],
|
||||||
|
action='append',
|
||||||
|
help='look for one more more tags on the deliverable or team',
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--deliverables-dir',
|
'--deliverables-dir',
|
||||||
default=openstack_releases.deliverable_dir,
|
default=openstack_releases.deliverable_dir,
|
||||||
@ -144,6 +150,11 @@ def main():
|
|||||||
continue
|
continue
|
||||||
if args.missing_rc and deliv.latest_release and 'rc' in deliv.latest_release:
|
if args.missing_rc and deliv.latest_release and 'rc' in deliv.latest_release:
|
||||||
continue
|
continue
|
||||||
|
if args.tag:
|
||||||
|
tags = deliv.tags
|
||||||
|
for t in args.tag:
|
||||||
|
if t not in tags:
|
||||||
|
continue
|
||||||
if args.verbose:
|
if args.verbose:
|
||||||
print(verbose_template.format(
|
print(verbose_template.format(
|
||||||
name=deliv.name,
|
name=deliv.name,
|
||||||
|
@ -22,6 +22,8 @@ import os
|
|||||||
import pbr.version
|
import pbr.version
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
from openstack_releases import governance
|
||||||
|
|
||||||
|
|
||||||
def _safe_semver(v):
|
def _safe_semver(v):
|
||||||
"""Get a SemanticVersion that closely represents the version string.
|
"""Get a SemanticVersion that closely represents the version string.
|
||||||
@ -196,6 +198,8 @@ class Deliverables(object):
|
|||||||
|
|
||||||
class Deliverable(object):
|
class Deliverable(object):
|
||||||
|
|
||||||
|
_governance_data = None
|
||||||
|
|
||||||
def __init__(self, team, series, name, data):
|
def __init__(self, team, series, name, data):
|
||||||
self.team = team
|
self.team = team
|
||||||
if self.team is None:
|
if self.team is None:
|
||||||
@ -207,6 +211,8 @@ class Deliverable(object):
|
|||||||
for r in self.releases:
|
for r in self.releases:
|
||||||
for p in r['projects']:
|
for p in r['projects']:
|
||||||
self.repos.add(p['repo'])
|
self.repos.add(p['repo'])
|
||||||
|
if self._governance_data is None:
|
||||||
|
Deliverable._governance_data = governance.get_team_data()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def model(self):
|
def model(self):
|
||||||
@ -248,3 +254,8 @@ class Deliverable(object):
|
|||||||
if b['name'] == name:
|
if b['name'] == name:
|
||||||
return b['location']
|
return b['location']
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@property
|
||||||
|
def tags(self):
|
||||||
|
return governance.get_tags_for_deliverable(
|
||||||
|
self._governance_data, self.team, self.name)
|
||||||
|
@ -35,6 +35,15 @@ def get_team_data(url=PROJECTS_LIST):
|
|||||||
return yaml.load(r.text)
|
return yaml.load(r.text)
|
||||||
|
|
||||||
|
|
||||||
|
def get_tags_for_deliverable(team_data, team, name):
|
||||||
|
"Return the tags for the deliverable owned by the team."
|
||||||
|
team_info = team_data[team]
|
||||||
|
dinfo = team_info['deliverables'].get(name)
|
||||||
|
if not dinfo:
|
||||||
|
return set()
|
||||||
|
return set(dinfo.get('tags', [])).union(set(team_info.get('tags', [])))
|
||||||
|
|
||||||
|
|
||||||
def get_repo_owner(team_data, repo_name):
|
def get_repo_owner(team_data, repo_name):
|
||||||
"""Return the name of the team that owns the repository.
|
"""Return the name of the team that owns the repository.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user