Merge "remove latest-deliverable-versions command"

This commit is contained in:
Jenkins 2017-03-06 16:46:24 +00:00 committed by Gerrit Code Review
commit e998d68086
3 changed files with 0 additions and 139 deletions

View File

@ -225,15 +225,6 @@ the change but leaving out the email message boilerplate. This mode
is useful for examining the list of unreleased changes in a project
to decide if a release is warranted and to pick a version number.
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
launchpad-login

View File

@ -1,129 +0,0 @@
# 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 csv
import glob
import os.path
import yaml
def get_latest_deliverable_versions(deliverable_files, verbose):
for filename in deliverable_files:
if verbose:
print('\n{}'.format(filename))
with open(filename, 'r') as f:
deliverable_data = yaml.safe_load(f)
deliverable_name = os.path.basename(filename)[:-5] # drop .yaml
releases = deliverable_data.get('releases')
if not releases:
if verbose:
print('# no releases')
continue
latest_release = releases[-1]
projects = latest_release.get('projects')
if not projects:
if verbose:
print('# no projects')
continue
yield(
(deliverable_data['team'].lower(),
deliverable_name,
latest_release['version'],
filename)
)
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
'--releases-repo', '-r',
default='.',
help='path to the releases repository for automatic scanning',
)
parser.add_argument(
'--dashboard', '-d',
default=None,
help='the name of a CSV file exported from the release dashboard',
)
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))
deliverables = sorted(get_latest_deliverable_versions(
deliverable_files, args.verbose)
)
if args.dashboard:
# Compare the latest version with what is known in the
# dashboard file and report on discrepancies.
with open(args.dashboard, 'r') as f:
reader = csv.DictReader(f)
dash = {
row['Deliverable Name'].lower(): row
for row in reader
}
for team, deliverable, version, filename in deliverables:
dash_info = dash.get(deliverable.lower(), {})
if not dash_info:
print(deliverable, 'NOT IN DASHBOARD')
continue
# Search the version fields for the dashboard in order to
# find the version specified.
not_it = []
for fn in ['Pre-RC1', 'RC1', 'Latest RC']:
if version == dash_info[fn]:
if args.verbose:
print(deliverable, version, fn)
break
not_it.append((fn, dash_info[fn]))
else:
# Report that we have a version later than the most
# recently known version from the dashboard.
for ni in not_it[::-1]:
if ni[1]:
print(
'{} version {} LATER THAN {} version {}'.format(
deliverable,
version,
ni[0],
ni[1],
)
)
break
else:
# Just dump the versions that are found.
for team, deliverable, version, filename in deliverables:
print('{:<25} {}'.format(deliverable, version))

View File

@ -35,4 +35,3 @@ console_scripts =
launchpad-login = releasetools.cmds.launchpad_login:main
send-mail = releasetools.cmds.mail:main
update-reviews = releasetools.cmds.update_reviews:main
latest-deliverable-versions = releasetools.cmds.latest_deliverable_versions:main