.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Dpkg::Copyright::Scanner 3pm" .TH Dpkg::Copyright::Scanner 3pm 2024-03-03 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME .Vb 1 \& Dpkg::Copyright::Scanner \- Scan files to provide copyright data .Ve .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& 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(); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" This modules scans current package directory to extract copyright and license information. Information are packed in a way to ease review and maintenance. Files information is grouped with wildcards ('*') to reduce the list of files. .SS "About LICENSE and README files" .IX Subsection "About LICENSE and README files" Projects often store global copyright information, i.e. information that apply to all files of a project (unless specified otherwise in some files) in README or LICENSE or COPYING file. .PP The information contained in these files id merged and applied to the directory entry that contain them. .PP I.e files like: .PP .Vb 2 \& foo_comp/README: (c) 2018 Joe, GPL\-2 \& foo_comp/LICENSE: (c) 2017 Max, GPL\-3 .Ve .PP yield the following copyright entries: .PP .Vb 4 \& foo_comp/*: \& Copyright: 2018 Joe \& 2019 Max \& License: GPL\-2 or GPL\-3 \& \& README: \& Copyright: 2018 Joe \& License: GPL\-2 .Ve .SH "Ignoring files to scan" .IX Header "Ignoring files to scan" By default, scanner scans all source files and skip binary files, backup and archive files. .PP If needed, this behavior can tuned with \&\f(CW\*(C`debian/copyright\-scan\-patterns.yml\*(C'\fR file. This YAML file contains a list of suffixes or patterns to ignore that are added to the default list. Any file that is ignored will be shown as "skipped". .PP This file must have the following structure (all fields are optional and order does not matter): .PP .Vb 9 \& \-\-\- \& ignore : \& suffixes : \& \- yml \& pattern : \& \- /t/ \& \- /models/ \& \- /debian/ \& \- /Changes .Ve .PP Do not specify the dot with the suffixes. This will be added by the scanner. .SH "Filling the blanks" .IX Header "Filling the blanks" Sometimes, upstream coders are not perfect: some source files cannot be parsed correctly or some legal information is missing. .PP All scanned files, even without copyright or license will be used. A warning will be shown for each file with missing information. .PP Instead of patching upstream source files to fill the blank, you can specify the missing information in a special file. This file is \&\f(CW\*(C`debian/fill.copyright.blanks.yml\*(C'\fR. It should contain a "mapping" YAML structure (i.e. a hash), where the key is a Perl pattern used to match a path. .PP If the source of the package contains a lot of files without legal information, you may need to specify there information for a whole directory (See the \f(CW\*(C`/src\*(C'\fR dir in the example below). .PP For instance: .PP .Vb 10 \& \-\-\- \& 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.*\e.rb: \& license: Expat \& .*/NOTICE: \& skip: 1 \& share/websockify/: \& license: LGPL\-2 \& src/sunstone/: \& license: Apache\-2.0 \& src/garbled/: \& \*(Aqoverride\-copyright\*(Aq: 2016 Marcel Mézigue .Ve .PP Patterns are matched from the beginning a path. I.e. \f(CW\*(C`share/websockify/\*(C'\fR pattern will match \&\f(CW\*(C`share/websockify/foo.rb\*(C'\fR but will not match \&\f(CW\*(C`web/share/websockify/foo.rb\*(C'\fR. .PP Patterns are tried in reversed sorted order. I.e. the data attached to more specific path (e.g. \f(CW\*(C`3rdparty/foo/blah.c\*(C'\fR) are applied before more generic patterns (e.g. \f(CW\*(C`3rdparty/foo/\*(C'\fR .PP The \f(CW\*(C`license\*(C'\fR key must contain a license short name as returned by \&\f(CW\*(C`license_check\*(C'\fR. .PP When \f(CW\*(C`skip\*(C'\fR is true, the file is skipped like a file without any information. .PP The \f(CW\*(C`override\-copyright\*(C'\fR and \f(CW\*(C`override\-license\*(C'\fR keys can be used to ignore the copyright information coming from the source and provide the correct information. Use this as last resort for instance when the encoding of the owner is not ascii or utf\-8 or when the license data is corrupted. Note that a warning will be shown each time an override key is used. .SH METHODS .IX Header "METHODS" .SS print_copyright .IX Subsection "print_copyright" Print copyright information on STDOUT like scan-copyrights. .ie n .SS "scan_files ( %args )" .el .SS "scan_files ( \f(CW%args\fP )" .IX Subsection "scan_files ( %args )" Return a data structure with copyright and license information. .PP The structure is a list of list: .PP .Vb 8 \& [ \& [ \& [ path1 ,path2, ...], \& copyright, \& license_short_name \& ], \& ... \& ] .Ve .PP Example: .PP .Vb 10 \& [ \& [ \& [ \*(Aq*\*(Aq ], \& \*(Aq1994\-2001, by Frank Pilhofer.\*(Aq, \& \*(AqGPL\-2+\*(Aq \& ], \& [ \& [ \*(Aqpan/*\*(Aq ], \& \*(Aq2002\-2006, Charles Kerr \*(Aq, \& \*(AqGPL\-2\*(Aq \& ], \& [ \& [ \& \*(Aqpan/data/parts.cc\*(Aq, \& \*(Aqpan/data/parts.h\*(Aq \& ], \& \*(Aq2002\-2007, Charles Kerr \*(Aq, \& \*(AqGPL\-2\*(Aq \& ], \& ] .Ve .PP Parameters in \f(CW%args\fR: .IP quiet 4 .IX Item "quiet" set to 1 to suppress progress messages. Should be used only in tests. .IP long 4 .IX Item "long" set to 1 to avoid squashing copyright ids. Useful to avoid output with wild cards. .SH Encoding .IX Header "Encoding" The output of licensecheck is expected to be utf\-8. Which means that the source files scanned by licensecheck should also be encoded in utf\-8. This program will abort if invalid utf\-8 characters are found. .SH BUGS .IX Header "BUGS" Extracting license and copyright data from unstructured comments is not reliable. User must check manually the files when no copyright info is found or when the license is unknown. .PP Source files are assumed to be utf8 (or ascii). Using files with invalid characters will break \f(CW\*(C`cme\*(C'\fR. In this case, you can: .IP \(bu 4 Patch source files to use utf\-8 encoding. .IP \(bu 4 Use the "fill copyright blank" mechanism described above with \&\f(CW\*(C`copyright\-override\*(C'\fR to provide an owner name with the correct encoding. .IP \(bu 4 File a bug against licensecheck package to find a better solution. .SH "SEE ALSO" .IX Header "SEE ALSO" licensecheck, \f(CW\*(C`licensecheck2dep5\*(C'\fR from \f(CW\*(C`cdbs\*(C'\fR package .SH AUTHOR .IX Header "AUTHOR" Dominique Dumont