Revision d466fd8b

b/Makefile.am
1624 1624
	$(CHECK_PYTHON_CODE) $(check_python_code)
1625 1625
	PYTHONPATH=. $(CHECK_HEADER) $(check_python_code)
1626 1626
	$(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS
1627
	$(CHECK_NEWS) < $(top_srcdir)/NEWS
1627
	RELEASE=$(PACKAGE_VERSION) $(CHECK_NEWS) < $(top_srcdir)/NEWS
1628 1628
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(CHECK_IMPORTS) . $(standalone_python_modules)
1629 1629
	@expver=$(VERSION_MAJOR).$(VERSION_MINOR); \
1630 1630
	error= ; \
......
1765 1765
	  echo "Found empty files or directories in final archive." 1>&2; \
1766 1766
	  exit 1; \
1767 1767
	fi
1768
	if test -n "$(BUILD_RELEASE)" && \
1769
	   grep -n -H -E '^\*.*unreleased' $(top_distdir)/NEWS; then \
1770
	   echo "Found unreleased version in NEWS." >&2; \
1771
	   exit 1; \
1772
	fi
1773 1768
	if test -e $(top_distdir)/doc/man-html; then \
1774 1769
	  echo "Found documentation including man pages in final archive" >&2; \
1775 1770
	  exit 1; \
1776 1771
	fi
1777 1772

  
1778
# When building a release, stricter checks should be used
1779
distcheck-release dist-release: export BUILD_RELEASE = 1
1773
# Backwards compatible distcheck-release target
1780 1774
distcheck-release: distcheck
1781 1775

  
1782 1776
distrebuildcheck: dist
b/autotools/check-news
32 32
import locale
33 33
import fileinput
34 34
import re
35
import os
35 36

  
36 37

  
37 38
DASHES_RE = re.compile(r"^\s*-+\s*$")
38 39
RELEASED_RE = re.compile(r"^\*\(Released (?P<day>[A-Z][a-z]{2}),"
39 40
                         r" (?P<date>.+)\)\*$")
40 41
UNRELEASED_RE = re.compile(r"^\*\(unreleased\)\*$")
41
VERSION_RE = re.compile(r"^Version \d+(\.\d+)+( (beta|rc)\d+)?$")
42
VERSION_RE = re.compile(r"^Version (\d+(\.\d+)+( (beta|rc)\d+)?)$")
42 43

  
43 44
#: How many days release timestamps may be in the future
44 45
TIMESTAMP_FUTURE_DAYS_MAX = 3
......
73 74
  if curlocale != (None, None):
74 75
    Error("Invalid locale %s" % curlocale)
75 76

  
77
  # Get the release version, but replace "~" with " " as the version
78
  # in the NEWS file uses spaces for beta and rc releases.
79
  release = os.environ.get('RELEASE', "").replace("~", " ")
80

  
76 81
  prevline = None
77 82
  expect_date = False
78 83
  count_empty = 0
84
  allow_unreleased = True
85
  found_versions = set()
79 86

  
80 87
  for line in fileinput.input():
81 88
    line = line.rstrip("\n")
82 89

  
83
    if VERSION_RE.match(line):
90
    version_match = VERSION_RE.match(line)
91
    if version_match:
84 92
      ReqNLines(2, count_empty, fileinput.filelineno(), line)
85

  
86
    if UNRELEASED_RE.match(line) or RELEASED_RE.match(line):
93
      version = version_match.group(1)
94
      if version in found_versions:
95
        Error("Line %s: Duplicate release %s found" %
96
              (fileinput.filelineno(), version))
97
      found_versions.add(version)
98
      if version == release:
99
        allow_unreleased = False
100

  
101
    unreleased_match = UNRELEASED_RE.match(line)
102
    if unreleased_match and not allow_unreleased:
103
      Error("Line %s: Unreleased version after current release %s" %
104
            (fileinput.filelineno(), release))
105

  
106
    if unreleased_match or RELEASED_RE.match(line):
87 107
      ReqNLines(1, count_empty, fileinput.filelineno(), line)
88 108

  
89 109
    if line:

Also available in: Unified diff