|
7 | 7 | rm -rf build/ dist/ .eggs/ .tox/
|
8 | 8 |
|
9 | 9 | release: clean
|
10 |
| -# Check if latest tag is the current head we're releasing |
11 |
| -@config_opts="$$(printf ' -c versionsort.suffix=-%s' alpha beta pre rc RC)"&&\ |
| 10 | +# Check that VERSION and changes.rst exist and have no uncommitted changes |
| 11 | +test -f VERSION |
| 12 | +test -f doc/source/changes.rst |
| 13 | +git status -s VERSION doc/source/changes.rst |
| 14 | +@test -z"$$(git status -s VERSION doc/source/changes.rst)" |
| 15 | + |
| 16 | +# Check that ALL changes are commited (can comment out if absolutely necessary) |
| 17 | +git status -s |
| 18 | +@test -z "$$(git status -s)" |
| 19 | + |
| 20 | +# Check that latest tag matches version and is the current head we're releasing |
| 21 | +@version_file="$$(cat VERSION)" && \ |
| 22 | +changes_file="$$(awk '/^[0-9]/ {print $$0; exit}' doc/source/changes.rst)" && \ |
| 23 | +config_opts="$$(printf ' -c versionsort.suffix=-%s' alpha beta pre rc RC)" && \ |
12 | 24 | latest_tag=$$(git $$config_opts tag -l '[0-9]*' --sort=-v:refname | head -n1) && \
|
13 | 25 | head_sha=$$(git rev-parse HEAD) latest_tag_sha=$$(git rev-parse "$$latest_tag") && \
|
14 |
| -printf'%-14s = %s\n''Latest tag'"$$latest_tag"\ |
| 26 | +printf '%-14s = %s\n' 'VERSION file' "$$version_file" \ |
| 27 | + 'changes.rst' "$$changes_file" \ |
| 28 | + 'Latest tag' "$$latest_tag" \ |
15 | 29 | 'HEAD SHA' "$$head_sha" \
|
16 | 30 | 'Latest tag SHA' "$$latest_tag_sha" && \
|
| 31 | +test "$$version_file" = "$$changes_file" && \ |
| 32 | +test "$$latest_tag" = "$$version_file" && \ |
17 | 33 | test "$$head_sha" = "$$latest_tag_sha"
|
18 | 34 |
|
19 | 35 | make force_release
|
|