Config...yright(3pm)

this page is Config...yright(3pm) from the User Contributed Perl Documentation β€” and bestie, it's a good one πŸ’–

🌸 NAME 🌸

Config::Model::Dpkg::Copyright β€” it fills the File sections of the debian/copyright file. That's the whole vibe. ✨


πŸŽ€ SYNOPSIS πŸŽ€

# this modules is used by cme when invoked with this command
$ cme update dpkg-copyright

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so real talk: maintaining debian/copyright is the most tedious chore, and this command exists specifically to save you from it. When you package a new release of a software, you can run cme update dpkg-copyright and it updates the content of the copyright file for you. no cap. πŸ’…

It scans your current package directory, extracts copyright and license info, and stores all of that in the Files sections of debian/copyright. lowkey magic.

So in your Debian package directory, the ritual goes:

  • run cme update dpkg-copyright or cme update dpkg
  • check the result with your favorite VCS diff tool. (you do use a VCS for your package files, do you ?) πŸ‘€
Note: this command is experimental. πŸ§ͺ proceed accordingly, bestie.

The Files: debian/* section from debian/copyright is often the only place containing copyright information for the files created by the Debian maintainer. So all Files entries beginning with debian/ are preserved during the update. πŸ’Ύ

But heads up β€” entries that don't match an existing file or directory get removed. gone. deleted. πŸ’€

🌈 Tweak results 🌈

You can tweak the results in one of these ways:

  • Changing the list of files to scan or ignore. (By default, licensecheck will decide which file to scan or not.)
  • Specifying information for individual files
  • Tweaking the copyright entries created by grouping and coalescing information.

The first 2 ways are described in "Selecting or ignoring files to scan" in Dpkg::Copyright::Scanner and "Filling the blanks" in Dpkg::Copyright::Scanner.

The last way is described below: ⬇️

Because extracting copyright info from source files is based on comments, the result is sometimes lackluster. 😭 So you may specify instructions to alter or set specific copyright entries in the debian/fix.scanned.copyright file (or debian/<source-package>.fix.scanned.copyright).

cme stores the copyright information in a tree. Entries in fix.scanned.copyright give instructions for traversing the cme tree and modifying entries. Want to see the debian/copyright file translated into this syntax? Run cme dump --format cml dpkg-copyright. Every line of this file gets handled by Config::Model::Loader to modify the copyright information, and the full syntax is documented in "load string syntax" in the Config::Model::Loader section. iykyk. πŸ“š

πŸ’– Example πŸ’–

If the extracted copyright contains:

Files: *
Copyright: 2014-2015, Adam Kennedy <adamk@cpan.org> "foobar
License: Artistic or GPL-1+

You may add this line in the debian/fix.scanned.copyright file:

! Files:"*" Copyright=~s/\s*".*//

This way, the copyright information will be updated from the file content, but the extra "foobar will always be scrubbed away during updates. ate and left no crumbs. ✨

Comments are accepted in Perl and C++ style from the beginning of the line. Lines breaks are ignored.

Here's another, more complex example:

// added a global license, MIT license text is filled by Config::Model
! copyright License:MIT

# don't forget '!' to go back to tree root
! copyright Files:"pan/general/map-vector.h" Copyright="2001,Andrei Alexandrescu"
  License short_name=MIT
# delete license text since short_name points to global  MIT license
  full_license~

# use a loop there vvvvvv to clean up that vvvvvvvvvvvvvvvvvvvvvvv in all copyrights
! copyright   Files:~/.*/     Copyright=~s/all\s*rights\s*reserved//i

# defeat spammer by replacing all '@' in emails of 3rdparty files
# the operation :~/^3party/ loops over all Files entries that match ^3rdparty
# and modify the copyright entry with a Perl substitution
! Files:~/^3rdparty/ Copyright=~s/@/(at)/

Sometimes, you might want to find an entry that spans multiple lines. You can pull that off by double quoting the whole value:

! Files:"uulib/crc32.h
uulib/uustring.h" Copyright="2019 John Doe"

πŸ‘‘ Under the hood πŸ‘‘

This section explains how cme merges the information from the existing debian/copyright file (the "old" information) with the information extracted by licensecheck (the "new" information):

  • The old and new information are compared in the form of file lists:
    • New file entries are kept as is in the new list.
    • When a file entry is found in both old and new lists, the new Β© and license short names are checked. If they are unknown, the information from the old list is copied in the new list.
    • Old files entries not found in the new list are deleted.
  • File entries are coalesced in the new list to reduce redundancies (this mechanism is explained in this blog https://ddumont.wordpress.com/2015/04/05/improving-creation-of-debian-copyright-file)
  • License entries are created, either attached to Files specification or as global licenses. License text is added for known license (actually known by Software::License)
  • Directories (path ending with "/*") from old list then checked:
    • Directory is found in the new list: the old information is clobbered by new information.
    • Directory not found in new list but exists: the old information is copied in the new list.
    • Directory is not found: the old information is discarded
  • Files entries are sorted and the new debian/copyright is generated.

πŸ”₯ update πŸ”₯

Updates data using the output scan_files in Dpkg::Copyright::Scanner.

Parameters in %args:

  • quiet β€” set to 1 to suppress progress messages. Should be used only in tests.

Otherwise, %args is passed to scan_files. 🫑


πŸ’œ AUTHOR πŸ’œ

Dominique Dumont <dod@debian.org> β€” absolute legend. πŸ‘‘


and that's a wrap bestie πŸŽ€ this whole thing rode in on perl v5.42.3 dated 2026-08-30 β€” go forth and let cme handle your debian/copyright so you don't have to. slay. πŸ’…βœ¨

πŸ“¦ where this page comes from