subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1668052 - /subversion/trunk/tools/dist/release.py
Date Fri, 20 Mar 2015 15:28:44 GMT
Author: brane
Date: Fri Mar 20 15:28:43 2015
New Revision: 1668052

URL: http://svn.apache.org/r1668052
Log:
Follow up to r1667990, make the copyright year check more
complete and a bit faster.

* tools/dist/release.py
  (_current_year, _copyright_re): New.
  (check_copyright_year):
   Search the whole file contents in one go; no need to split it
   into separate lines first. Look at subversion/libsvn_subr/version.c
   as well as the NOTICE file.

Modified:
    subversion/trunk/tools/dist/release.py

Modified: subversion/trunk/tools/dist/release.py
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dist/release.py?rev=1668052&r1=1668051&r2=1668052&view=diff
==============================================================================
--- subversion/trunk/tools/dist/release.py (original)
+++ subversion/trunk/tools/dist/release.py Fri Mar 20 15:28:43 2015
@@ -421,16 +421,28 @@ def compare_changes(repos, branch, revis
       logging.warning('CHANGES has unmerged revisions: %s' %
                       stdout.replace("\n", " "))
 
+
+_current_year = str(datetime.datetime.now().year)
+_copyright_re = re.compile(r'Copyright (?:\(C\) )?(?P<year>[0-9]+)'
+                           r' The Apache Software Foundation',
+                           re.MULTILINE)
+
 def check_copyright_year(repos, branch, revision):
-    cat_cmd = ['svn', 'cat', repos + '/' + branch + '/NOTICE@' + str(revision)]
-    stdout = subprocess.check_output(cat_cmd)
-    year = None
-    for line in stdout.split('\n'):
-      m = re.match('Copyright ([0-9]+) The Apache Software Foundation', line)
-      if m:
-        year = m.group(1)
-    if year == None or year != str(datetime.datetime.now().year):
-      logging.warning('NOTICE does not contain current year')
+    def check_file(branch_relpath):
+        file_url = (repos + '/' + branch + '/'
+                    + branch_relpath + '@' + str(revision))
+        cat_cmd = ['svn', 'cat', file_url]
+        stdout = subprocess.check_output(cat_cmd)
+        m = _copyright_re.search(stdout)
+        if m:
+            year = m.group('year')
+        else:
+            year = None
+        if year != _current_year:
+            logging.warning('Copyright year in ' + branch_relpath
+                            + ' is not the current year')
+    check_file('NOTICE')
+    check_file('subversion/libsvn_subr/version.c')
 
 def roll_tarballs(args):
     'Create the release artifacts.'



Mime
View raw message