add get-deliverable-owner command

Change-Id: Id87a32d0ce933b0188591912aed3b104f70d92ac
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2017-01-23 16:15:04 -05:00 committed by Thierry Carrez
parent 35245d1d0f
commit 4f07da7e15
3 changed files with 70 additions and 2 deletions

View File

@ -0,0 +1,53 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from __future__ import print_function
import argparse
import openstack_releases
from openstack_releases import defaults
from openstack_releases import deliverable
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
'deliverable',
help='the name of the deliverable, such as "nova" or "oslo.config"',
)
parser.add_argument(
'--series',
default=defaults.RELEASE,
help='the release series, such as "newton" or "ocata"',
)
parser.add_argument(
'--deliverables-dir',
default=openstack_releases.deliverable_dir,
help='location of deliverable files',
)
args = parser.parse_args()
# Deal with the inconsistency of the name for the independent
# directory.
series = args.series
if series == 'independent':
series = '_independent'
all_deliv = deliverable.Deliverables(
root_dir=args.deliverables_dir,
collapse_history=False,
)
for entry in all_deliv.get_deliverable_history(args.deliverable):
deliv = deliverable.Deliverable(*entry)
print(deliv.team)
break

View File

@ -105,10 +105,11 @@ class Deliverables(object):
# Map team names to a set of all the series in which they # Map team names to a set of all the series in which they
# produced anything. # produced anything.
self._team_series = collections.defaultdict(set) self._team_series = collections.defaultdict(set)
# Map both team and series name to a list of the deliverable # Map team, series, and deliverable names to a list of the
# files. # deliverable files.
self._by_team_and_series = collections.defaultdict(list) self._by_team_and_series = collections.defaultdict(list)
self._by_series = collections.defaultdict(list) self._by_series = collections.defaultdict(list)
self._by_deliverable_name = collections.defaultdict(list)
# Map filenames to parsed content. # Map filenames to parsed content.
self._by_filename = {} self._by_filename = {}
@ -143,6 +144,8 @@ class Deliverables(object):
self._by_series[series].append(filename) self._by_series[series].append(filename)
self._team_deliverables[team].add(deliverable) self._team_deliverables[team].add(deliverable)
self._team_series[team].add(series) self._team_series[team].add(series)
deliv = self._deliverable_from_filename(filename)
self._by_deliverable_name[deliv].append(filename)
def get_team_deliverables(self, team): def get_team_deliverables(self, team):
"Returns a list of deliverable names produced by the team." "Returns a list of deliverable names produced by the team."
@ -179,6 +182,17 @@ class Deliverables(object):
self._by_filename.get(filename, {}), self._by_filename.get(filename, {}),
) )
def get_deliverable_history(self, name):
"""Return info associated with a deliverable name.
"""
for filename in self._by_deliverable_name.get(name, []):
yield (
None,
self._series_from_filename(filename),
self._deliverable_from_filename(filename),
self._by_filename.get(filename, {}),
)
class Deliverable(object): class Deliverable(object):

View File

@ -33,6 +33,7 @@ console_scripts =
make-dashboard = openstack_releases.cmds.dashboard:main make-dashboard = openstack_releases.cmds.dashboard:main
init-series = openstack_releases.cmds.init_series:main init-series = openstack_releases.cmds.init_series:main
list-liaisons = openstack_releases.wiki:main list-liaisons = openstack_releases.wiki:main
get-deliverable-owner = openstack_releases.cmds.get_deliverable_owner:main
[extras] [extras]
sphinxext = sphinxext =