add latest-deliverable-versions command

Show all of the repositories in a series and the latest versions
associated with them.

Change-Id: I8f0360032b4e0e4ec072607b8aba032c3a0c88fc
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2016-04-18 10:21:25 -04:00
parent 263e30cbf8
commit 0c9ee711c8
3 changed files with 80 additions and 0 deletions

View File

@ -370,6 +370,15 @@ of the repositories, filtered by team and/or tag.
list-repos --team oslo
list-repos --tag release:managed --tag type:library
latest-deliverable-versions
---------------------------
Show each repository and the latest tag recorded in the deliverable
file associated with that repo.
::
latest-deliverable-versions -r ~/repos/openstack/releases mitaka
update_git_review.sh
--------------------

View File

@ -0,0 +1,70 @@
# All Rights Reserved.
#
# 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 glob
import os.path
import yaml
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
'--releases-repo', '-r',
default='.',
help='path to the releases repository for automatic scanning',
)
parser.add_argument(
'--verbose', '-v',
action='store_true',
default=False,
help='produce detailed output',
)
parser.add_argument(
'series',
help='the name of the release series to work on'
)
args = parser.parse_args()
deliverables_dir = os.path.join(args.releases_repo, 'deliverables')
if not os.path.exists(deliverables_dir):
parser.error('{} does not exist'.format(deliverables_dir))
pattern = os.path.join(deliverables_dir,
args.series, '*.yaml')
if args.verbose:
print('Scanning {}'.format(pattern))
deliverable_files = sorted(glob.glob(pattern))
for filename in deliverable_files:
if args.verbose:
print('\n{}'.format(filename))
with open(filename, 'r') as f:
deliverable_data = yaml.safe_load(f)
releases = deliverable_data.get('releases')
if not releases:
if args.verbose:
print('# no releases')
continue
latest_release = releases[-1]
projects = latest_release.get('projects')
if not projects:
if args.verbose:
print('# no projects')
continue
for p in latest_release['projects']:
print('{} {}'.format(p['repo'], latest_release['version']))

View File

@ -38,3 +38,4 @@ console_scripts =
batch-stable-branches = releasetools.cmds.batch_create_stable_branches:main
update-reviews = releasetools.cmds.update_reviews:main
propose-final-releases = releasetools.cmds.propose_final_releases:main
latest-deliverable-versions = releasetools.cmds.latest_deliverable_versions:main