Commit d466fd8b authored by Guido Trotter's avatar Guido Trotter

Improve check for "unreleased" versions in NEWS

Currently this is checked only when distcheck-release is called.
Check it in check-news instead, for all versions before the "current"
one (as defined by configure.ac)
Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarMichele Tartara <mtartara@google.com>
parent 811f8b31
......@@ -1624,7 +1624,7 @@ check-local: check-dirs $(GENERATED_FILES)
$(CHECK_PYTHON_CODE) $(check_python_code)
PYTHONPATH=. $(CHECK_HEADER) $(check_python_code)
$(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS
$(CHECK_NEWS) < $(top_srcdir)/NEWS
RELEASE=$(PACKAGE_VERSION) $(CHECK_NEWS) < $(top_srcdir)/NEWS
PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(CHECK_IMPORTS) . $(standalone_python_modules)
@expver=$(VERSION_MAJOR).$(VERSION_MINOR); \
error= ; \
......@@ -1765,18 +1765,12 @@ distcheck-hook:
echo "Found empty files or directories in final archive." 1>&2; \
exit 1; \
fi
if test -n "$(BUILD_RELEASE)" && \
grep -n -H -E '^\*.*unreleased' $(top_distdir)/NEWS; then \
echo "Found unreleased version in NEWS." >&2; \
exit 1; \
fi
if test -e $(top_distdir)/doc/man-html; then \
echo "Found documentation including man pages in final archive" >&2; \
exit 1; \
fi
# When building a release, stricter checks should be used
distcheck-release dist-release: export BUILD_RELEASE = 1
# Backwards compatible distcheck-release target
distcheck-release: distcheck
distrebuildcheck: dist
......
......@@ -32,13 +32,14 @@ import datetime
import locale
import fileinput
import re
import os
DASHES_RE = re.compile(r"^\s*-+\s*$")
RELEASED_RE = re.compile(r"^\*\(Released (?P<day>[A-Z][a-z]{2}),"
r" (?P<date>.+)\)\*$")
UNRELEASED_RE = re.compile(r"^\*\(unreleased\)\*$")
VERSION_RE = re.compile(r"^Version \d+(\.\d+)+( (beta|rc)\d+)?$")
VERSION_RE = re.compile(r"^Version (\d+(\.\d+)+( (beta|rc)\d+)?)$")
#: How many days release timestamps may be in the future
TIMESTAMP_FUTURE_DAYS_MAX = 3
......@@ -73,17 +74,36 @@ def main():
if curlocale != (None, None):
Error("Invalid locale %s" % curlocale)
# Get the release version, but replace "~" with " " as the version
# in the NEWS file uses spaces for beta and rc releases.
release = os.environ.get('RELEASE', "").replace("~", " ")
prevline = None
expect_date = False
count_empty = 0
allow_unreleased = True
found_versions = set()
for line in fileinput.input():
line = line.rstrip("\n")
if VERSION_RE.match(line):
version_match = VERSION_RE.match(line)
if version_match:
ReqNLines(2, count_empty, fileinput.filelineno(), line)
if UNRELEASED_RE.match(line) or RELEASED_RE.match(line):
version = version_match.group(1)
if version in found_versions:
Error("Line %s: Duplicate release %s found" %
(fileinput.filelineno(), version))
found_versions.add(version)
if version == release:
allow_unreleased = False
unreleased_match = UNRELEASED_RE.match(line)
if unreleased_match and not allow_unreleased:
Error("Line %s: Unreleased version after current release %s" %
(fileinput.filelineno(), release))
if unreleased_match or RELEASED_RE.match(line):
ReqNLines(1, count_empty, fileinput.filelineno(), line)
if line:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment