* [committed] 2011 and 2012 Copyright year updates @ 2013-01-04 12:54 Jakub Jelinek 2013-01-04 16:44 ` Andrew Pinski 0 siblings, 1 reply; 18+ messages in thread From: Jakub Jelinek @ 2013-01-04 12:54 UTC (permalink / raw) To: gcc-patches [-- Attachment #1: Type: text/plain, Size: 375 bytes --] Hi! I've run a script to notice gcc maintained files with FSF copyright that have been modified in 2011 and/or 2012 (according to svn log, ignoring r168438 and r184997 commits), but didn't have years 2011 and/or 2012 included in Copyright lines. I've kept the preexisting style, so where year ranges were used, updated those if needed, if not, kept the year lists. Jakub [-- Attachment #2: Copyright.updates.bz2 --] [-- Type: application/x-bzip2, Size: 37321 bytes --] ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [committed] 2011 and 2012 Copyright year updates 2013-01-04 12:54 [committed] 2011 and 2012 Copyright year updates Jakub Jelinek @ 2013-01-04 16:44 ` Andrew Pinski 2013-01-04 16:49 ` Jakub Jelinek 0 siblings, 1 reply; 18+ messages in thread From: Andrew Pinski @ 2013-01-04 16:44 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches On Fri, Jan 4, 2013 at 4:54 AM, Jakub Jelinek <jakub@redhat.com> wrote: > Hi! > > I've run a script to notice gcc maintained files with FSF copyright that > have been modified in 2011 and/or 2012 (according to svn log, ignoring > r168438 and r184997 commits), but didn't have years 2011 and/or 2012 > included in Copyright lines. I've kept the preexisting style, so > where year ranges were used, updated those if needed, if not, kept the > year lists. Can't we just move to ranges of years now that the FSF approves of them. They even approve of ranges where a file was not touched during that year. This seems better than listing all the years out. Thanks, Andrew ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [committed] 2011 and 2012 Copyright year updates 2013-01-04 16:44 ` Andrew Pinski @ 2013-01-04 16:49 ` Jakub Jelinek 2013-01-06 12:14 ` Richard Sandiford 0 siblings, 1 reply; 18+ messages in thread From: Jakub Jelinek @ 2013-01-04 16:49 UTC (permalink / raw) To: Andrew Pinski; +Cc: gcc-patches On Fri, Jan 04, 2013 at 08:44:13AM -0800, Andrew Pinski wrote: > On Fri, Jan 4, 2013 at 4:54 AM, Jakub Jelinek <jakub@redhat.com> wrote: > > I've run a script to notice gcc maintained files with FSF copyright that > > have been modified in 2011 and/or 2012 (according to svn log, ignoring > > r168438 and r184997 commits), but didn't have years 2011 and/or 2012 > > included in Copyright lines. I've kept the preexisting style, so > > where year ranges were used, updated those if needed, if not, kept the > > year lists. > > Can't we just move to ranges of years now that the FSF approves of > them. They even approve of ranges where a file was not touched during > that year. This seems better than listing all the years out. If somebody is willing to do the conversion, sure, but even with some scripting that is going to be lots of work. Even this patch took more than 6 hours of svn log, some scripting and a few hours of manual work, while the conversion would take IMHO more than that. Jakub ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [committed] 2011 and 2012 Copyright year updates 2013-01-04 16:49 ` Jakub Jelinek @ 2013-01-06 12:14 ` Richard Sandiford 2013-01-06 12:44 ` Jakub Jelinek ` (2 more replies) 0 siblings, 3 replies; 18+ messages in thread From: Richard Sandiford @ 2013-01-06 12:14 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Andrew Pinski, gcc-patches [-- Attachment #1: Type: text/plain, Size: 1757 bytes --] Jakub Jelinek <jakub@redhat.com> writes: > On Fri, Jan 04, 2013 at 08:44:13AM -0800, Andrew Pinski wrote: >> On Fri, Jan 4, 2013 at 4:54 AM, Jakub Jelinek <jakub@redhat.com> wrote: >> > I've run a script to notice gcc maintained files with FSF copyright that >> > have been modified in 2011 and/or 2012 (according to svn log, ignoring >> > r168438 and r184997 commits), but didn't have years 2011 and/or 2012 >> > included in Copyright lines. I've kept the preexisting style, so >> > where year ranges were used, updated those if needed, if not, kept the >> > year lists. >> >> Can't we just move to ranges of years now that the FSF approves of >> them. They even approve of ranges where a file was not touched during >> that year. This seems better than listing all the years out. > > If somebody is willing to do the conversion, sure, but even with some > scripting that is going to be lots of work. > > Even this patch took more than 6 hours of svn log, some scripting and a few > hours of manual work, while the conversion would take IMHO more than that. I never remember to update the copyright years, so I thought I'd have a go. And you were right of course. It ended up being a huge time sink. Anyway, here's my attempt a script to convert to ranges and, if enabled, to include the current year. The script only updates FSF copyright notices and leaves others alone. I've tried my best to make sure that licences and imported FSF sources aren't touched, but I could have missed some cases. I've also attached a bzip2 patch of the gcc/ and fixincludes/ part. This patch converts to ranges but doesn't add 2013. I can add 2013 at the same time, separately or not at all; let me know. Please don't laugh at my attempt at Python... Richard [-- Attachment #2: copyright.py --] [-- Type: text/plain, Size: 23033 bytes --] #!/usr/bin/python import os import re import sys import time import subprocess class Errors: def __init__ (self): self.num_errors = 0 def report (self, filename, string): if filename: string = filename + ': ' + string sys.stderr.write (string + '\n') self.num_errors += 1 def ok (self): return self.num_errors == 0 class GenericFilter: def __init__ (self): self.skip_files = set() self.skip_dirs = set() self.skip_extensions = set() self.own_files = set() self.skip_files |= set ([ # Skip licence files. 'COPYING', 'COPYING.LIB', 'COPYING3', 'COPYING3.LIB' 'LICENSE', 'fdl.texi', 'gpl_v3.texi', 'fdl-1.3.xml', 'gpl-3.0.xml', # Skip auto- and libtool-related files 'aclocal.m4', 'compile', 'config.guess', 'config.sub', 'depcomp', 'install-sh', 'libtool.m4', 'ltmain.sh', 'ltoptions.m4', 'ltsugar.m4', 'ltversion.m4', 'lt~obsolete.m4', 'missing', 'mkdep', 'mkinstalldirs', 'move-if-change', 'shlibpath.m4', 'symlink-tree', 'ylwrap', # Skip FSF mission statement, etc. 'gnu.texi', 'funding.texi', 'appendix_free.xml', # Skip imported texinfo files. 'texinfo.tex', ]) def get_line_filter (self, dir, filename): if filename.startswith ('ChangeLog'): # Ignore references to copyright in changelog entries. return re.compile ('\t') return None def skip_file (self, dir, filename): if filename in self.skip_files: return True (base, extension) = os.path.splitext (filename) if extension in self.skip_extensions: return True if extension == '.in': # Skip .in files produced by automake. if os.path.exists (base + '.am'): return True # Skip files produced by autogen if (os.path.exists (base + '.def') and os.path.exists (base + '.tpl')): return True # Skip configure files produced by autoconf if filename == 'configure': if os.path.exists (base + '.ac'): return True if os.path.exists (base + '.in'): return True return False def skip_dir (self, dir, subdir): return subdir in self.skip_dirs def by_package_author (self, dir, filename): return filename in self.own_files class Copyright: def __init__ (self, errors): self.errors = errors # Characters in a range of years. Include '.' for typos. ranges = '[0-9](?:[-0-9.,\s]|\s+and\s+)*[0-9]' # Non-whitespace characters in a copyright holder's name. name = '[\w.,-]' # Matches one year. self.year_re = re.compile ('[0-9]+') # Matches part of a year or copyright holder. self.continuation_re = re.compile (ranges + '|' + name) # Matches a full copyright notice: self.copyright_re = re.compile ( # 1: 'Copyright (C)', etc. '([Cc]opyright' '|[Cc]opyright\s+\([Cc]\)' '|[Cc]opyright\s+%s' '|[Cc]opyright\s+©' '|[Cc]opyright\s+@copyright{}' '|@set\s+copyright[\w-]+)' # 2: the years. Include the whitespace in the year, so that # we can remove any excess. '(\s*(?:' + ranges + ',?' '|@value\{[^{}]*\})\s*)' # 3: 'by ', if used '(by\s+)?' # 4: the copyright holder. Don't allow multiple consecutive # spaces, so that right-margin gloss doesn't get caught # (e.g. gnat_ugn.texi). '(' + name + '(?:\s?' + name + ')*)?') # A regexp for notices that might have slipped by. Just matching # 'copyright' is too noisy, and 'copyright.*[0-9]' falls foul of # HTML header markers, so check for 'copyright' and two digits. self.other_copyright_re = re.compile ('copyright.*[0-9][0-9]', re.IGNORECASE) self.comment_re = re.compile('#+|[*]+|;+|%+|//+|@c |dnl ') self.holders = { '@copying': '@copying' } self.holder_prefixes = set() # True to 'quilt add' files before changing them. self.use_quilt = False # If set, force all notices to include this year. self.max_year = None # Goes after the year(s). Could be ', '. self.separator = ' ' def add_package_author (self, holder, canon_form = None): if not canon_form: canon_form = holder self.holders[holder] = canon_form index = holder.find (' ') while index >= 0: self.holder_prefixes.add (holder[:index]) index = holder.find (' ', index + 1) def add_external_author (self, holder): self.holders[holder] = None def year_range (self, years): year_list = [int (year) for year in self.year_re.findall (years)] assert len (year_list) > 0 return (min (year_list), max (year_list)) def set_use_quilt (self, use_quilt): self.use_quilt = use_quilt def include_year (self, year): assert not self.max_year self.max_year = year def canonicalise_years (self, years): # Leave texinfo variables alone. if years.startswith ('@value'): return years (min_year, max_year) = self.year_range (years) # Update the upper bound, if enabled. if self.max_year: max_year = max (max_year, self.max_year) # Use a range. if min_year == max_year: return '%d' % min_year else: return '%d-%d' % (min_year, max_year) def strip_continuation (self, line): line = line.lstrip() match = self.comment_re.match (line) if match: line = line[match.end():].lstrip() return line def is_complete (self, match): holder = match.group (4) return (holder and (holder not in self.holder_prefixes or holder in self.holders)) def update_copyright (self, dir, filename, filter, file, line, match): orig_line = line next_line = None pathname = os.path.join (dir, filename) intro = match.group (1) if intro.startswith ('@set'): # Texinfo year variables should always be on one line after_years = line[match.end (2):].strip() if after_years != '': self.errors.report (pathname, 'trailing characters in @set: ' + after_years) return (False, orig_line, next_line) else: # If it looks like the copyright is incomplete, add the next line. while not self.is_complete (match): try: next_line = file.next() except StopIteration: break # If the next line doesn't look like a proper continuation, # assume that what we've got is complete. continuation = self.strip_continuation (next_line) if not self.continuation_re.match (continuation): break # Merge the lines for matching purposes. orig_line += next_line line = line.rstrip() + ' ' + continuation next_line = None # Rematch with the longer line, at the original position. match = self.copyright_re.match (line, match.start()) assert match holder = match.group (4) # Use the filter to test cases where markup is getting in the way. if filter.by_package_author (dir, filename): assert holder not in self.holders elif not holder: self.errors.report (pathname, 'missing copyright holder') return (False, orig_line, next_line) elif holder not in self.holders: self.errors.report (pathname, 'unrecognised copyright holder: ' + holder) return (False, orig_line, next_line) else: # See whether the copyright is associated with the package # author. canon_form = self.holders[holder] if not canon_form: return (False, orig_line, next_line) # Make sure the author is given in a consistent way. line = (line[:match.start (4)] + canon_form + line[match.end (4):]) # Remove any 'by' line = line[:match.start (3)] + line[match.end (3):] # Update the copyright years. years = match.group (2).strip() canon_form = self.canonicalise_years (years) line = (line[:match.start (2)] + ' ' + canon_form + self.separator + line[match.end (2):]) # Strip trailing whitespace line = line.rstrip() + '\n' return (line != orig_line, line, next_line) def process_file (self, dir, filename, filter): pathname = os.path.join (dir, filename) if filename.endswith ('.tmp'): # Looks like something we tried to create before. try: os.remove (pathname) except OSError: pass return lines = [] changed = False line_filter = filter.get_line_filter (dir, filename) with open (pathname, 'r') as file: prev = None for line in file: while line: next_line = None # Leave filtered-out lines alone. if not (line_filter and line_filter.match (line)): match = self.copyright_re.search (line) if match: res = self.update_copyright (dir, filename, filter, file, line, match) (this_changed, line, next_line) = res changed = changed or this_changed # Check for copyright lines that might have slipped by. elif self.other_copyright_re.search (line): self.errors.report (pathname, 'unrecognised copyright: %s' % line.strip()) lines.append (line) line = next_line # If something changed, write the new file out. if changed and self.errors.ok(): tmp_pathname = pathname + '.tmp' with open (tmp_pathname, 'w') as file: for line in lines: file.write (line) if self.use_quilt: subprocess.call (['quilt', 'add', pathname]) os.rename (tmp_pathname, pathname) def process_tree (self, tree, filter): for (dir, subdirs, filenames) in os.walk (tree): # Don't recurse through directories that should be skipped. for i in xrange (len (subdirs) - 1, -1, -1): if filter.skip_dir (dir, subdirs[i]): del subdirs[i] # Handle the files in this directory. for filename in filenames: if not filter.skip_file (dir, filename): self.process_file (dir, filename, filter) class CmdLine: def __init__ (self, copyright = Copyright): self.errors = Errors() self.copyright = copyright (self.errors) self.chosen_groups = set() self.all_groups = set() self.dirs = [] self.option_handlers = dict() self.option_help = [] self.add_option ('--help', 'Print this help', self.o_help) self.add_option ('--quilt', '"quilt add" files before changing them', self.o_quilt) self.add_option ('--this-year', 'Add the current year to every notice', self.o_this_year) self.add_option ('--all', 'Process the whole tree', self.o_all) def add_option (self, name, help, handler): self.option_help.append ((name, help)) self.option_handlers[name] = handler def add_group (self, name, help): self.all_groups.add (name) self.option_help.append (('--' + name, help)) self.option_handlers['--' + name] = self.o_group def add_dir (self, dir, group, filter = GenericFilter()): assert group in self.all_groups self.dirs.append ((dir, group, filter)) def o_help (self, option = None): format = '%-15s %s\n' for (what, help) in self.option_help: sys.stdout.write (format % (what, help)) sys.exit (0) def o_quilt (self, option): self.copyright.set_use_quilt (True) def o_this_year (self, option): self.copyright.include_year (time.localtime().tm_year) def o_all (self, option): self.chosen_groups |= self.all_groups def o_group (self, group): self.chosen_groups.add (group[2:]) def main (self): for arg in sys.argv[1:]: if arg in self.option_handlers: self.option_handlers[arg] (arg) else: self.errors.report (None, 'unrecognised option: ' + arg) if self.errors.ok(): if len (self.chosen_groups) == 0: self.o_help() else: for (dir, group, filter) in self.dirs: if group in self.chosen_groups: self.copyright.process_tree (dir, filter) sys.exit (0 if self.errors.ok() else 1) #---------------------------------------------------------------------------- class TopLevelFilter (GenericFilter): def skip_dir (self, dir, subdir): return True class ConfigFilter (GenericFilter): def __init__ (self): GenericFilter.__init__ (self) def skip_file (self, dir, filename): if filename.endswith ('.m4'): pathname = os.path.join (dir, filename) with open (pathname) as file: # Skip files imported from gettext. if file.readline().find ('gettext-') >= 0: return True return GenericFilter.skip_file (self, dir, filename) class GCCFilter (GenericFilter): def __init__ (self): GenericFilter.__init__ (self) self.skip_files |= set ([ # Not part of GCC 'math-68881.h', ]) self.skip_dirs |= set ([ # Better not create a merge nightmare for the GNAT folks. 'ada', # Handled separately. 'testsuite', ]) self.skip_extensions |= set ([ # Maintained by the translation project. '.po', # Automatically-generated. '.pot', ]) class TestsuiteFilter (GenericFilter): def __init__ (self): GenericFilter.__init__ (self) self.skip_extensions |= set ([ # Don't change the tests, which could be woend by anyone. '.c', '.C', '.cc', '.h', '.hs', '.f', '.f90', '.go', '.inc', '.java', ]) def skip_file (self, dir, filename): # g++.niklas/README contains historical copyright information # and isn't updated. if filename == 'README' and os.path.basename (dir) == 'g++.niklas': return True return GenericFilter.skip_file (self, dir, filename) class LibCppFilter (GenericFilter): def __init__ (self): GenericFilter.__init__ (self) self.skip_extensions |= set ([ # Maintained by the translation project. '.po', # Automatically-generated. '.pot', ]) class LibJavaFilter (GenericFilter): def __init__ (self): GenericFilter.__init__ (self) self.skip_dirs |= set ([ # Handled separately. 'testsuite', # Not really part of the library 'contrib', # Imported from upstream 'classpath', 'libltdl', ]) def get_line_filter (self, dir, filename): if filename == 'NameDecoder.h': return re.compile ('.*NAME_COPYRIGHT') if filename == 'ICC_Profile.h': return re.compile ('.*icSigCopyrightTag') return GenericFilter.get_line_filter (self, dir, filename) class LibStdCxxFilter (GenericFilter): def __init__ (self): GenericFilter.__init__ (self) self.skip_files |= set ([ # Contains no copyright of its own, but quotes the GPL. 'intro.xml', ]) self.skip_dirs |= set ([ # Contains automatically-generated sources. 'html', # Contains imported images 'images', ]) self.own_files |= set ([ # Contains markup around the copyright owner. 'spine.xml' ]) def get_line_filter (self, dir, filename): if filename == 'boost_concept_check.h': return re.compile ('// \(C\) Copyright Jeremy Siek') return GenericFilter.get_line_filter (self, dir, filename) class GCCCopyright (Copyright): def __init__ (self, errors): Copyright.__init__ (self, errors) canon_fsf = 'Free Software Foundation, Inc.' self.add_package_author ('Free Software Foundation', canon_fsf) self.add_package_author ('Free Software Foundation.', canon_fsf) self.add_package_author ('Free Software Foundation Inc.', canon_fsf) self.add_package_author ('Free Software Foundation, Inc', canon_fsf) self.add_package_author ('Free Software Foundation, Inc.', canon_fsf) self.add_package_author ('The Free Software Foundation', canon_fsf) self.add_package_author ('The Free Software Foundation, Inc.', canon_fsf) self.add_package_author ('Software Foundation, Inc.', canon_fsf) self.add_external_author ('ARM') self.add_external_author ('AdaCore') self.add_external_author ('Ami Tavory and Vladimir Dreizin, IBM-HRL.') self.add_external_author ('Cavium Networks.') self.add_external_author ('Faraday Technology Corp.') self.add_external_author ('Florida State University') self.add_external_author ('Greg Colvin and Beman Dawes.') self.add_external_author ('Hewlett-Packard Company') self.add_external_author ('Information Technology Industry Council.') self.add_external_author ('James Theiler, Brian Gough') self.add_external_author ('Makoto Matsumoto and Takuji Nishimura,') self.add_external_author ('National Research Council of Canada.') self.add_external_author ('Peter Dimov and Multi Media Ltd.') self.add_external_author ('Peter Dimov') self.add_external_author ('Pipeline Associates, Inc.') self.add_external_author ('Regents of the University of California.') self.add_external_author ('Silicon Graphics Computer Systems, Inc.') self.add_external_author ('Silicon Graphics') self.add_external_author ('Stephen L. Moshier') self.add_external_author ('Sun Microsystems, Inc. All rights reserved.') self.add_external_author ('The Go Authors. All rights reserved.') self.add_external_author ('The Go Authors. All rights reserved.') self.add_external_author ('The Go Authors.') self.add_external_author ('The Regents of the University of California.') self.add_external_author ('Unicode, Inc.') self.add_external_author ('University of Toronto.') class GCCCmdLine (CmdLine): def __init__ (self): CmdLine.__init__ (self, GCCCopyright) self.add_group ('shared', 'Process files shared between src and gcc'), self.add_group ('gcc', 'Process the compiler directories'), self.add_group ('ada', 'Process Ada tools and libraries'), self.add_group ('libs', 'Process target-independent libraries'), self.add_group ('libgfortran', 'Process Fortran libraries'), self.add_group ('libstdc++', 'Process C++ libraries'), self.add_group ('libobjc', 'Process Objective-C libraries'), self.add_group ('libjava', 'Process Java libraries'), self.add_dir ('.', 'shared', TopLevelFilter()) # boehm-gc is imported from upstream. self.add_dir ('config', 'shared', ConfigFilter()) # contrib isn't really part of GCC. self.add_dir ('fixincludes', 'gcc') self.add_dir ('gcc', 'gcc', GCCFilter()) self.add_dir ('gcc/testsuite', 'gcc', TestsuiteFilter()) self.add_dir ('gnattools', 'ada') self.add_dir ('include', 'shared') self.add_dir ('libatomic', 'libs') self.add_dir ('libada', 'ada') self.add_dir ('libbacktrace', 'libs') self.add_dir ('libcpp', 'libs', LibCppFilter()) self.add_dir ('libdecnumber', 'libs') # libffi is imported from upstream. self.add_dir ('libgcc', 'libs') self.add_dir ('libgfortran', 'libgfortran') self.add_dir ('libgomp', 'libs') self.add_dir ('libiberty', 'shared') self.add_dir ('libitm', 'libs') self.add_dir ('libjava', 'libjava', LibJavaFilter()) self.add_dir ('libjava/testsuite', 'libjava', TestsuiteFilter()) self.add_dir ('libmudflap', 'libs') self.add_dir ('libobjc', 'libobjc') self.add_dir ('libquadmath', 'libs') # libsanitiser is imported from upstream. self.add_dir ('libssp', 'libs') self.add_dir ('libstdc++-v3', 'libstdc++', LibStdCxxFilter()) self.add_dir ('lto-plugin', 'libs') # zlib is imported from upstream. GCCCmdLine().main() [-- Attachment #3: copyright-range-gcc.patch.bz2 --] [-- Type: application/x-bzip2, Size: 59700 bytes --] ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [committed] 2011 and 2012 Copyright year updates 2013-01-06 12:14 ` Richard Sandiford @ 2013-01-06 12:44 ` Jakub Jelinek 2013-01-06 21:48 ` Richard Sandiford 2013-01-07 8:56 ` Richard Biener 2013-01-06 20:24 ` Mike Stump 2013-01-07 16:00 ` Joseph S. Myers 2 siblings, 2 replies; 18+ messages in thread From: Jakub Jelinek @ 2013-01-06 12:44 UTC (permalink / raw) To: Andrew Pinski, gcc-patches, rdsandiford, Richard Biener, Joseph S. Myers On Sun, Jan 06, 2013 at 12:13:32PM +0000, Richard Sandiford wrote: > I never remember to update the copyright years, so I thought I'd have a go. > And you were right of course. It ended up being a huge time sink. > > Anyway, here's my attempt a script to convert to ranges and, if enabled, > to include the current year. The script only updates FSF copyright notices > and leaves others alone. I've tried my best to make sure that licences > and imported FSF sources aren't touched, but I could have missed some cases. Looks reasonable to me, though I'd like to hear richi's and Joseph's opinion too. I've noticed a minor nit: --- gcc.orig/gcc/testsuite/gcc.misc-tests/linkage.exp +++ gcc/gcc/testsuite/gcc.misc-tests/linkage.exp @@ -1,5 +1,4 @@ -# Copyright (C) 1988, 90-96, 1997, 2000, 2001, 2002, 2007, 2008, 2010, -# 2011, -# 2012 Free Software Foundation, Inc. +# Copyright (C) 90-2012 Free Software Foundation, Inc. That should have been presumably 1988-2012, haven't looked at other similar cases. As for updating to -2013, I think it isn't appropriate for all files, e.g. I'd leave ChangeLog* and various README* files to keep their finish date as is, say ChangeLog.2003 can be just Copyright (c) 2003, doesn't need to be 2003-2013. Perhaps just automatically add -2013 to gcc (except gcc/testsuite) *.[ch], *.md, *.def, *.opt files or so, plus gcc/testsuite *.exp files? E.g. testsuite *.c/*.C files that are Copyright 2004 don't need to be -2013? Also, just a remainder, any Copyright line change in libstdc++-v3/include might potentially require adjustments to libstdc++-v3/testsuite/, because various tests have header line numbers hardcoded in them. Jakub ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [committed] 2011 and 2012 Copyright year updates 2013-01-06 12:44 ` Jakub Jelinek @ 2013-01-06 21:48 ` Richard Sandiford 2013-01-07 8:56 ` Richard Biener 1 sibling, 0 replies; 18+ messages in thread From: Richard Sandiford @ 2013-01-06 21:48 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Andrew Pinski, gcc-patches, Richard Biener, Joseph S. Myers Jakub Jelinek <jakub@redhat.com> writes: > On Sun, Jan 06, 2013 at 12:13:32PM +0000, Richard Sandiford wrote: >> I never remember to update the copyright years, so I thought I'd have a go. >> And you were right of course. It ended up being a huge time sink. >> >> Anyway, here's my attempt a script to convert to ranges and, if enabled, >> to include the current year. The script only updates FSF copyright notices >> and leaves others alone. I've tried my best to make sure that licences >> and imported FSF sources aren't touched, but I could have missed some cases. > > Looks reasonable to me, though I'd like to hear richi's and Joseph's > opinion too. > > I've noticed a minor nit: > --- gcc.orig/gcc/testsuite/gcc.misc-tests/linkage.exp > +++ gcc/gcc/testsuite/gcc.misc-tests/linkage.exp > @@ -1,5 +1,4 @@ > -# Copyright (C) 1988, 90-96, 1997, 2000, 2001, 2002, 2007, 2008, 2010, > -# 2011, > -# 2012 Free Software Foundation, Inc. > +# Copyright (C) 90-2012 Free Software Foundation, Inc. > > That should have been presumably 1988-2012, haven't looked at other similar > cases. Gah, good catch. Fixed in my local copy. I also added a bit of extra error checking to try to make sure the years were sane. Since it's a big patch, I'll see if there are any more comments before sending an update. > As for updating to -2013, I think it isn't appropriate for all > files, e.g. I'd leave ChangeLog* and various README* files to keep their > finish date as is, say ChangeLog.2003 can be just Copyright (c) 2003, > doesn't need to be 2003-2013. Perhaps just automatically add -2013 to gcc > (except gcc/testsuite) *.[ch], *.md, *.def, *.opt files or so, plus > gcc/testsuite *.exp files? E.g. testsuite *.c/*.C files that are Copyright > 2004 don't need to be -2013? Yeah. I'd also tried to avoid touching the gcc tests in this patch, so hopefully the same filter would be OK when adding the extra year. The script applies a similar filter to the libjava testsuite. I wasn't sure what do about libstdc++ though, since its testsuite seems less like a random collection of tests. I'll cross-post any libstdc++ stuff to the libstdc++ list once the GCC side has settled down. I think we should also update the year in the documentation (possibly including the READMEs). There are also awk scripts, random shell scripts, OCaml generators, etc., so it's probably easier to list what should be left out rather than what should be included. The current GNU guidelines seem to actively encourage a blanket update. Agreed on the historical changelogs though. It does seem silly to update those. > Also, just a remainder, any Copyright line change in libstdc++-v3/include > might potentially require adjustments to libstdc++-v3/testsuite/, because > various tests have header line numbers hardcoded in them. OK, thanks for the heads up. The libstdc++ and libjava changes the ones I'm least certain about. Richard ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [committed] 2011 and 2012 Copyright year updates 2013-01-06 12:44 ` Jakub Jelinek 2013-01-06 21:48 ` Richard Sandiford @ 2013-01-07 8:56 ` Richard Biener 1 sibling, 0 replies; 18+ messages in thread From: Richard Biener @ 2013-01-07 8:56 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Andrew Pinski, gcc-patches, rdsandiford, Joseph S. Myers On Sun, 6 Jan 2013, Jakub Jelinek wrote: > On Sun, Jan 06, 2013 at 12:13:32PM +0000, Richard Sandiford wrote: > > I never remember to update the copyright years, so I thought I'd have a go. > > And you were right of course. It ended up being a huge time sink. > > > > Anyway, here's my attempt a script to convert to ranges and, if enabled, > > to include the current year. The script only updates FSF copyright notices > > and leaves others alone. I've tried my best to make sure that licences > > and imported FSF sources aren't touched, but I could have missed some cases. > > Looks reasonable to me, though I'd like to hear richi's and Joseph's > opinion too. Certainly fine with me. Richard. > I've noticed a minor nit: > --- gcc.orig/gcc/testsuite/gcc.misc-tests/linkage.exp > +++ gcc/gcc/testsuite/gcc.misc-tests/linkage.exp > @@ -1,5 +1,4 @@ > -# Copyright (C) 1988, 90-96, 1997, 2000, 2001, 2002, 2007, 2008, 2010, > -# 2011, > -# 2012 Free Software Foundation, Inc. > +# Copyright (C) 90-2012 Free Software Foundation, Inc. > > That should have been presumably 1988-2012, haven't looked at other similar > cases. As for updating to -2013, I think it isn't appropriate for all > files, e.g. I'd leave ChangeLog* and various README* files to keep their > finish date as is, say ChangeLog.2003 can be just Copyright (c) 2003, > doesn't need to be 2003-2013. Perhaps just automatically add -2013 to gcc > (except gcc/testsuite) *.[ch], *.md, *.def, *.opt files or so, plus > gcc/testsuite *.exp files? E.g. testsuite *.c/*.C files that are Copyright > 2004 don't need to be -2013? > > Also, just a remainder, any Copyright line change in libstdc++-v3/include > might potentially require adjustments to libstdc++-v3/testsuite/, because > various tests have header line numbers hardcoded in them. > > Jakub > > -- Richard Biener <rguenther@suse.de> SUSE / SUSE Labs SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 GF: Jeff Hawn, Jennifer Guild, Felix Imend ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [committed] 2011 and 2012 Copyright year updates 2013-01-06 12:14 ` Richard Sandiford 2013-01-06 12:44 ` Jakub Jelinek @ 2013-01-06 20:24 ` Mike Stump 2013-01-06 20:37 ` Mike Stump 2013-01-06 21:53 ` Richard Sandiford 2013-01-07 16:00 ` Joseph S. Myers 2 siblings, 2 replies; 18+ messages in thread From: Mike Stump @ 2013-01-06 20:24 UTC (permalink / raw) To: Richard Sandiford; +Cc: Jakub Jelinek, Andrew Pinski, gcc-patches On Jan 6, 2013, at 4:13 AM, Richard Sandiford <rdsandiford@googlemail.com> wrote: > Anyway, here's my attempt a script to convert to ranges and, if enabled, > to include the current year. I don't think we should update to the current year. > The script only updates FSF copyright notices > and leaves others alone. I've tried my best to make sure that licences > and imported FSF sources aren't touched, but I could have missed some cases. I've audited the change… I noticed an inconsistent use of: Copyright (c) 2010 Copyright 1992 Copyright (C) 2010 but that is pre-existing. Also, I noticed a 90-2007, which should canonicalized to 1990-2007, but that is also pre-existing. I did the analysis by case reduction so that like case classes reduce to generalized forms and then I audited all the forms of changes that appeared. This lets me skip quickly the majority of changes and focus in on just the weirdest of the weird quickly and accurately without missing them in the noise of the common cases. Look good. I think we should put it in. I didn't audit upstream or out of tree files. Only the form of the change. ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [committed] 2011 and 2012 Copyright year updates 2013-01-06 20:24 ` Mike Stump @ 2013-01-06 20:37 ` Mike Stump 2013-01-06 21:53 ` Richard Sandiford 1 sibling, 0 replies; 18+ messages in thread From: Mike Stump @ 2013-01-06 20:37 UTC (permalink / raw) To: Richard Sandiford; +Cc: Jakub Jelinek, Andrew Pinski, gcc-patches On Jan 6, 2013, at 12:24 PM, Mike Stump <mikestump@comcast.net> wrote: > I did the analysis by case reduction so that like case classes reduce to generalized forms and then I audited all the forms of changes that appeared. This lets me skip quickly the majority of changes and focus in on just the weirdest of the weird quickly and accurately without missing them in the noise of the common cases. Oh, just in case people want to see the last residual: $ grep '^[-+]' copyright-range-gcc.patch | grep -v '^---' | grep -v '^+++' | sed 's/.*opyright/Copyright/; s/Free.*/Free/; s/[12][0-9][0-9][0-9], //g; s/opyright (c)/opyright/; s/opyright (C)/opyright/; s/opyright [12][0-9][0-9][0-9], */opyright /g; s/[12][0-9][0-9][0-9][,-] *//g' | more | sort | uniq -c | more 5 - 52 - 1 - 2002 Free 4 - 2007 Free 24 - 2010 2 - 2010 Free 10 - 2010 Free 39 - 2011 8 - 2011 Free 43 - 2011 Free 136 - 2012 31 - 2012 Free 147 - 2012 Free 12 - 2013 1 - 2013 Free 5 - 2013 Free 1 - Foundation, Inc. 706 - Free 1 - Inc. 2 - * 2008 2 - * The Free 1 - * Free 1 -# 2010 Free 3 -# 2011 Free 2 -# 2012 1 -# 2012 Free 14 -# Free 8 -# Free 1 -# The Free 1 -# 2003 Free 1 -# 2008 Free 1 -# 2008 Free 1 -# 2010 Free 12 -# 2011 Free 5 -# 2012 12 -# 2012 Free 54 -# Free 1 -1998 Free 1 -2007 Free 1 -2009 Free 1 -2010 Free 3 -2010 Free 1 -2011 3 -2011 Free 1 -2012 2 -2012 Free 1 -; 2011 Free 2 -; 2012 Free 39 -; Free 2 -;; 1 -;; 2012 Free 7 -;; Free 1 -;; 2011 Free 4 -;; 2012 1 -;; 2012 Free 12 -;; Free 1 -;; 2010 Free 2 -;; 2011 Free 4 -;; 2012 1 -;; 2012 Free 7 -;; 2012 Free 71 -;; Free 1 -@c 1 -@c 2002 Free 2 -@c 2004 Free 1 -@c 2006 Free 2 -@c 2007 Free 1 -@c 2009 2 -@c 2010 2 -@c 2010 Free 2 -@c 2011 Free 8 -@c 2012 1 -@c 2012 Free 1 -@c 2013 25 -@c Free 1 -Foundation, Inc. 7 -Free 1 -Inc. 1 -dnl Free 546 Copyright 1 Copyright 1996 2 Copyright 1996 Free 2 Copyright 1997 4 Copyright 1997 Free 4 Copyright 1998 1 Copyright 1998 - 2012 9 Copyright 1998 Free 1 Copyright 1999 3 Copyright 1999 Free 1 Copyright 1999 The Free 5 Copyright 2001 Free 1 Copyright 2001 The Free 2 Copyright 2002 Free 9 Copyright 2003 Free 1 Copyright 2004 20 Copyright 2004 Free 1 Copyright 2004 The Free 2 Copyright 2005 1 Copyright 2005 , 2012 12 Copyright 2005 Free 1 Copyright 2006 4 Copyright 2006 Free 20 Copyright 2007 1 Copyright 2007 Free 324 Copyright 2007 Free 13 Copyright 2008 64 Copyright 2008 Free 18 Copyright 2009 143 Copyright 2009 Free 80 Copyright 2010 3 Copyright 2010 Free 277 Copyright 2010 Free 1 Copyright 2010. 2011 Free 148 Copyright 2011 1 Copyright 2011 Free 631 Copyright 2011 Free 416 Copyright 2012 16 Copyright 2012 Free 1374 Copyright 2012 Free 6 Copyright 2013 25 Copyright 2013 Free 1 Copyright 90, 91, 92, 2007 2 Copyright 90, 91, 92, 95, 96, 2007 3 Copyright 90-2007 Free 1 Copyright 90-2012 Free 1 Copyright 90-96, 6 Copyright Free 2 Copyrights-gcj 2010 2 Copyrights-gfortran 2010 2 Copyrights-gfortran 2012 2 Copyrights-gfortran} Free 2 Copyrights-go 2012 6 Copyright{} 1 Copyright{} 2005 1 Copyright{} 2005 Free 3 Copyright{} 2010 Free 1 Copyright{} 2011 2 Copyright{} 2011 Free 2 Copyright{} 2012 Free Of course, this leaves out all the intermediates and audit steps. This is merely the last step. ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [committed] 2011 and 2012 Copyright year updates 2013-01-06 20:24 ` Mike Stump 2013-01-06 20:37 ` Mike Stump @ 2013-01-06 21:53 ` Richard Sandiford 1 sibling, 0 replies; 18+ messages in thread From: Richard Sandiford @ 2013-01-06 21:53 UTC (permalink / raw) To: Mike Stump; +Cc: Jakub Jelinek, Andrew Pinski, gcc-patches Mike Stump <mikestump@comcast.net> writes: > On Jan 6, 2013, at 4:13 AM, Richard Sandiford > <rdsandiford@googlemail.com> wrote: >> Anyway, here's my attempt a script to convert to ranges and, if enabled, >> to include the current year. > > I don't think we should update to the current year. It just seems easier than having to remember to update the copyright whenever you change a file. The GNU guidelines seem to actively encourage it now. >> The script only updates FSF copyright notices >> and leaves others alone. I've tried my best to make sure that licences >> and imported FSF sources aren't touched, but I could have missed some cases. > > I've audited the change… I noticed an inconsistent use of: > > Copyright (c) 2010 > Copyright 1992 > Copyright (C) 2010 > > but that is pre-existing. Also, I noticed a 90-2007, which should > canonicalized to 1990-2007, but that is also pre-existing. Thanks, I updated my local copy to handle both of these. Richard ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [committed] 2011 and 2012 Copyright year updates 2013-01-06 12:14 ` Richard Sandiford 2013-01-06 12:44 ` Jakub Jelinek 2013-01-06 20:24 ` Mike Stump @ 2013-01-07 16:00 ` Joseph S. Myers 2013-01-07 19:49 ` Richard Sandiford 2 siblings, 1 reply; 18+ messages in thread From: Joseph S. Myers @ 2013-01-07 16:00 UTC (permalink / raw) To: Richard Sandiford; +Cc: Jakub Jelinek, Andrew Pinski, gcc-patches On Sun, 6 Jan 2013, Richard Sandiford wrote: > Anyway, here's my attempt a script to convert to ranges and, if enabled, > to include the current year. The script only updates FSF copyright notices > and leaves others alone. I've tried my best to make sure that licences > and imported FSF sources aren't touched, but I could have missed some cases. I don't see anything to exclude the soft-fp files imported from glibc (where the current glibc versions should be copied instead ... but note that some soft-fp files, e.g. for TImode, are GCC-specific and not in glibc). It may make sense to leave out libiberty (and other directories shared with the src repository) initially. To convert them, binutils will need an appropriate README notice explaining the meaning of ranges (like the one I added to GCC's toplevel README a while back), as per GNU policy, and someone may need to work out whether any missing years being inserted in the ranges need to be copyrightable years for all of GCC, binutils and GDB (and what the copyrightable year ranges are in each case - the years in which either there was a release of the relevant package, including beta releases etc., or it had public version control). I think a patch for each directory will need posting separately for review of such things as whether any imported / generated files are mistakenly changed. > I've also attached a bzip2 patch of the gcc/ and fixincludes/ part. > This patch converts to ranges but doesn't add 2013. I can add 2013 > at the same time, separately or not at all; let me know. I think 2013 should be added (so the notices should say <year>-2013, for any value of <year> 1986 or later, all years 1987 and later being copyrightable years for GCC). But --version notices should just say 2013 (including e.g. that in fixincludes/mkheaders.in). -- Joseph S. Myers joseph@codesourcery.com ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [committed] 2011 and 2012 Copyright year updates 2013-01-07 16:00 ` Joseph S. Myers @ 2013-01-07 19:49 ` Richard Sandiford 2013-01-07 19:59 ` Bruce Korb 2013-01-07 20:31 ` Joseph S. Myers 0 siblings, 2 replies; 18+ messages in thread From: Richard Sandiford @ 2013-01-07 19:49 UTC (permalink / raw) To: Joseph S. Myers; +Cc: Jakub Jelinek, Andrew Pinski, gcc-patches "Joseph S. Myers" <joseph@codesourcery.com> writes: > On Sun, 6 Jan 2013, Richard Sandiford wrote: > >> Anyway, here's my attempt a script to convert to ranges and, if enabled, >> to include the current year. The script only updates FSF copyright notices >> and leaves others alone. I've tried my best to make sure that licences >> and imported FSF sources aren't touched, but I could have missed some cases. > > I don't see anything to exclude the soft-fp files imported from glibc > (where the current glibc versions should be copied instead ... but note > that some soft-fp files, e.g. for TImode, are GCC-specific and not in > glibc). Hmm, OK. Is there a plan to move those to glibc? Every file seems to say "This file is part of the GNU C Library.", but it wasn't obvious whether that was an aspiration or just cut-&-paste. Maybe it'd be easier for the script to treat them all as imported and soft-fp altogether. Would that be OK? > It may make sense to leave out libiberty (and other directories shared > with the src repository) initially. To convert them, binutils will need > an appropriate README notice explaining the meaning of ranges (like the > one I added to GCC's toplevel README a while back), as per GNU policy, and > someone may need to work out whether any missing years being inserted in > the ranges need to be copyrightable years for all of GCC, binutils and GDB > (and what the copyrightable year ranges are in each case - the years in > which either there was a release of the relevant package, including beta > releases etc., or it had public version control). OK, hadn't expected it to be that complicated, but there again, I wasn't sure if we'd ever use the --shared flag anyway. It was there as much to differentiate the "shared with src" cases from the "imported from upstream" cases. > I think a patch for each directory will need posting separately for review > of such things as whether any imported / generated files are mistakenly > changed. So fixincludes/ separate from gcc/, and every library separate? OK. >> I've also attached a bzip2 patch of the gcc/ and fixincludes/ part. >> This patch converts to ranges but doesn't add 2013. I can add 2013 >> at the same time, separately or not at all; let me know. > > I think 2013 should be added (so the notices should say <year>-2013, for > any value of <year> 1986 or later, all years 1987 and later being > copyrightable years for GCC). But --version notices should just say 2013 > (including e.g. that in fixincludes/mkheaders.in). OK, thanks. Richard ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [committed] 2011 and 2012 Copyright year updates 2013-01-07 19:49 ` Richard Sandiford @ 2013-01-07 19:59 ` Bruce Korb 2013-01-07 20:22 ` Richard Sandiford 2013-01-07 20:31 ` Joseph S. Myers 1 sibling, 1 reply; 18+ messages in thread From: Bruce Korb @ 2013-01-07 19:59 UTC (permalink / raw) To: Joseph S. Myers, Jakub Jelinek, Andrew Pinski, gcc-patches, rdsandiford On Mon, Jan 7, 2013 at 11:49 AM, Richard Sandiford <rdsandiford@googlemail.com> wrote: >> I think a patch for each directory will need posting separately for review >> of such things as whether any imported / generated files are mistakenly >> changed. > > So fixincludes/ separate from gcc/, and every library separate? OK. Separate? Seems pretty "inextricably intertwined" to me. Maybe I'm coming in too late in this conversation. I'll just update the copyrights in the next few days. It (fixincludes) has _certainly_ been updated every year of its existence. (Probably ought not count the original shell script, though I did lift all of its expressions....) Cheers - Bruce ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [committed] 2011 and 2012 Copyright year updates 2013-01-07 19:59 ` Bruce Korb @ 2013-01-07 20:22 ` Richard Sandiford 2013-01-07 20:30 ` Bruce Korb 0 siblings, 1 reply; 18+ messages in thread From: Richard Sandiford @ 2013-01-07 20:22 UTC (permalink / raw) To: Bruce Korb; +Cc: Joseph S. Myers, Jakub Jelinek, Andrew Pinski, gcc-patches Bruce Korb <bruce.korb@gmail.com> writes: > On Mon, Jan 7, 2013 at 11:49 AM, Richard Sandiford > <rdsandiford@googlemail.com> wrote: >>> I think a patch for each directory will need posting separately for review >>> of such things as whether any imported / generated files are mistakenly >>> changed. >> >> So fixincludes/ separate from gcc/, and every library separate? OK. > > Separate? Seems pretty "inextricably intertwined" to me. > > Maybe I'm coming in too late in this conversation. > I'll just update the copyrights in the next few days. > It (fixincludes) has _certainly_ been updated every year of its existence. > (Probably ought not count the original shell script, though I did lift all > of its expressions....) Well, the idea is that the script will do it (this year and hopefully future years). It would be nice to get the stage where this stuff is mostly automated and not much hassle. It was just a question of whether to submit the fixincludes/ and gcc/ parts as one patch (as I'd originally done) or as two separate patches. Two separate patches probably makes more sense and I think is what Joseph was suggesting. Richard ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [committed] 2011 and 2012 Copyright year updates 2013-01-07 20:22 ` Richard Sandiford @ 2013-01-07 20:30 ` Bruce Korb 0 siblings, 0 replies; 18+ messages in thread From: Bruce Korb @ 2013-01-07 20:30 UTC (permalink / raw) To: Bruce Korb, Joseph S. Myers, Jakub Jelinek, Andrew Pinski, gcc-patches, rdsandiford HI, On Mon, Jan 7, 2013 at 12:21 PM, Richard Sandiford <rdsandiford@googlemail.com> wrote: > It was just a question of whether to submit the fixincludes/ and gcc/ > parts as one patch (as I'd originally done) or as two separate patches. > Two separate patches probably makes more sense and I think is what > Joseph was suggesting. In that case, I completely do not care at all which way it happens. The effect is the same and the difference is as inconsequential as I can imagine. :) Thanks! - Bruce ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [committed] 2011 and 2012 Copyright year updates 2013-01-07 19:49 ` Richard Sandiford 2013-01-07 19:59 ` Bruce Korb @ 2013-01-07 20:31 ` Joseph S. Myers 2013-01-08 20:49 ` Richard Sandiford 1 sibling, 1 reply; 18+ messages in thread From: Joseph S. Myers @ 2013-01-07 20:31 UTC (permalink / raw) To: Richard Sandiford; +Cc: Jakub Jelinek, Andrew Pinski, gcc-patches On Mon, 7 Jan 2013, Richard Sandiford wrote: > "Joseph S. Myers" <joseph@codesourcery.com> writes: > > On Sun, 6 Jan 2013, Richard Sandiford wrote: > > > >> Anyway, here's my attempt a script to convert to ranges and, if enabled, > >> to include the current year. The script only updates FSF copyright notices > >> and leaves others alone. I've tried my best to make sure that licences > >> and imported FSF sources aren't touched, but I could have missed some cases. > > > > I don't see anything to exclude the soft-fp files imported from glibc > > (where the current glibc versions should be copied instead ... but note > > that some soft-fp files, e.g. for TImode, are GCC-specific and not in > > glibc). > > Hmm, OK. Is there a plan to move those to glibc? Every file seems to say > "This file is part of the GNU C Library.", but it wasn't obvious whether > that was an aspiration or just cut-&-paste. They'd only move to glibc if some architecture has a use for them (most likely if some architecture wishes to support rounding modes and exceptions for soft-float, like powerpc, but also has TImode support; in that case the best results would come from that architecture using these functions only in glibc and not in libgcc at all). > Maybe it'd be easier for the script to treat them all as imported and > soft-fp altogether. Would that be OK? Sure. The point should be to get something in that covers a useful set of files, and then its coverage can be expanded incrementally later. > OK, hadn't expected it to be that complicated, but there again, I wasn't > sure if we'd ever use the --shared flag anyway. It was there as much to > differentiate the "shared with src" cases from the "imported from upstream" > cases. I didn't look at what options might cause the script to touch what directories, just for cases that appeared like they might be covered but that have complications. > > I think a patch for each directory will need posting separately for review > > of such things as whether any imported / generated files are mistakenly > > changed. > > So fixincludes/ separate from gcc/, and every library separate? OK. Yes, I think that will produce sensibly-sized chunks for people familiar with the relevant directories to review to see whether any imported files are being inappropriately changed, generated files changed without corresponding changes to their sources, or sources for generated files changed without corresponding changes to the generated files. -- Joseph S. Myers joseph@codesourcery.com ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [committed] 2011 and 2012 Copyright year updates 2013-01-07 20:31 ` Joseph S. Myers @ 2013-01-08 20:49 ` Richard Sandiford 2013-01-10 14:17 ` Jakub Jelinek 0 siblings, 1 reply; 18+ messages in thread From: Richard Sandiford @ 2013-01-08 20:49 UTC (permalink / raw) To: Joseph S. Myers; +Cc: Jakub Jelinek, Andrew Pinski, gcc-patches [-- Attachment #1: Type: text/plain, Size: 1090 bytes --] "Joseph S. Myers" <joseph@codesourcery.com> writes: >> > I think a patch for each directory will need posting separately for review >> > of such things as whether any imported / generated files are mistakenly >> > changed. >> >> So fixincludes/ separate from gcc/, and every library separate? OK. > > Yes, I think that will produce sensibly-sized chunks for people familiar > with the relevant directories to review to see whether any imported files > are being inappropriately changed, generated files changed without > corresponding changes to their sources, or sources for generated files > changed without corresponding changes to the generated files. OK, thanks. Here's the updated patch for gcc/, this time including 2013 in the ranges of all files except the old ChangeLogs and ONEWS. I've tried to take your, Jakub's and Mike's comments into account (thanks again for those). Tested on x86_64-linux-gnu. OK to install? For reference, I've also included the current version of the script. Richard gcc/ Update copyright years gcc/testsuite/ Update copyright years [-- Attachment #2: copyright-range-gcc.patch.bz2 --] [-- Type: application/x-bzip2, Size: 65532 bytes --] [-- Attachment #3: copyright.py --] [-- Type: text/plain, Size: 24633 bytes --] #!/usr/bin/python import os import re import sys import time import subprocess class Errors: def __init__ (self): self.num_errors = 0 def report (self, filename, string): if filename: string = filename + ': ' + string sys.stderr.write (string + '\n') self.num_errors += 1 def ok (self): return self.num_errors == 0 class GenericFilter: def __init__ (self): self.skip_files = set() self.skip_dirs = set() self.skip_extensions = set() self.fossilised_files = set() self.own_files = set() self.skip_files |= set ([ # Skip licence files. 'COPYING', 'COPYING.LIB', 'COPYING3', 'COPYING3.LIB', 'LICENSE', 'fdl.texi', 'gpl_v3.texi', 'fdl-1.3.xml', 'gpl-3.0.xml', # Skip auto- and libtool-related files 'aclocal.m4', 'compile', 'config.guess', 'config.sub', 'depcomp', 'install-sh', 'libtool.m4', 'ltmain.sh', 'ltoptions.m4', 'ltsugar.m4', 'ltversion.m4', 'lt~obsolete.m4', 'missing', 'mkdep', 'mkinstalldirs', 'move-if-change', 'shlibpath.m4', 'symlink-tree', 'ylwrap', # Skip FSF mission statement, etc. 'gnu.texi', 'funding.texi', 'appendix_free.xml', # Skip imported texinfo files. 'texinfo.tex', ]) def get_line_filter (self, dir, filename): if filename.startswith ('ChangeLog'): # Ignore references to copyright in changelog entries. return re.compile ('\t') return None def skip_file (self, dir, filename): if filename in self.skip_files: return True (base, extension) = os.path.splitext (filename) if extension in self.skip_extensions: return True if extension == '.in': # Skip .in files produced by automake. if os.path.exists (base + '.am'): return True # Skip files produced by autogen if (os.path.exists (base + '.def') and os.path.exists (base + '.tpl')): return True # Skip configure files produced by autoconf if filename == 'configure': if os.path.exists (base + '.ac'): return True if os.path.exists (base + '.in'): return True return False def skip_dir (self, dir, subdir): return subdir in self.skip_dirs def fossilised_file (self, dir, filename): if filename in self.fossilised_files: return True # Only touch current current ChangeLogs. if filename != 'ChangeLog' and filename.find ('ChangeLog') >= 0: return True return False def by_package_author (self, dir, filename): return filename in self.own_files class Copyright: def __init__ (self, errors): self.errors = errors # Characters in a range of years. Include '.' for typos. ranges = '[0-9](?:[-0-9.,\s]|\s+and\s+)*[0-9]' # Non-whitespace characters in a copyright holder's name. name = '[\w.,-]' # Matches one year. self.year_re = re.compile ('[0-9]+') # Matches part of a year or copyright holder. self.continuation_re = re.compile (ranges + '|' + name) # Matches a full copyright notice: self.copyright_re = re.compile ( # 1: 'Copyright (C)', etc. '([Cc]opyright' '|[Cc]opyright\s+\([Cc]\)' '|[Cc]opyright\s+%s' '|[Cc]opyright\s+©' '|[Cc]opyright\s+@copyright{}' '|@set\s+copyright[\w-]+)' # 2: the years. Include the whitespace in the year, so that # we can remove any excess. '(\s*(?:' + ranges + ',?' '|@value\{[^{}]*\})\s*)' # 3: 'by ', if used '(by\s+)?' # 4: the copyright holder. Don't allow multiple consecutive # spaces, so that right-margin gloss doesn't get caught # (e.g. gnat_ugn.texi). '(' + name + '(?:\s?' + name + ')*)?') # A regexp for notices that might have slipped by. Just matching # 'copyright' is too noisy, and 'copyright.*[0-9]' falls foul of # HTML header markers, so check for 'copyright' and two digits. self.other_copyright_re = re.compile ('copyright.*[0-9][0-9]', re.IGNORECASE) self.comment_re = re.compile('#+|[*]+|;+|%+|//+|@c |dnl ') self.holders = { '@copying': '@copying' } self.holder_prefixes = set() # True to 'quilt add' files before changing them. self.use_quilt = False # If set, force all notices to include this year. self.max_year = None # Goes after the year(s). Could be ', '. self.separator = ' ' def add_package_author (self, holder, canon_form = None): if not canon_form: canon_form = holder self.holders[holder] = canon_form index = holder.find (' ') while index >= 0: self.holder_prefixes.add (holder[:index]) index = holder.find (' ', index + 1) def add_external_author (self, holder): self.holders[holder] = None class BadYear(): def __init__ (self, year): self.year = year def __str__ (self): return 'unrecognised year: ' + self.year def parse_year (self, string): year = int (string) if len (string) == 2: if year > 70: return year + 1900 elif len (string) == 4: return year raise self.BadYear (string) def year_range (self, years): year_list = [self.parse_year (year) for year in self.year_re.findall (years)] assert len (year_list) > 0 return (min (year_list), max (year_list)) def set_use_quilt (self, use_quilt): self.use_quilt = use_quilt def include_year (self, year): assert not self.max_year self.max_year = year def canonicalise_years (self, dir, filename, filter, years): # Leave texinfo variables alone. if years.startswith ('@value'): return years (min_year, max_year) = self.year_range (years) # Update the upper bound, if enabled. if self.max_year and not filter.fossilised_file (dir, filename): max_year = max (max_year, self.max_year) # Use a range. if min_year == max_year: return '%d' % min_year else: return '%d-%d' % (min_year, max_year) def strip_continuation (self, line): line = line.lstrip() match = self.comment_re.match (line) if match: line = line[match.end():].lstrip() return line def is_complete (self, match): holder = match.group (4) return (holder and (holder not in self.holder_prefixes or holder in self.holders)) def update_copyright (self, dir, filename, filter, file, line, match): orig_line = line next_line = None pathname = os.path.join (dir, filename) intro = match.group (1) if intro.startswith ('@set'): # Texinfo year variables should always be on one line after_years = line[match.end (2):].strip() if after_years != '': self.errors.report (pathname, 'trailing characters in @set: ' + after_years) return (False, orig_line, next_line) else: # If it looks like the copyright is incomplete, add the next line. while not self.is_complete (match): try: next_line = file.next() except StopIteration: break # If the next line doesn't look like a proper continuation, # assume that what we've got is complete. continuation = self.strip_continuation (next_line) if not self.continuation_re.match (continuation): break # Merge the lines for matching purposes. orig_line += next_line line = line.rstrip() + ' ' + continuation next_line = None # Rematch with the longer line, at the original position. match = self.copyright_re.match (line, match.start()) assert match holder = match.group (4) # Use the filter to test cases where markup is getting in the way. if filter.by_package_author (dir, filename): assert holder not in self.holders elif not holder: self.errors.report (pathname, 'missing copyright holder') return (False, orig_line, next_line) elif holder not in self.holders: self.errors.report (pathname, 'unrecognised copyright holder: ' + holder) return (False, orig_line, next_line) else: # See whether the copyright is associated with the package # author. canon_form = self.holders[holder] if not canon_form: return (False, orig_line, next_line) # Make sure the author is given in a consistent way. line = (line[:match.start (4)] + canon_form + line[match.end (4):]) # Remove any 'by' line = line[:match.start (3)] + line[match.end (3):] # Update the copyright years. years = match.group (2).strip() try: canon_form = self.canonicalise_years (dir, filename, filter, years) except self.BadYear as e: self.errors.report (pathname, str (e)) return (False, orig_line, next_line) line = (line[:match.start (2)] + ' ' + canon_form + self.separator + line[match.end (2):]) # Use the standard (C) form. if intro.endswith ('right'): intro += ' (C)' elif intro.endswith ('(c)'): intro = intro[:-3] + '(C)' line = line[:match.start (1)] + intro + line[match.end (1):] # Strip trailing whitespace line = line.rstrip() + '\n' return (line != orig_line, line, next_line) def process_file (self, dir, filename, filter): pathname = os.path.join (dir, filename) if filename.endswith ('.tmp'): # Looks like something we tried to create before. try: os.remove (pathname) except OSError: pass return lines = [] changed = False line_filter = filter.get_line_filter (dir, filename) with open (pathname, 'r') as file: prev = None for line in file: while line: next_line = None # Leave filtered-out lines alone. if not (line_filter and line_filter.match (line)): match = self.copyright_re.search (line) if match: res = self.update_copyright (dir, filename, filter, file, line, match) (this_changed, line, next_line) = res changed = changed or this_changed # Check for copyright lines that might have slipped by. elif self.other_copyright_re.search (line): self.errors.report (pathname, 'unrecognised copyright: %s' % line.strip()) lines.append (line) line = next_line # If something changed, write the new file out. if changed and self.errors.ok(): tmp_pathname = pathname + '.tmp' with open (tmp_pathname, 'w') as file: for line in lines: file.write (line) if self.use_quilt: subprocess.call (['quilt', 'add', pathname]) os.rename (tmp_pathname, pathname) def process_tree (self, tree, filter): for (dir, subdirs, filenames) in os.walk (tree): # Don't recurse through directories that should be skipped. for i in xrange (len (subdirs) - 1, -1, -1): if filter.skip_dir (dir, subdirs[i]): del subdirs[i] # Handle the files in this directory. for filename in filenames: if not filter.skip_file (dir, filename): self.process_file (dir, filename, filter) class CmdLine: def __init__ (self, copyright = Copyright): self.errors = Errors() self.copyright = copyright (self.errors) self.dirs = [] self.chosen_dirs = [] self.all = False self.option_handlers = dict() self.option_help = [] self.add_option ('--help', 'Print this help', self.o_help) self.add_option ('--quilt', '"quilt add" files before changing them', self.o_quilt) self.add_option ('--this-year', 'Add the current year to every notice', self.o_this_year) self.add_option ('--all', 'Process the whole tree', self.o_all) def add_option (self, name, help, handler): self.option_help.append ((name, help)) self.option_handlers[name] = handler def add_dir (self, dir, filter = GenericFilter()): self.dirs.append ((dir, filter)) def o_help (self, option = None): sys.stdout.write ('Usage: %s [options] dir1 dir2...\n\n' 'Options:\n' % sys.argv[0]) format = '%-15s %s\n' for (what, help) in self.option_help: sys.stdout.write (format % (what, help)) sys.stdout.write ('\nDirectories:\n') format = '%-18s' i = 0 for (dir, filter) in self.dirs: i += 1 if i % 4 == 0 or i == len (self.dirs): sys.stdout.write (dir + '\n') else: sys.stdout.write (format % dir) sys.exit (0) def o_quilt (self, option): self.copyright.set_use_quilt (True) def o_this_year (self, option): self.copyright.include_year (time.localtime().tm_year) def o_all (self, option): self.all = True def main (self): for arg in sys.argv[1:]: if arg[:1] != '-': self.chosen_dirs.append (arg) elif arg in self.option_handlers: self.option_handlers[arg] (arg) else: self.errors.report (None, 'unrecognised option: ' + arg) if self.errors.ok(): if self.all: for (dir, filter) in self.dirs: self.copyright.process_tree (dir, filter) elif len (self.chosen_dirs) == 0: self.o_help() else: for chosen_dir in self.chosen_dirs: canon_dir = os.path.join (chosen_dir, '') count = 0 for (dir, filter) in self.dirs: if (dir + os.sep).startswith (canon_dir): count += 1 self.copyright.process_tree (dir, filter) if count == 0: self.errors.report (None, 'unrecognised directory: ' + chosen_dir) sys.exit (0 if self.errors.ok() else 1) #---------------------------------------------------------------------------- class TopLevelFilter (GenericFilter): def skip_dir (self, dir, subdir): return True class ConfigFilter (GenericFilter): def __init__ (self): GenericFilter.__init__ (self) def skip_file (self, dir, filename): if filename.endswith ('.m4'): pathname = os.path.join (dir, filename) with open (pathname) as file: # Skip files imported from gettext. if file.readline().find ('gettext-') >= 0: return True return GenericFilter.skip_file (self, dir, filename) class GCCFilter (GenericFilter): def __init__ (self): GenericFilter.__init__ (self) self.skip_files |= set ([ # Not part of GCC 'math-68881.h', ]) self.skip_dirs |= set ([ # Better not create a merge nightmare for the GNAT folks. 'ada', # Handled separately. 'testsuite', ]) self.skip_extensions |= set ([ # Maintained by the translation project. '.po', # Automatically-generated. '.pot', ]) self.fossilised_files |= set ([ # Old news won't be updated. 'ONEWS', ]) class TestsuiteFilter (GenericFilter): def __init__ (self): GenericFilter.__init__ (self) self.skip_extensions |= set ([ # Don't change the tests, which could be woend by anyone. '.c', '.C', '.cc', '.h', '.hs', '.f', '.f90', '.go', '.inc', '.java', ]) def skip_file (self, dir, filename): # g++.niklas/README contains historical copyright information # and isn't updated. if filename == 'README' and os.path.basename (dir) == 'g++.niklas': return True return GenericFilter.skip_file (self, dir, filename) class LibCppFilter (GenericFilter): def __init__ (self): GenericFilter.__init__ (self) self.skip_extensions |= set ([ # Maintained by the translation project. '.po', # Automatically-generated. '.pot', ]) class LibGCCFilter (GenericFilter): def __init__ (self): GenericFilter.__init__ (self) self.skip_dirs |= set ([ # Imported from GLIBC. 'soft-fp', ]) class LibJavaFilter (GenericFilter): def __init__ (self): GenericFilter.__init__ (self) self.skip_dirs |= set ([ # Handled separately. 'testsuite', # Not really part of the library 'contrib', # Imported from upstream 'classpath', 'libltdl', ]) def get_line_filter (self, dir, filename): if filename == 'NameDecoder.h': return re.compile ('.*NAME_COPYRIGHT') if filename == 'ICC_Profile.h': return re.compile ('.*icSigCopyrightTag') return GenericFilter.get_line_filter (self, dir, filename) class LibStdCxxFilter (GenericFilter): def __init__ (self): GenericFilter.__init__ (self) self.skip_files |= set ([ # Contains no copyright of its own, but quotes the GPL. 'intro.xml', ]) self.skip_dirs |= set ([ # Contains automatically-generated sources. 'html', # Contains imported images 'images', ]) self.own_files |= set ([ # Contains markup around the copyright owner. 'spine.xml', ]) def get_line_filter (self, dir, filename): if filename == 'boost_concept_check.h': return re.compile ('// \(C\) Copyright Jeremy Siek') return GenericFilter.get_line_filter (self, dir, filename) class GCCCopyright (Copyright): def __init__ (self, errors): Copyright.__init__ (self, errors) canon_fsf = 'Free Software Foundation, Inc.' self.add_package_author ('Free Software Foundation', canon_fsf) self.add_package_author ('Free Software Foundation.', canon_fsf) self.add_package_author ('Free Software Foundation Inc.', canon_fsf) self.add_package_author ('Free Software Foundation, Inc', canon_fsf) self.add_package_author ('Free Software Foundation, Inc.', canon_fsf) self.add_package_author ('The Free Software Foundation', canon_fsf) self.add_package_author ('The Free Software Foundation, Inc.', canon_fsf) self.add_package_author ('Software Foundation, Inc.', canon_fsf) self.add_external_author ('ARM') self.add_external_author ('AdaCore') self.add_external_author ('Ami Tavory and Vladimir Dreizin, IBM-HRL.') self.add_external_author ('Cavium Networks.') self.add_external_author ('Faraday Technology Corp.') self.add_external_author ('Florida State University') self.add_external_author ('Greg Colvin and Beman Dawes.') self.add_external_author ('Hewlett-Packard Company') self.add_external_author ('Information Technology Industry Council.') self.add_external_author ('James Theiler, Brian Gough') self.add_external_author ('Makoto Matsumoto and Takuji Nishimura,') self.add_external_author ('National Research Council of Canada.') self.add_external_author ('Peter Dimov and Multi Media Ltd.') self.add_external_author ('Peter Dimov') self.add_external_author ('Pipeline Associates, Inc.') self.add_external_author ('Regents of the University of California.') self.add_external_author ('Silicon Graphics Computer Systems, Inc.') self.add_external_author ('Silicon Graphics') self.add_external_author ('Stephen L. Moshier') self.add_external_author ('Sun Microsystems, Inc. All rights reserved.') self.add_external_author ('The Go Authors. All rights reserved.') self.add_external_author ('The Go Authors. All rights reserved.') self.add_external_author ('The Go Authors.') self.add_external_author ('The Regents of the University of California.') self.add_external_author ('Unicode, Inc.') self.add_external_author ('University of Toronto.') class GCCCmdLine (CmdLine): def __init__ (self): CmdLine.__init__ (self, GCCCopyright) self.add_dir ('.', TopLevelFilter()) # boehm-gc is imported from upstream. self.add_dir ('config', ConfigFilter()) # contrib isn't really part of GCC. self.add_dir ('fixincludes') self.add_dir ('gcc', GCCFilter()) self.add_dir (os.path.join ('gcc', 'testsuite'), TestsuiteFilter()) self.add_dir ('gnattools') self.add_dir ('include') self.add_dir ('libatomic') self.add_dir ('libatomic') self.add_dir ('libada') self.add_dir ('libbacktrace') self.add_dir ('libcpp', LibCppFilter()) self.add_dir ('libdecnumber') # libffi is imported from upstream. self.add_dir ('libgcc', LibGCCFilter()) self.add_dir ('libgfortran') self.add_dir ('libgomp') self.add_dir ('libiberty') self.add_dir ('libitm') self.add_dir ('libjava', LibJavaFilter()) self.add_dir (os.path.join ('libjava', 'testsuite'), TestsuiteFilter()) self.add_dir ('libmudflap') self.add_dir ('libobjc') self.add_dir ('libquadmath') # libsanitiser is imported from upstream. self.add_dir ('libssp') self.add_dir ('libstdc++-v3', LibStdCxxFilter()) self.add_dir ('lto-plugin') # zlib is imported from upstream. GCCCmdLine().main() ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [committed] 2011 and 2012 Copyright year updates 2013-01-08 20:49 ` Richard Sandiford @ 2013-01-10 14:17 ` Jakub Jelinek 0 siblings, 0 replies; 18+ messages in thread From: Jakub Jelinek @ 2013-01-10 14:17 UTC (permalink / raw) To: Joseph S. Myers, Andrew Pinski, gcc-patches, rdsandiford On Tue, Jan 08, 2013 at 08:48:52PM +0000, Richard Sandiford wrote: > Tested on x86_64-linux-gnu. OK to install? Ok, thanks. Jakub ^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2013-01-10 14:17 UTC | newest] Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-01-04 12:54 [committed] 2011 and 2012 Copyright year updates Jakub Jelinek 2013-01-04 16:44 ` Andrew Pinski 2013-01-04 16:49 ` Jakub Jelinek 2013-01-06 12:14 ` Richard Sandiford 2013-01-06 12:44 ` Jakub Jelinek 2013-01-06 21:48 ` Richard Sandiford 2013-01-07 8:56 ` Richard Biener 2013-01-06 20:24 ` Mike Stump 2013-01-06 20:37 ` Mike Stump 2013-01-06 21:53 ` Richard Sandiford 2013-01-07 16:00 ` Joseph S. Myers 2013-01-07 19:49 ` Richard Sandiford 2013-01-07 19:59 ` Bruce Korb 2013-01-07 20:22 ` Richard Sandiford 2013-01-07 20:30 ` Bruce Korb 2013-01-07 20:31 ` Joseph S. Myers 2013-01-08 20:49 ` Richard Sandiford 2013-01-10 14:17 ` Jakub Jelinek
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).