Skip to content

Commit bab0b0c

Browse files
committed
CHANGES file must have a valid version and date
It must appear on the third line. This will prevent accidentally dropping the date. The missing dates have been messing up the version number generation for pkg-config processing. See google#1529
1 parent 5375972 commit bab0b0c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

utils/update_build_version.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,16 @@ def deduce_software_version(directory):
7272
"""
7373

7474
# Match the first well-formed version-and-date line.
75+
# It must be on the third line, and it must have an ISO date.
7576
# Allow trailing whitespace in the checked-out source code has
7677
# unexpected carriage returns on a linefeed-only system such as
7778
# Linux.
7879
pattern = re.compile(r'^(v\d+\.\d+(-dev|[\.-]rc\d+)?) \d\d\d\d-\d\d-\d\d\s*$')
7980
changes_file = os.path.join(directory, 'CHANGES')
8081
with open(changes_file, errors='replace') as f:
81-
for line in f.readlines():
82-
match = pattern.match(line)
82+
lines = f.readlines()[2:]
83+
if len(lines) > 0:
84+
match = pattern.match(lines[0])
8385
if match:
8486
return match.group(1)
8587
raise Exception('No version number found in {}'.format(changes_file))

0 commit comments

Comments
 (0)