~ubuntu-branches/ubuntu/vivid/parted/vivid

« back to all changes in this revision

Viewing changes to build-aux/update-copyright

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2014-07-21 10:23:16 UTC
  • mfrom: (7.2.32 sid)
  • Revision ID: package-import@ubuntu.com-20140721102316-jsyv3yzmbo8vlde5
Tags: 3.1-3
Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
    if 0;
4
4
# Update an FSF copyright year list to include the current year.
5
5
 
6
 
my $VERSION = '2009-12-28.11:09'; # UTC
 
6
my $VERSION = '2012-02-05.21:39'; # UTC
7
7
 
8
 
# Copyright (C) 2009-2010 Free Software Foundation, Inc.
 
8
# Copyright (C) 2009-2012 Free Software Foundation, Inc.
9
9
#
10
10
# This program is free software: you can redistribute it and/or modify
11
11
# it under the terms of the GNU General Public License as published by
22
22
 
23
23
# Written by Jim Meyering and Joel E. Denny
24
24
 
25
 
# The arguments to this script should be names of files that contain FSF
26
 
# copyright statements to be updated.  For example, you might wish to
27
 
# use the update-copyright target rule in maint.mk from gnulib's
28
 
# maintainer-makefile module.
29
 
#
30
 
# Iff an FSF copyright statement is recognized in a file and the final
 
25
# The arguments to this script should be names of files that contain
 
26
# copyright statements to be updated.  The copyright holder's name
 
27
# defaults to "Free Software Foundation, Inc." but may be changed to
 
28
# any other name by using the "UPDATE_COPYRIGHT_HOLDER" environment
 
29
# variable.
 
30
#
 
31
# For example, you might wish to use the update-copyright target rule
 
32
# in maint.mk from gnulib's maintainer-makefile module.
 
33
#
 
34
# Iff a copyright statement is recognized in a file and the final
31
35
# year is not the current year, then the statement is updated for the
32
36
# new year and it is reformatted to:
33
37
#
36
40
#   3. Expand copyright year intervals.  (See "Environment variables"
37
41
#      below.)
38
42
#
39
 
# A warning is printed for every file for which no FSF copyright
 
43
# A warning is printed for every file for which no copyright
40
44
# statement is recognized.
41
45
#
42
 
# Each file's FSF copyright statement must be formated correctly in
 
46
# Each file's copyright statement must be formatted correctly in
43
47
# order to be recognized.  For example, each of these is fine:
44
48
#
45
49
#   Copyright @copyright{} 1990-2005, 2007-2009 Free Software
59
63
#   ## Copyright (C) 1990-2005, 2007-2009 Free Software
60
64
#   #  Foundation, Inc.
61
65
#
62
 
# The following copyright statement is not recognized because the
63
 
# copyright holder is not the FSF:
64
 
#
65
 
#   Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
66
 
#
67
 
# However, any correctly formatted FSF copyright statement following
68
 
# either of the previous two copyright statements would be recognized.
69
 
#
70
 
# The exact conditions that a file's FSF copyright statement must meet
 
66
# However, any correctly formatted copyright statement following
 
67
# a non-matching copyright statements would be recognized.
 
68
#
 
69
# The exact conditions that a file's copyright statement must meet
71
70
# to be recognized are:
72
71
#
73
 
#   1. It is the first FSF copyright statement that meets all of the
74
 
#      following conditions.  Subsequent FSF copyright statements are
 
72
#   1. It is the first copyright statement that meets all of the
 
73
#      following conditions.  Subsequent copyright statements are
75
74
#      ignored.
76
75
#   2. Its format is "Copyright (C)", then a list of copyright years,
77
 
#      and then the name of the copyright holder, which is "Free
78
 
#      Software Foundation, Inc.".
 
76
#      and then the name of the copyright holder.
79
77
#   3. The "(C)" takes one of the following forms or is omitted
80
78
#      entirely:
81
79
#
84
82
#        C. @copyright{}
85
83
#        D. ©
86
84
#
87
 
#   4. The "Copyright" appears at the beginning of a line except that it
 
85
#   4. The "Copyright" appears at the beginning of a line, except that it
88
86
#      may be prefixed by any sequence (e.g., a comment) of no more than
89
 
#      5 characters.
 
87
#      5 characters -- including white space.
90
88
#   5. Iff such a prefix is present, the same prefix appears at the
91
89
#      beginning of each remaining line within the FSF copyright
92
90
#      statement.  There is one exception in order to support C-style
112
110
#      interval (such as 1990-2008).  If unset or set to 0, all existing
113
111
#      copyright year intervals in a reformatted FSF copyright statement
114
112
#      are expanded instead.
 
113
#      If UPDATE_COPYRIGHT_USE_INTERVALS=2, convert a sequence with gaps
 
114
#      to the minimal containing range.  For example, convert
 
115
#      2000, 2004-2007, 2009 to 2000-2009.
115
116
#   3. For testing purposes, you can set the assumed current year in
116
117
#      UPDATE_COPYRIGHT_YEAR.
117
118
#   4. The default maximum line length for a copyright line is 72.
118
119
#      Set UPDATE_COPYRIGHT_MAX_LINE_LENGTH to use a different length.
 
120
#   5. Set UPDATE_COPYRIGHT_HOLDER if the copyright holder is other
 
121
#      than "Free Software Foundation, Inc.".
119
122
 
120
123
use strict;
121
124
use warnings;
122
125
 
123
126
my $copyright_re = 'Copyright';
124
127
my $circle_c_re = '(?:\([cC]\)|@copyright{}|©)';
125
 
my $holder = 'Free Software Foundation, Inc.';
 
128
my $holder = $ENV{UPDATE_COPYRIGHT_HOLDER};
 
129
$holder ||= 'Free Software Foundation, Inc.';
126
130
my $prefix_max = 5;
127
131
my $margin = $ENV{UPDATE_COPYRIGHT_MAX_LINE_LENGTH};
128
132
!$margin || $margin !~ m/^\d+$/
220
224
                  }))
221
225
                )+
222
226
              /$1-$3/gx;
 
227
 
 
228
            # When it's 2, emit a single range encompassing all year numbers.
 
229
            $ENV{UPDATE_COPYRIGHT_USE_INTERVALS} == 2
 
230
              and $stmt =~ s/\b(\d{4})\b.*\b(\d{4})\b/$1-$2/;
223
231
          }
224
232
 
225
233
        # Format within margin.
252
260
  }
253
261
else
254
262
  {
255
 
    print STDERR "$ARGV: warning: FSF copyright statement not found\n";
 
263
    print STDERR "$ARGV: warning: copyright statement not found\n";
256
264
  }
257
265
 
258
266
# Local variables: