Skip to content
Snippets Groups Projects
Commit 1657353c authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

check-news: Ensure release date is within three days


Commit b6ad806f contained a date a month in the future. With this patch
all release dates in NEWS may at most be three days into the future
(assuming the build machine's clock is correct).

Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent b5a21c81
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/python
#
# Copyright (C) 2011, 2012 Google Inc.
# Copyright (C) 2011, 2012, 2013 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -40,6 +40,9 @@ RELEASED_RE = re.compile(r"^\*\(Released (?P<day>[A-Z][a-z]{2}),"
UNRELEASED_RE = re.compile(r"^\*\(unreleased\)\*$")
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
errors = []
......@@ -115,6 +118,13 @@ def main():
# would return an inconsistent result if the weekday is incorrect.
parsed_ts = time.mktime(time.strptime(m.group("date"), "%d %b %Y"))
parsed = datetime.date.fromtimestamp(parsed_ts)
today = datetime.date.today()
if (parsed - datetime.timedelta(TIMESTAMP_FUTURE_DAYS_MAX)) > today:
Error("Line %s: %s is more than %s days in the future (today is %s)" %
(fileinput.filelineno(), parsed, TIMESTAMP_FUTURE_DAYS_MAX,
today))
weekday = parsed.strftime("%a")
# Check weekday
......
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