Debian Codegraph @

README.md

raw
1 decopy(1) -- Automatic debian/copyright generator
2 =================================================
3
4 ## SYNTAX
5
6 `decopy` [options] [files or dirs]
7
8 ## DESCRIPTION
9
10 Decopy is a tool that automates creating and updating the debian/copyright
11 files. It does this by parsing all files in a source tree, figuring out the
12 copyright attribution and license for each file (when possible) and then
13 structuring the output in the copyright format 1.0.
14
15 ## USAGE
16
17 Simply running `decopy` in the source tree that needs to be parsed will process
18 all files in the tree, group them by license, wildcard those groups and generate
19 the proper output to be written to the debian/copyright file.
20
21 If the source tree already includes a debian/copyright file, it will be used as
22 input for files where the license could not be inferred, for the copyright of
23 the debian directory and for the license snippets. The license texts for well
24 known licenses are filled in automatically (see **--fill-licenses**); any that
25 are not recognised need to be filled in manually.
26
27 The files or directories specified as positional arguments can be used to limit
28 the processing to the indicated subset instead of processing the complete source
29 tree.
30
31 ## EXAMPLES
32
33 On top of the simple `decopy` usage, these examples show some of the most common
34 usecases. Please see the following sections for detailed explanations of what
35 each of the parameters do.
36
37 * `decopy --root src/hello-1.0/ --output src/hello-1.0/debian/copyright`:
38 This runs the parser in the hello-1.0 source tree and generates the
39 debian/copyright file in the source tree (the debian/ directory needs to
40 pre-exist this call).
41
42 * `decopy --mode partial src/3rdparty/ninja`:
43 This shows the licensing and copyright information for the
44 `src/3rdparty/ninja` directory. Only that directory is analyzed and the
45 output includes only files contained in it.
46
47 * `decopy --group-by copyright`:
48 This processes the complete current source tree, paragraphs are split
49 not only according to the licenses but also according to the copyright
50 owners.
51
52 * `decopy src`:
53 This will process the src directory but, provided debian/copyright already
54 exists, show the complete updated debian/copyright file.
55
56 ## COMMON OPTIONS
57
58 * `--mode <mode>`:
59 Indicates the mode to use when generating the output. The **full** mode
60 (default) will generate a complete debian/copyright file, even if only some
61 files were processed (the rest of the contents are taken from the original
62 debian/copyright file). The **partial** mode will only print the
63 copyright and licensing information for the indicated files. The **changed**
64 mode restricts processing to the files that changed since the
65 debian/copyright file was last committed to git (see **--changed** and
66 **--since** below).
67
68 * `--changed`:
69 Shorthand for **--mode changed**. Scopes the run to the files that changed
70 since the debian/copyright file was last committed. This requires the source
71 tree to be a git repository; if the changed set cannot be computed (git is
72 not available, the tree is not a repository, or the copyright file is
73 untracked) decopy warns and falls back to a full scan.
74
75 * `--since <ref>`:
76 Baseline git ref for **--changed**. Defaults to the commit that last
77 modified the debian/copyright file.
78
79 * `--output <file>`, `-o <file>`:
80 Store the generated output in the indicated file. This will overwrite the
81 file if it already exists.
82
83 * `--root <path>`:
84 Process the indicated path instead of the current directory.
85
86 * `--spdx`, `--no-spdx`:
87 When **--spdx** is given, license short names are rendered using their SPDX
88 identifiers instead of the DEP-5 copyright format names. The default is
89 **--no-spdx**, which uses the DEP-5 names.
90
91 * `--fill-licenses`, `--no-fill-licenses`:
92 When **--fill-licenses** (the default) is given, the **License:** stanzas in
93 the generated output are filled in with the corresponding license text: a
94 reference to `/usr/share/common-licenses` for the licenses shipped there, or
95 the full text for other well known licenses. With **--no-fill-licenses** the
96 license text is left as a `TODO` placeholder to be filled in manually.
97
98 ## EXPLAIN MODE
99
100 Instead of regenerating debian/copyright, decopy can report what is out of date
101 in the existing file, which is useful as a check (e.g. in CI).
102
103 * `--explain`:
104 Report what is out of date in debian/copyright instead of regenerating it:
105 stale Files paragraphs, patterns that no longer match any file, files whose
106 license changed, new files that are not yet covered and copyright holders
107 that have drifted. Nothing is written; decopy exits with status 1 if
108 anything is stale and 0 if the file is up to date.
109
110 ## GROUPING CRITERIA
111
112 The generated output will always create separate paragraphs for groups of files
113 with different licenses, additionally, it can also split paragraphs according to
114 the following grouping options.
115
116 * `--group-by <criteria>`:
117 When grouping by **license** (default), all copyright owners of different
118 files with the same license are listed together. When grouping by
119 **copyright**, each different group of copyright owners is listed
120 separatedly (files that have the exact same list of copyright owners are
121 listed together).
122
123 * `--split-on-license`:
124 When a subdirectory has its own license file (COPYING, LICENSE, etc), the
125 subdirectory is given its own paragraph, even if it has the same license as
126 the main directory. This is the default.
127
128 * `--no-split-on-license`:
129 Even if a subdirectory has its own license file, the contents are listed
130 together with other files in the tree that have the same license.
131
132 * `--split-debian`:
133 Even if the contents of the debian/ subdirectory have the same license as the
134 main content, split it onto a separate paragraph. This is the default.
135
136 * `--no-split-debian`:
137 If the contents of the debian/ subdirectory have the same license as the main
138 content, they are listed together.
139
140 ## ARCHIVE EXPANSION
141
142 Archive files (tar, zip and similar) found in the source tree are expanded and
143 their contents are parsed as if they were regular files, so that licenses and
144 copyright holders embedded inside archives are detected.
145
146 * `--expand-archives`, `--no-expand-archives`:
147 Enable or disable expanding archive files into their contents. Expansion is
148 enabled by default (**--expand-archives**).
149
150 * `--max-archive-depth <n>`:
151 Maximum depth of nested archive expansion (archives contained inside other
152 archives). Defaults to 1.
153
154 * `--max-archive-member-size <bytes>`:
155 Skip archive members larger than this many bytes. Defaults to 10 MB.
156
157 ## LOG LEVEL OPTIONS
158
159 The default logging shows WARN and ERROR messages. It can be modified with the
160 following flags:
161
162 * `--debug`:
163 Show DEBUG, INFO, WARN and ERROR messages.
164
165 * `--verbose`, `-v`:
166 Show INFO, WARN and ERROR messages.
167
168 * `--quiet`, `-q`:
169 Show only ERROR messages.
170
171 ## LESS COMMON OPTIONS
172
173 * `--copyright-file <filename>`:
174 Specify a different copyright file to be used as a base for the processing.
175 Defaults to `debian/copyright`
176
177 * `--text`, `-a`:
178 Parse all files as text files, instead of using the different parsers
179 according to the file types (e.g. using exiftool for images).
180
181 * `--jobs <n>`, `-j <n>`:
182 Number of jobs to run in parallel while processing files. Use 0 (the
183 default) to pick a value automatically based on the available CPUs.
184
185 * `--glob`, `--no-glob`:
186 Enable or disable the use of glob (wildcard) patterns in the `Files:` field
187 of the generated output. Globbing is enabled by default (**--glob**).
188
189 * `--progress`, `--no-progress`:
190 Show or hide the progress bar while processing files. The progress bar is
191 shown by default (**--progress**).
192
193 * `--exclude <path>`, `-X <path>`:
194 Exclude files from being parsed. The path can be specified as a regular
195 expression that is matched against the full relative path for the file (e.g.
196 `-X '.*\.jpg$'` to exclude all files that have the `.jpg` extension. or `-X
197 doc/` to exclude all files inside the `doc/` directory). As a special case,
198 `debian/copyright` and `debian/changelog` are always excluded..
199
200 * `--gitignore`, `--no-gitignore`:
201 Honour the repository's ignore lists (`.gitignore` and `.git/info/exclude`)
202 while walking the tree, so ignored files are not parsed. This is enabled by
203 default (**--gitignore**); use **--no-gitignore** to parse ignored files too.
204 This requires the `pathspec` module; without it the option has no effect.
205 The **Files-Excluded** patterns from the header of an existing
206 debian/copyright file are always honoured, regardless of this option.
207
208 ## COMPARISON WITH OTHER HELPERS
209
210 Decopy was inspired by previous copyright helpers like [copyright-helper by
211 Modestas Vainius][1], licensecheck(1) by Jonas Smedegaard, or the copyright
212 helper shipped with debmake(1), written by Osamu Aoki.
213
214 [1]: https://anonscm.debian.org/cgit/users/modax/copyright-helper.git/
215
216 The main difference with all of them, is that decopy aims to detects as many
217 licenses as possible, including many more that those in the other helpers, as
218 well as the fact that it's capable of processing more than just plain text
219 files.
220
221 Additionally, while it is possible to use it for the creation of the copyright
222 file, its main usecase is to keep the copyright file updated with any changes
223 that are done to the source tree as time passes.
224
225 ## AUTHORS
226
227 Decopy was written by Maximiliano Curia. The debian packaging and this manpage
228 were created by Margarita Manterola.
229
230 ## COPYRIGHT
231
232 Decopy and all the associated code and documentation are released under the ISC
233 license.
234
235