Home | History | Annotate | Download | only in docs
      1 Contents:
      2 
      3 1. The copyright-extractor script
      4 2. Using the script
      5 3. Adding copyright files to spec files
      6 
      7 -----------------------------------------------------------------------------
      8 
      9 1. The copyright-extractor script
     10 
     11 The copyright-extractor script can be used to find copyright
     12 and licensing comments in source files.
     13 
     14 The script looks at C, C++, Java, Python, Perl and shell script
     15 files (based on file name) and finds all comments that appear
     16 in the file before actual code starts.
     17 
     18 Then it finds identical comments.  This works for some modules,
     19 where standard comment blocks are used, however even in those
     20 modules, the authors and copyright holders may be different in
     21 each module.  So the next step is trying to merge the licenses.
     22 
     23 Consider these 2 headers:
     24 
     25 
     26 /* ATK -  Accessibility Toolkit
     27  * Copyright 2007 Sun Microsystems Inc.
     28  *
     29  * This library is free software; you can redistribute it and/or
     30  * modify it under the terms of the GNU Library General Public
     31  * License as published by the Free Software Foundation; either
     32  * version 2 of the License, or (at your option) any later version.
     33  *
     34  * This library is distributed in the hope that it will be useful,
     35  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     36  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     37  * Library General Public License for more details.
     38  *
     39  * You should have received a copy of the GNU Library General Public
     40  * License along with this library; if not, write to the
     41  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
     42  * Boston, MA 02111-1307, USA.
     43  */
     44 
     45 
     46 /* ATK -  Accessibility Toolkit
     47  * Copyright 2001 Sun Microsystems Inc.
     48  *
     49  * This library is free software; you can redistribute it and/or
     50  * modify it under the terms of the GNU Lesser General Public
     51  * License as published by the Free Software Foundation; either
     52  * version 2 of the License, or (at your option) any later version.
     53  *
     54  * This library is distributed in the hope that it will be useful,
     55  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     56  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     57  * Lesser General Public License for more details.
     58  *
     59  * You should have received a copy of the GNU Lesser General Public
     60  * License along with this library; if not, write to the
     61  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
     62  * Boston, MA 02111-1307, USA.
     63  */
     64 
     65 
     66 The only difference is the copyright year.  The merged license will
     67 be:
     68 
     69 
     70  ATK -  Accessibility Toolkit
     71  Copyright 2001 Sun Microsystems Inc.
     72 
     73  Copyright 2007 Sun Microsystems Inc.
     74 
     75  This library is free software; you can redistribute it and/or
     76  modify it under the terms of the GNU Lesser General Public
     77  License as published by the Free Software Foundation; either
     78  version 2 of the License, or (at your option) any later version.
     79 
     80  This library is distributed in the hope that it will be useful,
     81  but WITHOUT ANY WARRANTY; without even the implied warranty of
     82  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     83  Lesser General Public License for more details.
     84 
     85  You should have received a copy of the GNU Lesser General Public
     86  License along with this library; if not, write to the
     87  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
     88  Boston, MA 02111-1307, USA.
     89 
     90 
     91 There are usually bigger differences between comments.  Merging
     92 only takes place if at least 10 lines match. There may be many more
     93 authors and copyright holders and additional comments at the end
     94 of the license comments.  This can sometimes cause weird results.
     95 In general, the fewer files checked, the better the results.
     96 In the case of something like SUNWgnome-base-libs, I recommend
     97 extracting the licenses for each component (atk, glib, gtk, pango,
     98 cairo, ...) separately and manually merging them.
     99 
    100 In all cases, the output must be carefully reviewed, edited
    101 and the unnecessary lines deleted.
    102 
    103 Copyright notices should appear at the beginning of each license
    104 block (as per Sun guidelines).  When you find copyright notices
    105 that only differ in the year or the addition of an email address,
    106 it's safe to merge them.  Examples:
    107 
    108 if you find things like this:
    109 
    110   Copyright (C) 2003, 2006 Red Hat, Inc.
    111   Copyright (C) 2004, 2005 Red Hat, Inc.
    112   Copyright (C) 2003, 2004, 2007 Red Hat, Inc.
    113   Copyright (C) 2003, 2004, 2005 Red Hat, Inc.
    114   Copyright (C) 2003, 2004 Red Hat, Inc.
    115   Copyright (C) 2002-2006 Red Hat Inc.
    116   Copyright (C) 2002, 2003, 2006 Red Hat, Inc.
    117   Copyright (C) 2002, 2003, 2005 Red Hat Inc.
    118   Copyright (C) 2002, 2003, 2004, 2006 Red Hat Inc.
    119   Copyright (C) 2002, 2003, 2004, 2005 Red Hat, Inc.
    120   Copyright (C) 2002, 2003, 2004 Red Hat Inc.
    121   Copyright (C) 2002, 2006 Red Hat Inc.
    122   Copyright (C) 2002, 2005 Red Hat Inc.
    123   Copyright (C) 2002, 2004 Red Hat Inc.
    124   Copyright (C) 2002, 2003 Red Hat, Inc.
    125   Copyright (C) 2007 Red Hat Inc.
    126   Copyright (C) 2006 Red Hat, Inc.
    127   Copyright (C) 2005 Red Hat, Inc.
    128   Copyright (C) 2004 Red Hat, Inc.
    129   Copyright (C) 2003 Red Hat, Inc.
    130   Copyright (C) 2003 Red Hat, Inc.
    131 
    132 consolidate this down to:
    133 
    134   Copyright (C) 2002-2007 Red Hat, Inc.
    135 
    136 Or in this case:
    137 
    138   Copyright (C) 2007, Jamie McCracken 
    139   Copyright (C) 2007, Jamie McCracken <jamiemcc (a] blueyonder.co.uk>
    140  
    141 it's enought to keep the latter, it's clearly the same person.
    142 
    143 Note that if the source file contains only a reference to a file
    144 not easily  accessible to the reader of the package copyright file
    145 (e.g., the example below with a reference to a file that must be
    146 ftp'ed), you will need to include the text from the COPYING file
    147 that is referenced:
    148 
    149  /* (C) 1998-2002 Red Hat, Inc. -- Licensing details are in the COPYING
    150     file accompanying popt source distributions, available from
    151     ftp://ftp.rpm.org/pub/rpm/dist */
    152 
    153 If you suspect that something went wrong during the smart
    154 merge (the output looks bogus) or the merges result in weird
    155 license texts even if you run the script subdirectory by
    156 subdirectory, you can use the -r (or --raw) option.  This
    157 causes the script to only unify identical comments.  In this
    158 mode does not attempt to do the "smart merge".
    159 
    160 There's also -g (or --gpl) option that can be used to detect
    161 if any of the licenses in the output appears to be LGPL or GPL,
    162 in which case it puts Sun's standard disclaimer about the choice
    163 of GPLv2.
    164 
    165 The -c (or --copyright-first) option copies the copyright
    166 statements and author names to the beginning of each license
    167 block, as required by Sun guidelines.  This option only works
    168 if the copyright lines don't extent to multiple lines, e.g.
    169 the following will break badly:
    170 
    171    Copyright (c) yeah Some Company, Inc
    172    All rights reserved.
    173    Use is subject to license terms.
    174 
    175    Authors:
    176 	joe.bloggs (a] some-company.com
    177 
    178 The result will be that the Copyright line is moved, but the
    179 rest of the lines stay where they were.  I would say that
    180 this option is less that useful.
    181 
    182 The -O (or --omitted) option prints the list of files NOT read
    183 by this script.
    184 
    185 
    186 2. Using the script
    187 
    188 The copyright-extractor script is used for creating copyright
    189 files for SUNW packages.  Since the contributors (who are
    190 usually copyright owners) and even licenses are subject to
    191 change, this process needs to be repeated each time we update
    192 GNOME in Nevada, typically once every 6 months.
    193 
    194 The recommended way to run the script is:
    195 
    196     pkgtool prep --download SUNWfoo.spec
    197     scripts/copyright-extractor -g /path/to/BUILD/SUNWfoo-version \
    198        > copyright.txt
    199 
    200 As mentioned earlier, in the case of larger packages, it's
    201 a good idea and sometimes necessary to run the script for each
    202 component or ever each subdirectory of larger components:
    203 
    204     scripts/copyright-extractor -g /path/to/BUILD/SUNWfoo-version/libfoo \
    205       > copyright.txt
    206     scripts/copyright-extractor -g /path/to/BUILD/SUNWfoo-version/libbar \
    207       >> copyright.txt
    208     ...
    209 
    210 Then, review and edit the copyright.txt file to create
    211 SUNWfoo.copyright.
    212 
    213 
    214 3. Adding copyright files to spec files
    215 
    216 Each SUNW spec file needs a copyright file, "base" spec files
    217 don't need copyright files.
    218 
    219 Place the copyright file in spec-files/copyright/
    220 The naming convention is SUNWpackage-name.copyright.
    221 Then edit SUNWpackage-name.spec and add
    222 
    223 SUNW_Copyright:           %{name}.copyright
    224 
    225 in the preamble (i.e. where Name, Version, etc. are). The subpackages
    226 (-devel, -root, etc.) inherit this setting from the main package
    227 so you don't need to repeat this line in the %package section.
    228 
    229