add init-series command

Add a command to initialize a new series by copying over the data from
the previous series, without the release or branch specifications.

Change-Id: I97ae78f6ae813ff36084ded82bb36f8769a96816
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2016-12-01 14:46:17 -05:00
parent 86fcd2609c
commit 26b6265ef2
3 changed files with 73 additions and 0 deletions

View File

@ -451,3 +451,5 @@ easy as ``pip install .`` in this repository directory.
* ``make-dashboard`` produces a CSV file that can be imported into
Google docs (or any other spreadsheet) for tracking the
milestone-based projects at the end of the cycle
* ``init-series`` initializes a new deliverable directory with stub
files based on the previous release.

View File

@ -0,0 +1,70 @@
# 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 os.path
import openstack_releases
from openstack_releases import deliverable
import yaml
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
'old_series',
help='the previous release series, such as "newton"',
)
parser.add_argument(
'new_series',
help='the new release series, such as "ocata"',
)
parser.add_argument(
'--deliverables-dir',
default=openstack_releases.deliverable_dir,
help='location of deliverable files',
)
args = parser.parse_args()
all_deliv = deliverable.Deliverables(
root_dir=args.deliverables_dir,
collapse_history=False,
)
new_deliverables = set(
name
for team, series, name, data in
all_deliv.get_deliverables(None, args.new_series)
)
outdir = os.path.join(args.deliverables_dir, args.new_series)
if not os.path.exists(outdir):
print('creating output directory {}'.format(outdir))
os.mkdir(outdir)
old_deliverables = all_deliv.get_deliverables(None, args.old_series)
for team, series, name, data in old_deliverables:
if name in new_deliverables:
continue
# Clean up some series-specific data that should not be copied
# over.
for key in ['releases', 'branches', 'release-notes']:
if key in data:
del data[key]
outfilename = os.path.join(outdir, name + '.yaml')
with open(outfilename, 'w') as f:
print('{} created'.format(outfilename))
f.write('---\n')
yaml.dump(data, f, default_flow_style=False)

View File

@ -31,6 +31,7 @@ console_scripts =
check-diff-start = openstack_releases.cmds.check_diff_start:main
list-deliverables = openstack_releases.cmds.list_deliverables:main
make-dashboard = openstack_releases.cmds.dashboard:main
init-series = openstack_releases.cmds.init_series:main
[extras]
sphinxext =