Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the release script. #6629

Merged
merged 2 commits into from
Oct 14, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build-support/bin/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ elif [[ "${test_release}" == "true" ]]; then
else
banner "Releasing packages to PyPi" && \
(
check_origin && check_clean_branch && check_pgp && check_owners && \
Copy link
Sponsor Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooops yes, that was sloppy. In my defense, it was Saturday night...

check_origin && check_pgp && check_owners && \
publish_packages && tag_release && publish_docs_if_master && \
banner "Successfully released packages to PyPi"
) || die "Failed to release packages to PyPi."
Expand Down
30 changes: 5 additions & 25 deletions src/docs/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ script fail:

- **Get your pypi account added as an `owner` for all pantsbuild.pants packages.**

You can ask any one of the [Owners](#owners) listed below to do this.
Once this is done and you've performed your 1st release, add yourself to
the [Owners](#owners) section below.
You can ask any one of the current [Owners](#owners) to do this.

- **Configure your pypi credentials locally in `~/.pypirc`**

Expand Down Expand Up @@ -194,39 +192,21 @@ if the tag for the prior release (eg: release_0.0.33)
:::bash
$ ./build-support/bin/contributors.sh -s <tag>

Listing Packages and Owners
<a name="owners"></a>Listing Packages and Owners
------

The current list of packages can be obtained via :

:::bash
$ ./build-support/bin/release.sh -l

Right now that's:

- pantsbuild.pants
- pantsbuild.pants.contrib.avro
- pantsbuild.pants.contrib.buildgen
- pantsbuild.pants.contrib.codeanalysis
- pantsbuild.pants.contrib.confluence
- pantsbuild.pants.contrib.cpp
- pantsbuild.pants.contrib.errorprone
- pantsbuild.pants.contrib.findbugs
- pantsbuild.pants.contrib.go
- pantsbuild.pants.contrib.googlejavaformat
- pantsbuild.pants.contrib.jax_ws
- pantsbuild.pants.contrib.mypy
- pantsbuild.pants.contrib.node
- pantsbuild.pants.contrib.python.checks
- pantsbuild.pants.contrib.scalajs
- pantsbuild.pants.contrib.scrooge
- pantsbuild.pants.contrib.thrifty
- pantsbuild.pants.testinfra

You can run the following to get a full ownership roster for each
package :

:::bash
$ ./build-support/bin/release.sh -o

We generally expect all packages to have the same set of owners, which you can
view [here](https://pypi.org/project/pantsbuild.pants/).

[needs-cherrypick]: https://github.com/pantsbuild/pants/pulls?q=is%3Apr+label%3Aneeds-cherrypick
22 changes: 17 additions & 5 deletions src/python/pants/releases/reversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import fnmatch
import glob
import hashlib
import json
import os
import re
import zipfile
from builtins import open, str

Expand Down Expand Up @@ -89,6 +89,11 @@ def rewrite_record_file(workspace, src_record_file, mutated_file_tuples):
safe_file_dump(os.path.join(workspace, dst_record_file), '\r\n'.join(output_records) + '\r\n', binary_mode=False)


# The wheel METADATA file will contain a line like: `Version: 1.11.0.dev3+7951ec01`.
# We don't parse the entire file because it's large (it contains the entire release notes history).
_version_re = re.compile('Version: (?P<version>\S+)')


def reversion(args):
with temporary_dir() as workspace:
# Extract the input.
Expand All @@ -100,10 +105,17 @@ def reversion(args):
dist_info_dir = locate_dist_info_dir(workspace)
record_file = os.path.join(dist_info_dir, 'RECORD')

# Load metadata for the input whl.
with open(os.path.join(workspace, dist_info_dir, 'metadata.json'), 'r') as info:
metadata = json.load(info)
input_version = metadata['version']
# Get version from the input whl's metadata.
input_version = None
metadata_file = os.path.join(workspace, dist_info_dir, 'METADATA')
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there value in continuing to support rewriting both formats?

Copy link
Sponsor Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, this is just where we get the original, qualified, version from. And the METADATA file is part of the wheel spec , so it was always OK to get the version from there.

with open(metadata_file, 'r') as info:
for line in info:
mo = _version_re.match(line)
if mo:
input_version = mo.group('version')
break
if not input_version:
raise Exception('Could not find `Version:` line in {}'.format(metadata_file))

# Rewrite and move all files (including the RECORD file), recording which files need to be
# re-fingerprinted due to content changes.
Expand Down