remove unused tool with launchpadlib dependency

The only reason we have a dependency on launchpadlib and
lazr.restfulclient is for the old tool that imported project history
from launchpad. We no longer need the tool, so we can remove it and the
dependency as part of our python 3 port.

Change-Id: Ie87e6172c953df10cb70d34c9bc23ad30e97ce4d
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2017-03-03 14:35:24 -05:00
parent 5de6c2d024
commit 42e8a6fd7f
3 changed files with 2 additions and 132 deletions

View File

@ -1,13 +1,8 @@
pbr>=1.6 pbr>=1.6
# NOTE(dhellmann): We pin lazr.restfulclient because there is a newer # NOTE(dhellmann): We pin keyring because new releases tend to add
# release registered without a package, and that breaks things. # dependencies for GUI tools that we don't use
lazr.restfulclient==0.13.1
# NOTE(dhellmann): We pin keyring and launchpadlib because new
# releases tend to add dependencies for GUI tools that we don't use
keyring==7.3 keyring==7.3
launchpadlib==1.10.3
requests>=2.5.2 requests>=2.5.2
PyYAML>=3.1.0 PyYAML>=3.1.0

View File

@ -1,123 +0,0 @@
#!/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)
# <tr><td>tag name</td><td>2014.1.5 (44bb894f36c58ba51b6cc64763209f4c97f89206)</td></tr> # noqa
before = os.getcwd()
dev_null = open('/dev/null', 'w')
for repo in args.repo:
os.chdir(repo)
repo_namespace = os.path.basename(os.path.dirname(repo))
repo_short_name = repo_namespace + '/' + os.path.basename(repo)
for series in project.series:
if args.series and series.name != args.series:
print('skipping series %r' % series.name)
continue
for milestone in series.all_milestones:
try:
show_output = subprocess.check_output([
'git', 'show', '--no-patch', '--pretty=%H', milestone.name,
], stderr=dev_null)
sha = show_output.rstrip().splitlines()[-1]
except subprocess.CalledProcessError:
print('did not find milestone %s tagged for %s' %
(milestone.name, repo_short_name))
continue
the_series = series_data.setdefault(series.name, {})
the_milestone = the_series.setdefault(milestone.name, [])
the_milestone.append(
(repo_short_name, sha)
)
os.chdir(before)
for series, milestones in sorted(series_data.items()):
# print(series, milestones)
d = 'deliverables/%s' % series
if not os.path.exists(d):
print('creating directory %s' % d)
os.makedirs(d)
filename = '%s/%s.yaml' % (d, os.path.basename(repo))
print('creating %s' % filename)
with open(filename, 'w') as f:
f.write('---\n')
f.write('launchpad: %s\n' % args.project)
f.write('team: %s\n' % args.project)
f.write('release-type: %s\n' % args.release_type)
f.write('releases:\n')
milestones_sorted = \
sorted(milestones.items(),
key=lambda x: canonical_version(x[0], args.release_type))
for milestone, milestone_data in milestones_sorted:
f.write(' - version: %s\n' % milestone)
f.write(' projects:\n')
for repo_short_name, sha in milestone_data:
f.write(' - repo: %s\n' % repo_short_name)
f.write(' hash: %s\n' % sha)

View File

@ -7,8 +7,6 @@ skipdist = True
usedevelop=True usedevelop=True
passenv=ZUUL_CACHE_DIR passenv=ZUUL_CACHE_DIR
install_command = pip install -U {opts} {packages} install_command = pip install -U {opts} {packages}
--allow-external lazr.authentication
--allow-insecure lazr.authentication
setenv = setenv =
VIRTUAL_ENV={envdir} VIRTUAL_ENV={envdir}
# launchpadlib 0.0.1.dev533 requires lazr.restfulclient, which is # launchpadlib 0.0.1.dev533 requires lazr.restfulclient, which is