#!/usr/bin/env python # # 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. """Import the history for the project Use launchpad as the canonical source of version numbers. """ from __future__ import print_function from __future__ import unicode_literals from openstack_releases.versionutils import canonical_version import argparse import os import re import subprocess import sys from launchpadlib.launchpad import Launchpad def abort(code, errmsg): print(errmsg, file=sys.stderr) sys.exit(code) # Argument parsing parser = argparse.ArgumentParser() parser.add_argument('project', help='launchpad project name') parser.add_argument('repo', nargs='+', help='repository directory') parser.add_argument('--series', help='series to scan') parser.add_argument('--release-type', dest='release_type', default='std', help=('Which release-type to use for this deliverable ' '(Default: %(default)s)')) args = parser.parse_args() # Connect to LP print("connecting to launchpad") try: launchpad = Launchpad.login_with('openstack-releasing', 'production') except Exception, error: abort(2, 'Could not connect to Launchpad: ' + str(error)) # Retrieve project try: project = launchpad.projects[args.project] except KeyError: abort(2, ' Could not find project: %s' % args.project) series_data = {} BASE_URL = 'http://git.openstack.org/cgit/openstack/%s/tag/?id=%s' PATTERN = re.compile(r'tag name[^(]*\(([^)]*)\)', re.MULTILINE) #