From 5da68dfe562b521a72a9e321d68f1575c9aaf0d9 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Tue, 24 Oct 2017 17:35:34 -0400 Subject: [PATCH] add wheel checks to missing-releases Extend the command we use to audit release artifacts so it checks for wheels. Change-Id: If0b2d6a3cb05830a80289462181c3506d92102b9 Signed-off-by: Doug Hellmann --- openstack_releases/cmds/missing.py | 71 +++++++++++++++++++++++------- openstack_releases/links.py | 22 +++++++++ 2 files changed, 77 insertions(+), 16 deletions(-) diff --git a/openstack_releases/cmds/missing.py b/openstack_releases/cmds/missing.py index b82437d376..03d1576794 100644 --- a/openstack_releases/cmds/missing.py +++ b/openstack_releases/cmds/missing.py @@ -34,6 +34,19 @@ from openstack_releases import yamlutils urllib3.disable_warnings() +def check_url(type, url): + if links.link_exists(url): + print(' found {}'.format(type)) + else: + print(' did not find {} {}'.format(type, url)) + yield 'missing {} {}'.format(type, url) + + +def check_signed_file(type, url): + for item_type, item in [(type, url), (type + ' signature', url + '.asc')]: + yield from check_url(item_type, item) + + def main(): parser = argparse.ArgumentParser() parser.add_argument( @@ -95,16 +108,16 @@ def main(): # case is an error because sometimes we want to # import history and sometimes we want to make new # releases. - print('%s %s' % (project['repo'], release['version']), end=' ') + print('%s %s' % (project['repo'], release['version'])) if not args.artifacts: version_exists = gitutils.tag_exists( project['repo'], release['version'], ) if version_exists: - print('tag:found', end=' ') + print(' tag:found') else: - print('tag:MISSING', end=' ') + print(' tag:MISSING') errors.append('%s missing tag %s' % (project['repo'], release['version'])) @@ -112,19 +125,45 @@ def main(): # report if that exists. if link_mode == 'tarball': tb_url = links.tarball_url(release['version'], project) - if links.link_exists(tb_url): - print('tarball:found', end=' ') - else: - print('tarball:MISSING\n%s' % tb_url) - errors.append('%s missing tarball %s' % - (filename, tb_url)) - sig_url = links.signature_url(release['version'], project) - if links.link_exists(sig_url): - print('signature:found', end=' ') - else: - print('signature:MISSING\n%s' % sig_url) - errors.append('%s missing signature %s' % - (filename, sig_url)) + errors.extend(check_signed_file('tarball', tb_url)) + wheel_2_errors = list( + check_url( + 'python 2 wheel', + links.wheel_py2_url(release['version'], project) + ) + ) + wheel_both_errors = list( + check_url( + 'python 2/3 wheel', + links.wheel_both_url(release['version'], project) + ) + ) + # We only expect to find one wheel. Look for both, + # and minimize what we report as errors. + if wheel_2_errors and wheel_both_errors: + # We have neither wheel. + errors.extend(wheel_2_errors) + errors.extend(wheel_both_errors) + elif not wheel_both_errors: + # We have the "both" wheel, so check for the + # signature file. + errors.extend( + check_url( + 'python 2/3 wheel signature', + links.wheel_both_url(release['version'], + project) + '.asc', + ) + ) + elif not wheel_2_errors: + # We have the py2 wheel, so check for the + # signature file. + errors.extend( + check_url( + 'python 2 wheel signature', + links.wheel_py2_url(release['version'], + project) + '.asc', + ) + ) print() if errors: diff --git a/openstack_releases/links.py b/openstack_releases/links.py index 4fd62fc3f4..73dddfd3c0 100644 --- a/openstack_releases/links.py +++ b/openstack_releases/links.py @@ -42,6 +42,28 @@ def tarball_url(version, project): ) +def wheel_py2_url(version, project): + repo_base = project['repo'].rsplit('/')[-1] + base = project.get('tarball-base', repo_base) + return '{s}/{r}/{n}-{v}-py2-none-any.whl'.format( + s='https://tarballs.openstack.org', + v=version, + r=repo_base, + n=base, + ) + + +def wheel_both_url(version, project): + repo_base = project['repo'].rsplit('/')[-1] + base = project.get('tarball-base', repo_base) + return '{s}/{r}/{n}-{v}-py2.py3-none-any.whl'.format( + s='https://tarballs.openstack.org', + v=version, + r=repo_base, + n=base, + ) + + def artifact_link(version, project, deliverable_info): mode = deliverable_info.get('artifact-link-mode', 'tarball') if mode == 'tarball':