po: Update German man pages translation
[dpkg.git] / man / dpkg-source.pod
blob0ec1e97cbab637651cd430b1bff4bac4aa4f2427
1 # dpkg manual page - dpkg-source(1)
3 # Copyright © 1995-1996 Ian Jackson <ijackson@chiark.greenend.org.uk>
4 # Copyright © 2000 Wichert Akkerman <wakkerma@debian.org>
5 # Copyright © 2006-2007 Frank Lichtenheld <djpig@debian.org>
6 # Copyright © 2006-2015 Guillem Jover <guillem@debian.org>
7 # Copyright © 2008-2011 Raphaël Hertzog <hertzog@debian.org>
8 # Copyright © 2010 Joey Hess <joeyh@debian.org>
10 # This is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
15 # This is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
23 =encoding utf8
25 =head1 NAME
27 dpkg-source - Debian source package (.dsc) manipulation tool
29 =head1 SYNOPSIS
31 B<dpkg-source>
32 [I<option>...] I<command>
34 =head1 DESCRIPTION
36 B<dpkg-source>
37 packs and unpacks Debian source archives.
39 None of these commands allow multiple options to be combined into one,
40 and they do not allow the value for an option to be specified in a
41 separate argument.
43 =head1 COMMANDS
45 =over
47 =item B<-x>, B<--extract> I<filename>.dsc [I<output-directory>]
49 Extract a source package (B<--extract> since dpkg 1.17.14).
50 One non-option argument must be supplied,
51 the name of the Debian source control file
52 (B<.dsc>).
53 An optional second non-option argument may be supplied to specify the
54 directory to extract the source package to, this must not exist. If
55 no output directory is specified, the source package is extracted into
56 a directory named I<source>-I<version> under the current working
57 directory.
59 B<dpkg-source>
60 will read the names of the other file(s) making up the source package
61 from the control file; they are assumed to be in the same directory as
62 the
63 B<.dsc>.
65 The files in the extracted package will have their permissions and
66 ownerships set to those which would have been expected if the files
67 and directories had simply been created - directories and executable
68 files will be 0777 and plain files will be 0666, both modified by the
69 extractors' umask; if the parent directory is setgid then the
70 extracted directories will be too, and all the files and directories
71 will inherit its group ownership.
73 If the source package uses a non-standard format (currently this means all
74 formats except “1.0”), its name will be stored in
75 B<debian/source/format> so that the following builds of the source
76 package use the same format by default.
78 =item B<-b>, B<--build> I<directory> [I<format-specific-parameters>]
80 Build a source package (B<--build> since dpkg 1.17.14).
81 The first non-option argument is taken as the
82 name of the directory containing the debianized source tree (i.e. with a
83 debian sub-directory and maybe changes to the original files).
84 Depending on the source package format used to build the package,
85 additional parameters might be accepted.
87 B<dpkg-source> will build the source package with the first format
88 found in this ordered list:
89 the format indicated with the I<--format> command line option,
90 the format indicated in B<debian/source/format>,
91 “1.0”.
92 The fallback to “1.0” is deprecated and will be removed at some
93 point in the future, you should always document the desired source format
94 in B<debian/source/format>. See section B<SOURCE PACKAGE FORMATS>
95 for an extensive description of the various source package formats.
97 =item B<--print-format> I<directory>
99 Print the source format that would be used to build the source package if
100 B<dpkg-source --build> I<directory> was called (in the same conditions
101 and with the same parameters; since dpkg 1.15.5).
103 =item B<--before-build> I<directory>
105 Run the corresponding hook of the source package format (since dpkg 1.15.8).
106 This hook is
107 called before any build of the package (B<dpkg-buildpackage> calls it
108 very early even before B<debian/rules clean>). This command is
109 idempotent and can be called multiple times. Not all source formats
110 implement something in this hook, and those that do usually prepare the
111 source tree for the build for example by ensuring that the Debian patches
112 are applied.
114 =item B<--after-build> I<directory>
116 Run the corresponding hook of the source package format (since dpkg 1.15.8).
117 This hook is
118 called after any build of the package (B<dpkg-buildpackage> calls it
119 last). This command is idempotent and can be called multiple times. Not
120 all source formats implement something in this hook, and those that do
121 usually use it to undo what B<--before-build> has done.
123 =item B<--commit> [I<directory>] ...
125 Record changes in the source tree unpacked in I<directory>
126 (since dpkg 1.16.1).
127 This command can take supplementary parameters depending on the source format.
128 It will error out for formats where this operation doesn't mean anything.
130 =item B<-?>, B<--help>
132 Show the usage message and exit.
133 The format specific build and extract options can be shown by using the
134 B<--format> option.
136 =item B<--version>
138 Show the version and exit.
140 =back
142 =head1 OPTIONS
144 =head2 Generic build options
146 =over
148 =item B<-c>I<control-file>
150 Specifies the main source control file to read information from. The
151 default is
152 B<debian/control>.
153 If given with relative pathname this is interpreted starting at
154 the source tree's top level directory.
156 =item B<-l>I<changelog-file>
158 Specifies the changelog file to read information from. The
159 default is
160 B<debian/changelog>.
161 If given with relative pathname this is interpreted starting at
162 the source tree's top level directory.
164 =item B<-F>I<changelog-format>
166 Specifies the format of the changelog. See B<dpkg-parsechangelog>(1)
167 for information about alternative formats.
169 =item B<--format=>I<value>
171 Use the given format for building the source package (since dpkg 1.14.17).
172 It does override any format given in B<debian/source/format>.
174 =item B<-V>I<name>B<=>I<value>
176 Set an output substitution variable.
177 See B<deb-substvars>(5) for a discussion of output substitution.
179 =item B<-T>I<substvars-file>
181 Read substitution variables in
182 I<substvars-file>;
183 the default is to not read any file. This option can be used multiple
184 times to read substitution variables from multiple files (since dpkg 1.15.6).
186 =item B<-D>I<field>B<=>I<value>
188 Override or add an output control file field.
190 =item B<-U>I<field>
192 Remove an output control file field.
194 =item B<-Z>I<compression>, B<--compression>=I<compression>
196 Specify the compression to use for created tarballs and diff files
197 (B<--compression> since dpkg 1.15.5).
198 Note that this option will not cause existing tarballs to be recompressed,
199 it only affects new files. Supported values are:
200 I<gzip>, I<bzip2>, I<lzma> and I<xz>.
201 The default is I<xz> for formats 2.0 and newer, and I<gzip> for
202 format 1.0. I<xz> is only supported since dpkg 1.15.5.
204 =item B<-z>I<level>, B<--compression-level>=I<level>
206 Compression level to use (B<--compression-level> since dpkg 1.15.5).
207 As with B<-Z> it only affects newly created
208 files. Supported values are:
209 I<1> to I<9>, I<best>, and I<fast>.
210 The default is I<9> for gzip and bzip2, I<6> for xz and lzma.
212 =item B<-i>[I<regex>], B<--diff-ignore>[=I<regex>]
214 You may specify a perl regular expression to match files you want
215 filtered out of the list of files for the diff (B<--diff-ignore>
216 since dpkg 1.15.6).
217 (This list is
218 generated by a find command.) (If the source package is being built as a
219 version 3 source package using a VCS, this can be used to ignore
220 uncommitted changes on specific files. Using -i.* will ignore all of them.)
222 The B<-i> option by itself enables this setting with a default regex
223 (preserving any modification to the default regex done by a previous use
224 of B<--extend-diff-ignore>) that will filter out control files and
225 directories of the most common revision control systems, backup and swap
226 files and Libtool build output directories. There can only be one active
227 regex, of multiple B<-i> options only the last one will take effect.
229 This is very helpful in cutting out extraneous files that get included
230 in the diff, for example if you maintain your source in a revision control
231 system and want to use a checkout to build a source package without
232 including the additional files and directories that it will usually
233 contain (e.g. CVS/, .cvsignore, .svn/). The default regex is already
234 very exhaustive, but if you need to replace it, please note that by
235 default it can match any part of a path, so if you want to match the
236 begin of a filename or only full filenames, you will need to provide
237 the necessary anchors (e.g. ‘(^|/)’, ‘($|/)’) yourself.
239 =item B<--extend-diff-ignore>=I<regex>
241 The perl regular expression specified will extend the default value used by
242 B<--diff-ignore> and its current value, if set (since dpkg 1.15.6).
243 It does this by concatenating “B<|>I<regex>” to the existing value.
244 This option is convenient to use in B<debian/source/options> to exclude
245 some auto-generated files from the automatic patch generation.
247 =item B<-I>[I<file-pattern>], B<--tar-ignore>[=I<file-pattern>]
249 If this option is specified, the pattern will be passed to
250 B<tar>(1)'s
251 B<--exclude>
252 option when it is called to generate a .orig.tar or .tar file
253 (B<--tar-ignore> since dpkg 1.15.6).
255 example, B<-I>CVS will make tar skip over CVS directories when generating
256 a .tar.gz file. The option may be repeated multiple times to list multiple
257 patterns to exclude.
259 B<-I> by itself adds default B<--exclude> options that will
260 filter out control files and directories of the most common revision
261 control systems, backup and swap files and Libtool build output
262 directories.
264 =back
266 B<Note>:
267 While they have similar purposes, B<-i> and B<-I> have very
268 different syntax and semantics. B<-i> can only be specified once and
269 takes a perl compatible regular expression which is matched against
270 the full relative path of each file. B<-I> can specified
271 multiple times and takes a filename pattern with shell wildcards.
272 The pattern is applied to the full relative path but also
273 to each part of the path individually. The exact semantic of tar's
274 B<--exclude> option is somewhat complicated, see
275 L<https://www.gnu.org/software/tar/manual/tar.html#wildcards> for a full
276 documentation.
278 The default regex and patterns for both options can be seen
279 in the output of the B<--help> command.
281 =head2 Generic extract options
283 =over
285 =item B<--no-copy>
287 Do not copy original tarballs near the extracted source package
288 (since dpkg 1.14.17).
290 =item B<--no-check>
292 Do not check signatures and checksums before unpacking (since dpkg 1.14.17).
294 =item B<--no-overwrite-dir>
296 Do not overwrite the extraction directory if it already exists
297 (since dpkg 1.18.8).
299 =item B<--require-valid-signature>
301 Refuse to unpack the source package if it doesn't contain an OpenPGP
302 signature that can be verified (since dpkg 1.15.0) either with the user's
303 I<trustedkeys.gpg> keyring, one of the vendor-specific keyrings, or one
304 of the official Debian keyrings
305 (I</usr/share/keyrings/debian-keyring.gpg>,
306 I</usr/share/keyrings/debian-nonupload.gpg> and
307 I</usr/share/keyrings/debian-maintainers.gpg>).
309 =item B<--require-strong-checksums>
311 Refuse to unpack the source package if it does not contain any strong
312 checksums (since dpkg 1.18.7).
313 Currently the only known checksum considered strong is B<SHA-256>.
315 =item B<--ignore-bad-version>
317 Turns the bad source package version check into a non-fatal warning
318 (since dpkg 1.17.7).
319 This option should only be necessary when extracting ancient source
320 packages with broken versions, just for backwards compatibility.
322 =back
324 =head2 Generic general options
326 =over
328 =item B<--threads-max=>I<threads>
330 Sets the maximum number of threads allowed for compressors that support
331 multi-threaded operations (since dpkg 1.21.14).
333 =item B<-q>
335 Sets quiet mode to suppress warnings.
337 =back
339 =head1 SOURCE PACKAGE FORMATS
341 If you don't know what source format to use, you should probably pick
342 either “3.0 (quilt)” or “3.0 (native)”.
343 See L<https://wiki.debian.org/Projects/DebSrc3.0> for information on the
344 deployment of those formats within Debian.
346 =head2 Format: 1.0
348 A source package in this format consists either of a B<.orig.tar.gz>
349 associated to a B<.diff.gz> or a single B<.tar.gz> (in that case
350 the package is said to be I<native>).
351 Optionally the original tarball might be accompanied by a detached
352 upstream signature B<.orig.tar.gz.asc>, extraction
353 supported since dpkg 1.18.5.
355 B<Extracting>
357 Extracting a native package is a simple extraction of the single
358 tarball in the target directory. Extracting a non-native package
359 is done by first unpacking the B<.orig.tar.gz> and then applying
360 the patch contained in the B<.diff.gz> file. The timestamp of
361 all patched files is reset to the extraction time of the source
362 package (this avoids timestamp skews leading to problems when
363 autogenerated files are patched). The diff can create new files (the whole
364 debian directory is created that way) but cannot remove files (empty files
365 will be left over) and cannot create or change symlinks.
367 B<Building>
369 Building a native package is just creating a single tarball with
370 the source directory. Building a non-native package involves
371 extracting the original tarball in a separate “.orig” directory and
372 regenerating the B<.diff.gz> by comparing the source package
373 I<directory> with the .orig directory.
375 B<Build options (with --build):>
377 If a second non-option argument is supplied it should be the name of the
378 original source directory or tarfile or the empty string if the package is
379 a Debian-specific one and so has no debianization diffs. If no second
380 argument is supplied then
381 B<dpkg-source>
382 will look for the original source tarfile
383 I<package>B<_>I<upstream-version>B<.orig.tar.gz>
384 or the original source directory
385 I<directory>B<.orig>
386 depending on the B<-sX> arguments.
388 B<-sa>, B<-sp>, B<-sk>, B<-su> and B<-sr>
389 will not overwrite existing tarfiles or directories. If this is
390 desired then
391 B<-sA>, B<-sP>, B<-sK>, B<-sU> and B<-sR>
392 should be used instead.
394 =over
396 =item B<-sk>
398 Specifies to expect the original source as a tarfile, by default
399 I<package>B<_>I<upstream-version>B<.orig.tar.>I<extension>.
400 It will leave this original source in place as a tarfile, or copy it
401 to the current directory if it isn't already there. The
402 tarball will be unpacked into
403 I<directory>B<.orig>
404 for the generation of the diff.
406 =item B<-sp>
408 Like
409 B<-sk>
410 but will remove the directory again afterwards.
412 =item B<-su>
414 Specifies that the original source is expected as a directory, by
415 default
416 I<package>B<->I<upstream-version>B<.orig>
418 B<dpkg-source>
419 will create a new original source archive from it.
421 =item B<-sr>
423 Like
424 B<-su>
425 but will remove that directory after it has been used.
427 =item B<-ss>
429 Specifies that the original source is available both as a directory
430 and as a tarfile. B<dpkg-source> will use the directory to create
431 the diff, but the tarfile to create the
432 B<.dsc>.
433 This option must be used with care - if the directory and tarfile do
434 not match a bad source archive will be generated.
436 =item B<-sn>
438 Specifies to not look for any original source, and to not generate a diff.
439 The second argument, if supplied, must be the empty string. This is
440 used for Debian-specific packages which do not have a separate
441 upstream source and therefore have no debianization diffs.
443 =item B<-sa> or B<-sA>
445 Specifies to look for the original source archive as a tarfile or as a
446 directory - the second argument, if any, may be either, or the empty
447 string (this is equivalent to using
448 B<-sn>).
449 If a tarfile is found it will unpack it to create the diff and remove
450 it afterwards (this is equivalent to
451 B<-sp>);
452 if a directory is found it will pack it to create the original source
453 and remove it afterwards (this is equivalent to
454 B<-sr>);
455 if neither is found it will assume that the package has no
456 debianization diffs, only a straightforward source archive (this is
457 equivalent to
458 B<-sn>).
459 If both are found then B<dpkg-source> will ignore the directory,
460 overwriting it, if
461 B<-sA>
462 was specified (this is equivalent to
463 B<-sP>)
464 or raise an error if
465 B<-sa>
466 was specified.
467 B<-sa>
468 is the default.
470 =item B<--abort-on-upstream-changes>
472 The process fails if the generated diff contains changes to files
473 outside of the debian sub-directory (since dpkg 1.15.8).
474 This option is not allowed in
475 B<debian/source/options> but can be used in
476 B<debian/source/local-options>.
478 =back
480 B<Extract options (with --extract):>
482 In all cases any existing original source tree will be removed.
484 =over
486 =item B<-sp>
488 Used when extracting then the original source (if any) will be left
489 as a tarfile. If it is not already located in the current directory
490 or if an existing but different file is there it will be copied there.
491 (B<This is the default>).
493 =item B<-su>
495 Unpacks the original source tree.
497 =item B<-sn>
499 Ensures that the original source is neither copied to the current
500 directory nor unpacked. Any original source tree that was in the
501 current directory is still removed.
503 =back
505 All the
506 B<-s>I<X>
507 options are mutually exclusive. If you specify more than one only the
508 last one will be used.
510 =over
512 =item B<--skip-debianization>
514 Skips application of the debian diff on top of the upstream sources
515 (since dpkg 1.15.1).
517 =back
519 =head2 Format: 2.0
521 Extraction supported since dpkg 1.13.9, building supported since dpkg 1.14.8.
522 Also known as wig&pen. This format is not recommended for wide-spread
523 usage, the format “3.0 (quilt)” replaces it.
524 Wig&pen was the first specification of a new-generation source package format.
526 The behavior of this format is the same as the “3.0 (quilt)” format
527 except that it doesn't use an explicit list of patches. All files in
528 B<debian/patches/> matching the perl regular expression B<[\w-]+>
529 must be valid patches: they are applied at extraction time.
531 When building a new source package, any change to the upstream source
532 is stored in a patch named B<zz_debian-diff-auto>.
534 =head2 Format: 3.0 (native)
536 Supported since dpkg 1.14.17.
537 This format is an extension of the native package format as defined
538 in the 1.0 format. It supports all compression methods and
539 will ignore by default any VCS specific files and directories
540 as well as many temporary files (see default value associated to
541 B<-I> option in the B<--help> output).
543 =head2 Format: 3.0 (quilt)
545 Supported since dpkg 1.14.17.
546 A source package in this format contains at least
547 an original tarball (B<.orig.tar.>I<ext> where I<ext> can be
548 B<gz>, B<bz2>, B<lzma> and B<xz>) and a debian tarball
549 (B<.debian.tar.>I<ext>). It can also contain additional original
550 tarballs (B<.orig->I<component>B<.tar.>I<ext>).
551 I<component> can only contain alphanumeric (‘a-zA-Z0-9’) characters
552 and hyphens (‘-’).
553 Optionally each original tarball can be accompanied by a detached
554 upstream signature (B<.orig.tar.>I<ext>B<.asc> and
555 B<.orig->I<component>B<.tar.>I<ext>B<.asc>), extraction
556 supported since dpkg 1.17.20, building supported since dpkg 1.18.5.
558 B<Extracting>
560 The main original tarball is extracted first, then all additional original
561 tarballs are extracted in subdirectories named after the I<component>
562 part of their filename (any pre-existing directory is replaced). The
563 debian tarball is extracted on top of the source directory after prior
564 removal of any pre-existing B<debian> directory. Note that the
565 debian tarball must contain a B<debian> sub-directory but it
566 can also contain binary files outside of that directory (see
567 B<--include-binaries> option).
569 All patches listed in B<debian/patches/>I<vendor>B<.series> or
570 B<debian/patches/series> are then applied, where I<vendor> will be
571 the lowercase name of the current vendor, or B<debian> if there is
572 no vendor defined.
573 If the former file is used and the latter one doesn't exist (or is a
574 symlink), then the latter is replaced with a symlink to the former.
575 This is meant to simplify usage of B<quilt> to manage the set of patches.
576 Vendor-specific series files are intended to make it possible to serialize
577 multiple development branches based on the vendor, in a declarative way,
578 in preference to open-coding this handling in B<debian/rules>.
579 This is particularly useful when the source would need to be patched
580 conditionally because the affected files do not have built-in conditional
581 occlusion support.
582 Note however that while B<dpkg-source> parses correctly series files
583 with explicit options used for patch application (stored on each line
584 after the patch filename and one or more spaces), it does ignore those
585 options and always expects patches that can be applied with the B<-p1>
586 option of B<patch>. It will thus emit a warning when it encounters
587 such options, and the build is likely to fail.
589 Note that B<lintian>(1) will emit unconditional warnings when using
590 vendor series due to a controversial Debian specific ruling, which should
591 not affect any external usage; to silence these, the dpkg lintian profile
592 can be used by passing «B<--profile dpkg>» to B<lintian>(1).
594 The timestamp of all patched files is reset to the extraction time of
595 the source package (this avoids timestamp skews leading to problems
596 when autogenerated files are patched).
598 Contrary to B<quilt>'s default behavior, patches are expected to apply
599 without any fuzz. When that is not the case, you should refresh such
600 patches with B<quilt>, or B<dpkg-source> will error out while
601 trying to apply them.
603 Similarly to B<quilt>'s default behavior, the patches can remove
604 files too.
606 The file B<.pc/applied-patches> is created if some
607 patches have been applied during the extraction.
609 B<Building>
611 All original tarballs found in the current directory are extracted in a
612 temporary directory by following the same logic as for the unpack, the
613 debian directory is copied over in the temporary directory, and all
614 patches except the automatic patch (B<debian-changes->I<version>
615 or B<debian-changes>, depending on B<--single-debian-patch>) are
616 applied. The temporary directory is compared to the source package
617 directory. When the diff is non-empty, the build fails unless
618 B<--single-debian-patch> or B<--auto-commit>
619 has been used, in which case the diff is stored in the automatic patch.
620 If the automatic patch is created/deleted, it's added/removed from the
621 series file and from the B<quilt> metadata.
623 Any change
624 on a binary file is not representable in a diff and will thus lead to a
625 failure unless the maintainer deliberately decided to include that
626 modified binary file in the debian tarball (by listing it in
627 B<debian/source/include-binaries>). The build will also fail if it
628 finds binary files in the debian sub-directory unless they have been
629 allowed through B<debian/source/include-binaries>.
631 The updated debian directory and the list of modified binaries is then
632 used to generate the debian tarball.
634 The automatically generated diff doesn't include changes on VCS specific
635 files as well as many temporary files (see default value associated to
636 B<-i> option in the B<--help> output). In particular, the
637 B<.pc> directory used by B<quilt> is ignored during generation of the
638 automatic patch.
640 B<Note>: B<dpkg-source> B<--before-build> (and B<--build>) will
641 ensure that all patches listed in the series file are applied so that a
642 package build always has all patches applied. It does this by finding
643 unapplied patches (they are listed in the B<series> file but not in
644 B<.pc/applied-patches>), and if the first patch in that set can be
645 applied without errors, it will apply them all. The option
646 B<--no-preparation> can be used to disable this
647 behavior.
649 B<Recording changes>
651 =over
653 =item B<--commit> [I<directory>] [I<patch-name>] [I<patch-file>]
655 Generates a patch corresponding to the local changes that are not managed
656 by the B<quilt> patch system and integrates it in the patch system under
657 the name I<patch-name>. If the name is missing, it will be asked
658 interactively. If I<patch-file> is given, it is used as the patch
659 corresponding to the local changes to integrate. Once integrated, an
660 editor is launched so that you can edit the meta-information in the patch
661 header.
663 Passing I<patch-file> is mainly useful after a build failure that
664 pre-generated this file, and on this ground the given file is removed
665 after integration. Note also that the changes contained in the patch file
666 must already be applied on the tree and that the files modified by the
667 patch must not have supplementary unrecorded changes.
669 If the patch generation detects modified binary files, they will be
670 automatically added to B<debian/source/include-binaries> so that
671 they end up in the debian tarball (exactly like B<dpkg-source
672 --include-binaries --build> would do).
674 =back
676 B<Build options>
678 =over
680 =item B<--allow-version-of-quilt-db=>I<version>
682 Allow B<dpkg-source> to build the source package if the version of
683 the B<quilt> metadata is the one specified, even if B<dpkg-source>
684 doesn't know about it (since dpkg 1.15.5.4).
685 Effectively this says that the given version of the
686 B<quilt> metadata is compatible with the version 2 that B<dpkg-source>
687 currently supports. The version of the B<quilt> metadata is stored in
688 B<.pc/.version>.
690 =item B<--include-removal>
692 Do not ignore removed files and include them in the automatically
693 generated patch.
695 =item B<--include-timestamp>
697 Include timestamp in the automatically generated patch.
699 =item B<--include-binaries>
701 Add all modified binaries in the debian tarball. Also add them to
702 B<debian/source/include-binaries>: they will be added by default
703 in subsequent builds and this option is thus no more needed.
705 =item B<--no-preparation>
707 Do not try to prepare the build tree by applying patches which are
708 apparently unapplied (since dpkg 1.14.18).
710 =item B<--single-debian-patch>
712 Use B<debian/patches/debian-changes> instead of
713 B<debian/patches/debian-changes->I<version> for the name of the
714 automatic patch generated during build (since dpkg 1.15.5.4).
715 This option is particularly
716 useful when the package is maintained in a VCS and a patch set can't reliably
717 be generated. Instead the current diff with upstream should be stored in a
718 single patch. The option would be put in B<debian/source/local-options>
719 and would be accompanied by a B<debian/source/local-patch-header> file
720 explaining how the Debian changes can be best reviewed, for example in the
721 VCS that is used.
723 =item B<--create-empty-orig>
725 Automatically create the main original tarball as empty if it's missing
726 and if there are supplementary original tarballs (since dpkg 1.15.6).
727 This option is meant to
728 be used when the source package is just a bundle of multiple upstream
729 software and where there's no “main” software.
731 =item B<--no-unapply-patches, --unapply-patches>
733 By default, B<dpkg-source> will automatically unapply the patches in the
734 B<--after-build> hook if it did apply them during
735 B<--before-build> (B<--unapply-patches> since dpkg 1.15.8,
736 B<--no-unapply-patches> since dpkg 1.16.5).
737 Those options allow you to forcefully disable
738 or enable the patch unapplication process. Those options are only allowed
739 in B<debian/source/local-options> so that all generated source
740 packages have the same behavior by default.
742 =item B<--abort-on-upstream-changes>
744 The process fails if an automatic patch has been generated
745 (since dpkg 1.15.8).
746 This option
747 can be used to ensure that all changes were properly recorded in separate
748 B<quilt> patches prior to the source package build. This option is not
749 allowed in B<debian/source/options> but can be used in
750 B<debian/source/local-options>.
752 =item B<--auto-commit>
754 The process doesn't fail if an automatic patch has been generated, instead
755 it's immediately recorded in the B<quilt> series.
757 =back
759 B<Extract options>
761 =over
763 =item B<--skip-debianization>
765 Skips extraction of the debian tarball on top of the upstream sources
766 (since dpkg 1.15.1).
768 =item B<--skip-patches>
770 Do not apply patches at the end of the extraction (since dpkg 1.14.18).
772 =back
774 =head2 Format: 3.0 (custom)
776 Supported since dpkg 1.14.17.
777 This format is special.
778 It doesn't represent a real source package
779 format but can be used to create source packages with arbitrary files.
781 B<Build options>
783 All non-option arguments are taken as files to integrate in the
784 generated source package. They must exist and are preferably
785 in the current directory. At least one file must be given.
787 =over
789 =item B<--target-format=>I<value>
791 B<Required>. Defines the real format of the generated source package.
792 The generated .dsc file will contain this value in its B<Format> field
793 and not “3.0 (custom)”.
795 =back
797 =head2 Format: 3.0 (git)
799 Supported since dpkg 1.14.17.
800 This format is experimental.
802 A source package in this format consists of a
803 single bundle of a git repository B<.git> to hold the source of a package.
804 There may also be a B<.gitshallow> file listing revisions for a shallow
805 git clone.
807 B<Extracting>
809 The bundle is cloned as a git repository to the target directory.
810 If there is a gitshallow file, it is installed as I<.git/shallow> inside
811 the cloned git repository.
813 Note that by default the new repository will have the same branch checked
814 out that was checked out in the original source.
815 (Typically “main”, but it could be anything.)
816 Any other branches will be available under I<remotes/origin/>.
818 B<Building>
820 Before going any further, some checks are done to ensure that we
821 don't have any non-ignored uncommitted changes.
823 B<git-bundle>(1) is used to generate a bundle of the git repository.
824 By default, all branches and tags in the repository are included in the
825 bundle.
827 B<Build options>
829 =over
831 =item B<--git-ref=>I<ref>
833 Allows specifying a git ref to include in the git bundle. Use disables
834 the default behavior of including all branches and tags. May be specified
835 multiple times. The I<ref> can be the name of a branch or tag to
836 include. It may also be any parameter that can be passed to
837 B<git-rev-list>(1). For example, to include only
838 the main branch, use B<--git-ref=>main. To include all tags and
839 branches, except for the private branch, use B<--git-ref=>--all
840 B<--git-ref=>^private
842 =item B<--git-depth=>I<number>
844 Creates a shallow clone with a history truncated to the specified number of
845 revisions.
847 =back
849 =head2 Format: 3.0 (bzr)
851 Supported since dpkg 1.14.17.
852 This format is experimental.
853 It generates a single tarball containing the bzr repository.
855 B<Extracting>
857 The tarball is unpacked and then bzr is used to checkout the current
858 branch.
860 B<Building>
862 Before going any further, some checks are done to ensure that we
863 don't have any non-ignored uncommitted changes.
865 Then the VCS specific part of the source directory is copied over to a
866 temporary directory. Before this temporary directory is packed in a tarball,
867 various cleanup are done to save space.
869 =head1 DIAGNOSTICS
871 =head2 no source format specified in debian/source/format
873 The file B<debian/source/format> should always exist and indicate the
874 desired source format. For backwards compatibility, format “1.0” is
875 assumed when the file doesn't exist but you should not rely on this:
876 at some point in the future B<dpkg-source> will be modified to fail
877 when that file doesn't exist.
879 The rationale is that format “1.0” is no longer the recommended format,
880 you should usually pick one of the newer formats (“3.0 (quilt)”, “3.0
881 (native)”) but B<dpkg-source> will not do this automatically for you.
882 If you want to continue using the old format, you should be explicit about
883 it and put “1.0” in B<debian/source/format>.
885 =head2 the diff modifies the following upstream files
887 When using source format “1.0” it is usually a bad idea to modify
888 upstream files directly as the changes end up hidden and mostly
889 undocumented in the .diff.gz file. Instead you should store your changes
890 as patches in the debian directory and apply them at build-time. To avoid
891 this complexity you can also use the format “3.0 (quilt)” that offers
892 this natively.
894 =head2 cannot represent change to I<file>
896 Changes to upstream sources are usually stored with patch files, but not
897 all changes can be represented with patches: they can only alter the
898 content of plain text files. If you try replacing a file with something of
899 a different type (for example replacing a plain file with a symlink or a
900 directory), you will get this error message.
902 =head2 newly created empty file I<file> will not be represented in diff
904 Empty files can't be created with patch files. Thus this change is not
905 recorded in the source package and you are warned about it.
907 =head2 executable mode I<perms> of I<file> will not be represented in diff
909 Patch files do not record permissions of files and thus executable
910 permissions are not stored in the source package. This warning reminds you
911 of that fact.
913 =head2 special mode I<perms> of I<file> will not be represented in diff
915 Patch files do not record permissions of files and thus modified
916 permissions are not stored in the source package. This warning reminds you
917 of that fact.
919 =head1 ENVIRONMENT
921 =over
923 =item B<DPKG_COLORS>
925 Sets the color mode (since dpkg 1.18.5).
926 The currently accepted values are: B<auto> (default), B<always> and
927 B<never>.
929 =item B<DPKG_NLS>
931 If set, it will be used to decide whether to activate Native Language Support,
932 also known as internationalization (or i18n) support (since dpkg 1.19.0).
933 The accepted values are: B<0> and B<1> (default).
935 =item B<SOURCE_DATE_EPOCH>
937 If set, it will be used as the timestamp (as seconds since the epoch) to
938 clamp the mtime in the B<tar>(5) file entries.
940 =item B<VISUAL>
942 =item B<EDITOR>
944 Used by the “2.0” and “3.0 (quilt)” source format modules.
946 =item B<GIT_DIR>
948 =item B<GIT_INDEX_FILE>
950 =item B<GIT_OBJECT_DIRECTORY>
952 =item B<GIT_ALTERNATE_OBJECT_DIRECTORIES>
954 =item B<GIT_WORK_TREE>
956 Used by the “3.0 (git)” source format modules.
958 =back
960 =head1 FILES
962 =head2 debian/source/format
964 This file contains on a single line the format that should be used to
965 build the source package (possible formats are described above). No leading
966 or trailing spaces are allowed.
968 =head2 debian/source/include-binaries
970 This file contains a list of pathnames of binary files (one per line) relative
971 to the source root directory that should be included in the debian tarball.
972 Leading and trailing spaces are stripped.
973 Lines starting with ‘B<#>’ are comments and are skipped.
974 Empty lines are ignored.
976 =head2 debian/source/options
978 This file contains a list of long options that should be automatically
979 prepended to the set of command line options of a B<dpkg-source --build>
980 or B<dpkg-source --print-format> call. Options like
981 B<--compression> and B<--compression-level> are well suited for
982 this file.
984 Each option should be put on a separate line. Empty lines and lines
985 starting with ‘B<#>’ are ignored.
986 The leading ‘B<-->’ should be stripped and short options are
987 not allowed.
988 Optional spaces are allowed around the ‘B<=>’ symbol and optional
989 quotes are allowed around the value.
990 Here's an example of such a file:
992  # let dpkg-source create a debian.tar.bz2 with maximal compression
993  compression = "bzip2"
994  compression-level = 9
995  # use debian/patches/debian-changes as automatic patch
996  single-debian-patch
997  # ignore changes on config.{sub,guess}
998  extend-diff-ignore = "(^|/)(config.sub|config.guess)$"
1000 B<Note>: B<format> options are not accepted in this file, you should
1001 use B<debian/source/format> instead.
1003 =head2 debian/source/local-options
1005 Exactly like B<debian/source/options> except that the file is not
1006 included in the generated source package. It can be useful to store
1007 a preference tied to the maintainer or to the VCS repository where
1008 the source package is maintained.
1010 =head2 debian/source/local-patch-header
1012 =head2 debian/source/patch-header
1014 Free form text that is put on top of the automatic patch generated
1015 in formats “2.0” or “3.0 (quilt)”. B<local-patch-header> is not
1016 included in the generated source package while B<patch-header> is.
1018 =head2 debian/patches/I<vendor>.series
1020 =head2 debian/patches/series
1022 This file lists all patches that have to be applied (in the given order)
1023 on top of the upstream source package. Leading and trailing spaces are
1024 stripped.
1025 The I<vendor> will be the lowercase name of the current vendor, or
1026 B<debian> if there is no vendor defined.
1027 If the vendor-specific series file does not exist, the vendor-less series
1028 file will be used.
1029 Lines starting with ‘B<#>’ are comments and are skipped.
1030 Empty lines are ignored.
1031 Remaining lines start with a patch filename (relative
1032 to the B<debian/patches/> directory) up to the first space character or
1033 the end of line. Optional B<quilt> options can follow up to the end of line
1034 or the first ‘B<#>’ preceded by one or more spaces (which marks the
1035 start of a comment up to the end of line).
1037 =head1 SECURITY
1039 Examining untrusted source packages or extracting them into staging
1040 directories should be considered a security boundary, and any breakage
1041 of that boundary stemming from these operations should be considered a
1042 security vulnerability.
1043 But handling untrusted source packages should not be done lightly,
1044 as the surface area includes any compression command supported,
1045 commands to handle specific data formats (such as L<tar(1)> or L<patch(1)>)
1046 in addition to the source package formats and control files themselves.
1047 Performing these operations over untrusted data as root is strongly
1048 discouraged.
1050 Building source packages should only be performed over trusted data.
1052 =head1 BUGS
1054 The point at which field overriding occurs compared to certain
1055 standard output field settings is rather confused.
1057 =head1 SEE ALSO
1059 B<deb-src-control>(5),
1060 B<deb-changelog>(5),
1061 B<deb-substvars>(5),
1062 B<dsc>(5).