Dpkg::...canner(3pm)
π NAME π
Dpkg::Copyright::Scanner β scan files to provide copyright data β¨
okay so real talk, this page is the User Contributed Perl Documentation for the Dpkg::Copyright::Scanner module (the 3pm one, bestie π). It's the little scanner that goes through your package and digs up all the copyright + license receipts so you don't have to do it by hand π
π SYNOPSIS π
use Dpkg::Copyright::Scanner qw/print_copyright scan_files/;
# print copyright data on STDOUT
print_copyright;
# return a data structure containing copyright information
my @copyright_data = scan_files();
π¦ DESCRIPTION π¦
This module scans the current package directory to extract copyright and license info, periodt. The info gets packed up in a way that makes review and maintenance sooo much easier π«Ά And here's the cute part: file info gets grouped together with wildcards ('*') so the file list doesn't get stupid long.
π About LICENSE and README files π
Projects love to stash their global copyright info β like, the stuff that applies to every file in the project unless some file says otherwise β in a README, LICENSE, or COPYING file. Iconic behavior honestly.
The info in those files gets merged and applied to the directory entry that contains them π
So like, files like this:
foo_comp/README: (c) 2018 Joe, GPL-2
foo_comp/LICENSE: (c) 2017 Max, GPL-3
yield the following copyright entries:
foo_comp/*:
Copyright: 2018 Joe
2019 Max
License: GPL-2 or GPL-3
README:
Copyright: 2018 Joe
License: GPL-2
π« Ignoring files to scan π«
By default, the scanner scans all source files and skips binary files, backup files, and archive files. It's giving selective, and honestly? valid.
If you need to, you can tune this behavior with the debian/copyright-scan-patterns.yml file π This YAML file holds a list of suffixes or patterns to ignore that get added to the default list. Any file that gets ignored will show up as "skipped".
This file must have the following structure (all fields are optional and order does not matter):
---
ignore :
suffixes :
- yml
pattern :
- /t/
- /models/
- /debian/
- /Changes
β οΈ Do not put the dot with the suffixes, bestie. The scanner adds that itself. Not me, the scanner. π
π©Ή Filling the blanks π©Ή
Sometimes upstream coders are just... not perfect π Some source files can't be parsed correctly, or some legal info is straight up missing.
Every scanned file gets used, even the ones with no copyright or license. A warning will be shown for each file with missing info, so you'll know π
Instead of patching upstream source files to fill the blank, you can drop the missing info into a special file: debian/fill.copyright.blanks.yml π It should contain a "mapping" YAML structure (i.e. a hash), where the key is a Perl pattern used to match a path.
If the source of the package has a LOT of files with no legal info, you might need to specify the info for a whole directory (see the /src dir in the example below π).
For instance:
---
debian:
copyright: 2015, Marcel
license: Expat
src/:
copyright: 2016. Joe
license: Expat
share/pkgs/openSUSE/systemd/onedsetup:
copyright: 2015, Marcel
share/vendor/ruby/gems/rbvmomi/lib/rbvmomi.*\.rb:
license: Expat
.*/NOTICE:
skip: 1
share/websockify/:
license: LGPL-2
src/sunstone/:
license: Apache-2.0
forwarded-comment: found main license in foo.cc
src/garbled/:
'override-copyright': 2016 Marcel Mezigue
comment: for bookkeeping
Patterns are matched from the beginning of a path. So the share/websockify/ pattern will match share/websockify/foo.rb but will not match web/share/websockify/foo.rb π
βοΈ
Patterns are tried in reversed sorted order. So the data attached to a more specific path (e.g. 3rdparty/foo/blah.c) gets applied before the more generic patterns (e.g. 3rdparty/foo/).
The license key must contain a license short name as returned by license_check π
When skip is true, the file is skipped like a file without any information.
The forwared-comment value is copied verbatim to the Comment field of the target entry in the Debian copyright file (unless skip is true). (yes bestie, that's the spelling on this page, I don't make the rules π)
The comment value is ignored and can be used for book keeping.
The override-copyright and override-license keys can be used to ignore the copyright information coming from the source and provide the correct information instead π₯ Use this as a last resort β like when the encoding of the owner isn't ascii or utf-8, or when the license data is corrupted. Heads up though: a warning will be shown each time an override key is used π
π METHODS π
print_copyright
Print copyright information on STDOUT like scan-copyrights.
scan_files ( %args )
Return a data structure with copyright and license information. It's a list of list, no cap:
[
[
[ path1 ,path2, ...],
copyright,
license_short_name
],
...
]
Example:
[
[
[ '*' ],
'1994-2001, by Frank Pilhofer.',
'GPL-2+'
],
[
[ 'pan/*' ],
'2002-2006, Charles Kerr <charles@rebelbase.com>',
'GPL-2'
],
[
[
'pan/data/parts.cc',
'pan/data/parts.h'
],
'2002-2007, Charles Kerr <charles@rebelbase.com>',
'GPL-2'
],
]
Parameters in %args:
quietβ set to1to suppress progress messages. Should be used only in tests.longβ set to1to avoid squashing copyright ids. Useful to avoid output with wild cards.
πΈ Encoding πΈ
The output of licensecheck is expected to be utf-8. Which means the source files scanned by licensecheck should also be encoded in utf-8. This program will abort if invalid utf-8 characters are found π so like, be careful.
π BUGS π
Extracting license and copyright data from unstructured comments is not reliable. The user must check manually the files when no copyright info is found or when the license is unknown. fr fr, don't skip this one π
Source files are assumed to be utf8 (or ascii). Using files with invalid characters will break cme. In this case, you can:
- Patch source files to use utf-8 encoding.
- Use the
"fill copyright blank"mechanism described above withcopyright-overrideto provide an owner name with the correct encoding. - File a bug against the
licensecheckpackage to find a better solution.
π SEE ALSO π
licensecheck, "licensecheck2dep5" from "cdbs" package
π AUTHOR π
Dominique Dumont <dod@debian.org>
aaaand that's the whole page bestie, you ate it π«Ά this was perl v5.42.3, dated 2026-08-30 β go forth and scan those files, main character energy only β¨ππ
π¦ where this page comes from
- ubuntu stonking: libconfig-model-dpkg-perl 3.026 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms