Skip to content

Improving creation of debian copyright file

April 5, 2015

Hello

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.

The new 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 (holzherr@infobrain.com).
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.

See also Updating debian copyright file with cme wiki page on github

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

 

[edited]:

  • Removed -quiet option from cme example. This option is not recommended to learn cme update.
  • Added link to github wiki page
12 Comments
  1. alanpater permalink

    Timely post! Over at exiv2 we are wondering how to handle test images. These were often included in bug reports without any rights specified. Any tips on how to handle that would be greatly appreciated.

    • No rights specified means that you have no permission to distribute or modify them. Don’t include them in your project without an accompanying license.

    • Agreed. You must ask for permission to use the images in your project. But not only that. The permission must also apply to distribution like Debian who package exiv2. Debian is even more strict: Debian users must have a right to modify the image.

      Phrasing this set of permission in a legally meaningful way is not easy. You should ask people who contribute test image to choose a license that is compatible with DFSG requirements. Then you will have to keep tracks of image owners and licenses to prove that you have the right to redistribute these images and provide this information in exiv2 software bundle.

      Hope this helps

  2. osamu aoki permalink

    Have you checked debmake?
    It make a template file for copyright.

    • I did not know about the copyright feature of debmake. I’ll check this out.

  3. tanks Dominique, this is just amazing!

  4. Corsac permalink

    The system chokes with a copyright like this:

    Copyright (C) 2012-14

    • Hmm, yeah. Some people can be creative when writing their copyright statement. I’ll tweak the code to accept this input. Please use Debian BTS (run reportbug libconfig-model-dpkg-perl) to report such issues.

  5. I don’t get cme in as a command :-

    [$] dpkg -L libconfig-model-dpkg-perl | grep cme
    [$]

    [$] dpkg -l libconfig-model-dpkg-perl

    Desired=Unknown/Install/Remove/Purge/Hold
    | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
    |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
    ||/ Name Version Architecture Description
    +++-==============================-====================-====================-=================================================================
    ii libconfig-model-dpkg-perl 2.065 all editor for Dpkg source files with validation

    [$] cme update dpkg-copyright -quiet

    zsh: command not found: cme

    Look forward to update.

    • Sorry, I forgot to list the required packages. I’m going to edit the post to add this information.

      All the best

Trackbacks & Pingbacks

  1. Improving update of existing debian/copyright file | Ddumont's Blog

Leave a comment