Improving creation of debian copyright file
In my opinion, creating and maintaining Debian copyright file is the most boring task required to create a Debian package. Unfortunately, this file is also one of the most important of a package: it specifies some legal aspect regarding the use of the software.
Debian copyright file is scrutinized by ftp masters gatekeepers when accepting a new package in Debian project: this file must accurately describe the copyright and licenses of all files of a source package, preferably using a specific syntax. (Kudos to the ftp-masters team: reading copyright files must be even more boring than writing them).
The content of the copyright file must reflect accurately the license of all files. This license is often specified in the comments of a source files. The licensecheck command is able to scan sources files and reports the copyright and licenses declared in there. But it does not summarize this information: a copyright line is generated for each file of a package.
licensecheck2dep5 (provided by cdbs package as /usr/lib/cdbs/licensecheck2dep5) does better: the output of licensecheck is consolidated and translated in Debian copyright format. The result is better, but must be heavily edited to be reviewable by ftp-masters team.
update subcommand of cme (available with libconfig-model-dpkg-perl 2.061 currently in experimental) goes further than licensecheck2deb:
- copyright are coalesced when possible (i.e. 2001,2002,2003-2005 is changed to 2001-2005)
- file entries same copyright owner and license are grouped, group of files may be represented with a wild card (‘*’)
- license text is filled with actual text for the most popular licenses
For instance, here’s the (slightly edited) output of cme run for pan package starting without debian/copyright file:
$ cme update dpkg-copyright Adding dummy license text for license public-domain for path pan/general/sorted-vector.h Adding dummy license text for license BSD-2-clause for path pan/usenet-utils/MersenneTwister.h $ cat debian/copyright Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Files: * Copyright: 1994-2001, Frank Pilhofer. The author may License: GPL-2+ Files: pan/* Copyright: 2002-2007, Charles Kerr License: GPL-2 Files: pan/data/cert-store.cc pan/data/cert-store.h Copyright: 2011, Heinrich Müller 2002-2006, Charles Kerr License: GPL-2 Files: pan/general/e-util.cc pan/general/e-util.h Copyright: 2000, 2001, Ximian, Inc License: LGPL-2 Files: pan/general/locking.h pan/general/worker-pool.cc pan/general/worker-pool.h Copyright: 2007, Calin Culianu 2002-2007, Charles Kerr License: LGPL-2+ Files: pan/general/sorted-vector.h Copyright: 2002, Martin Holzherr (firstname.lastname@example.org). License: public-domain Please fill license public-domain from header of pan/general/sorted-vector.h [ about 100 more lines including license text for Zlib and several GPL licenses ]
This is a good start, but some modifications must be applied to get a correct license file:
- add missing upstream information (Upstream-Name, Upstream-Contact and Source items)
- remove irrelevant text from some copyright owner (e.g. remove “The author may” from Files: * entry).
- add some missing license text (e.g. include text from sorted-vector.h comments to specify upstream author’s version of public-domain)
These modifications can be done:
- directly after update by running
cme update dpkg-copyright --edit
- after update by running
cme edit dpkg-copyright
- with your favorite editor
This post has mentioned creation of Debian copyright file, but does not address the problem of updating an existing copyright file when packaging a new version of a software. This will be the subject of a next post.
I hope this new feature of cme will save hours of work for Debian packagers. As usual comments and suggestions are welcome.
Last but not least, the following packages are required:
You may want to install also libconfig-model-tkui-perl to update the copyright file with cme GUI.
All the best
- Removed -quiet option from cme example. This option is not recommended to learn cme update.
- Added link to github wiki page