Skip to content
Snippets Groups Projects
Commit d466fd8b authored by Guido Trotter's avatar Guido Trotter
Browse files

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
No related branches found
No related tags found
No related merge requests found
...@@ -1624,7 +1624,7 @@ check-local: check-dirs $(GENERATED_FILES) ...@@ -1624,7 +1624,7 @@ check-local: check-dirs $(GENERATED_FILES)
$(CHECK_PYTHON_CODE) $(check_python_code) $(CHECK_PYTHON_CODE) $(check_python_code)
PYTHONPATH=. $(CHECK_HEADER) $(check_python_code) PYTHONPATH=. $(CHECK_HEADER) $(check_python_code)
$(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS $(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) PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(CHECK_IMPORTS) . $(standalone_python_modules)
@expver=$(VERSION_MAJOR).$(VERSION_MINOR); \ @expver=$(VERSION_MAJOR).$(VERSION_MINOR); \
error= ; \ error= ; \
...@@ -1765,18 +1765,12 @@ distcheck-hook: ...@@ -1765,18 +1765,12 @@ distcheck-hook:
echo "Found empty files or directories in final archive." 1>&2; \ echo "Found empty files or directories in final archive." 1>&2; \
exit 1; \ exit 1; \
fi 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 \ if test -e $(top_distdir)/doc/man-html; then \
echo "Found documentation including man pages in final archive" >&2; \ echo "Found documentation including man pages in final archive" >&2; \
exit 1; \ exit 1; \
fi fi
# When building a release, stricter checks should be used # Backwards compatible distcheck-release target
distcheck-release dist-release: export BUILD_RELEASE = 1
distcheck-release: distcheck distcheck-release: distcheck
distrebuildcheck: dist distrebuildcheck: dist
......
...@@ -32,13 +32,14 @@ import datetime ...@@ -32,13 +32,14 @@ import datetime
import locale import locale
import fileinput import fileinput
import re import re
import os
DASHES_RE = re.compile(r"^\s*-+\s*$") DASHES_RE = re.compile(r"^\s*-+\s*$")
RELEASED_RE = re.compile(r"^\*\(Released (?P<day>[A-Z][a-z]{2})," RELEASED_RE = re.compile(r"^\*\(Released (?P<day>[A-Z][a-z]{2}),"
r" (?P<date>.+)\)\*$") r" (?P<date>.+)\)\*$")
UNRELEASED_RE = re.compile(r"^\*\(unreleased\)\*$") 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 #: How many days release timestamps may be in the future
TIMESTAMP_FUTURE_DAYS_MAX = 3 TIMESTAMP_FUTURE_DAYS_MAX = 3
...@@ -73,17 +74,36 @@ def main(): ...@@ -73,17 +74,36 @@ def main():
if curlocale != (None, None): if curlocale != (None, None):
Error("Invalid locale %s" % curlocale) 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 prevline = None
expect_date = False expect_date = False
count_empty = 0 count_empty = 0
allow_unreleased = True
found_versions = set()
for line in fileinput.input(): for line in fileinput.input():
line = line.rstrip("\n") 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) ReqNLines(2, count_empty, fileinput.filelineno(), line)
version = version_match.group(1)
if UNRELEASED_RE.match(line) or RELEASED_RE.match(line): 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) ReqNLines(1, count_empty, fileinput.filelineno(), line)
if line: if line:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment