dpkg (1.18.25) stretch; urgency=medium
[dpkg] / man / dpkg-source.man
CommitLineData
1479465f
GJ
1.\" dpkg manual page - dpkg-source(1)
2.\"
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>
9.\"
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.
14.\"
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.
19.\"
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/>.
22.
23.TH dpkg\-source 1 "%RELEASE_DATE%" "%VERSION%" "dpkg suite"
24.nh
25.SH NAME
26dpkg\-source \- Debian source package (.dsc) manipulation tool
27.
28.SH SYNOPSIS
29.B dpkg\-source
30.RI [ option "...] " command
31.
32.SH DESCRIPTION
33.B dpkg\-source
34packs and unpacks Debian source archives.
35
36None of these commands allow multiple options to be combined into one,
37and they do not allow the value for an option to be specified in a
38separate argument.
39.
40.SH COMMANDS
41.TP
42.BR \-x ", " \-\-extract " \fIfilename\fP.dsc [\fIoutput-directory\fP]"
43Extract a source package (\fB\-\-extract\fP since dpkg 1.17.14).
44One non-option argument must be supplied,
45the name of the Debian source control file
46.RB ( .dsc ).
47An optional second non-option argument may be supplied to specify the
48directory to extract the source package to, this must not exist. If
49no output directory is specified, the source package is extracted into
50a directory named \fIsource\fR-\fIversion\fR under the current working
51directory.
52
53.B dpkg\-source
54will read the names of the other file(s) making up the source package
55from the control file; they are assumed to be in the same directory as
56the
57.BR .dsc .
58
59The files in the extracted package will have their permissions and
60ownerships set to those which would have been expected if the files
61and directories had simply been created - directories and executable
62files will be 0777 and plain files will be 0666, both modified by the
63extractors' umask; if the parent directory is setgid then the
64extracted directories will be too, and all the files and directories
65will inherit its group ownership.
66
67If the source package uses a non-standard format (currently this means all
68formats except “1.0”), its name will be stored in
69\fBdebian/source/format\fP so that the following builds of the source
70package use the same format by default.
71
72.TP
73.BR \-b ", " \-\-build " \fIdirectory\fP [\fIformat-specific-parameters\fP]"
74Build a source package (\fB\-\-build\fP since dpkg 1.17.14).
75The first non-option argument is taken as the
76name of the directory containing the debianized source tree (i.e. with a
77debian sub-directory and maybe changes to the original files).
78Depending on the source package format used to build the package,
79additional parameters might be accepted.
80
81\fBdpkg\-source\fP will build the source package with the first format
82found in this ordered list:
83the format indicated with the \fI\-\-format\fP command line option,
84the format indicated in \fBdebian/source/format\fP,
85“1.0”.
86The fallback to “1.0” is deprecated and will be removed at some
87point in the future, you should always document the desired source format
88in \fBdebian/source/format\fP. See section \fBSOURCE PACKAGE FORMATS\fP
89for an extensive description of the various source package formats.
90
91.TP
92.RI "\fB\-\-print\-format\fP " directory
93Print the source format that would be used to build the source package if
94\fBdpkg\-source \-\-build \fIdirectory\fR was called (in the same conditions
95and with the same parameters; since dpkg 1.15.5).
96
97.TP
98.RI "\fB\-\-before\-build\fP " directory
99Run the corresponding hook of the source package format (since dpkg 1.15.8).
100This hook is
101called before any build of the package (\fBdpkg\-buildpackage\fP calls it
102very early even before \fBdebian/rules clean\fP). This command is
103idempotent and can be called multiple times. Not all source formats
104implement something in this hook, and those that do usually prepare the
105source tree for the build for example by ensuring that the Debian patches
106are applied.
107
108.TP
109.RI "\fB\-\-after\-build\fP " directory
110Run the corresponding hook of the source package format (since dpkg 1.15.8).
111This hook is
112called after any build of the package (\fBdpkg\-buildpackage\fP calls it
113last). This command is idempotent and can be called multiple times. Not
114all source formats implement something in this hook, and those that do
115usually use it to undo what \fB\-\-before\-build\fP has done.
116
117.TP
118.RI "\fB\-\-commit\fP [" directory "] ..."
119Record changes in the source tree unpacked in \fIdirectory\fP
120(since dpkg 1.16.1).
121This command can take supplementary parameters depending on the source format.
122It will error out for formats where this operation doesn't mean anything.
123
124.TP
125.BR \-? ", " \-\-help
126Show the usage message and exit.
127The format specific build and extract options can be shown by using the
128\fB\-\-format\fP option.
129.TP
130.BR \-\-version
131Show the version and exit.
132.
133.SH OPTIONS
134.SS Generic build options
135.TP
136.BI \-c control-file
137Specifies the main source control file to read information from. The
138default is
139.BR debian/control .
140If given with relative pathname this is interpreted starting at
141the source tree's top level directory.
142.TP
143.BI \-l changelog-file
144Specifies the changelog file to read information from. The
145default is
146.BR debian/changelog .
147If given with relative pathname this is interpreted starting at
148the source tree's top level directory.
149.TP
150.BI \-F changelog-format
151Specifies the format of the changelog. See \fBdpkg\-parsechangelog\fP(1)
152for information about alternative formats.
153.TP
154.BI \-\-format= value
155Use the given format for building the source package (since dpkg 1.14.17).
156It does override any format given in \fBdebian/source/format\fP.
157.TP
158.BI \-V name = value
159Set an output substitution variable.
160See \fBdeb\-substvars\fP(5) for a discussion of output substitution.
161.TP
162.BI \-T substvars-file
163Read substitution variables in
164.IR substvars-file ;
165the default is to not read any file. This option can be used multiple
166times to read substitution variables from multiple files (since dpkg 1.15.6).
167.TP
168.BI \-D field = value
169Override or add an output control file field.
170.TP
171.BI \-U field
172Remove an output control file field.
173.TP
174.BR \-Z "\fIcompression\fP, " \-\-compression =\fIcompression\fP
175Specify the compression to use for created tarballs and diff files
176(\fB\-\-compression\fP since dpkg 1.15.5).
177Note that this option will not cause existing tarballs to be recompressed,
178it only affects new files. Supported values are:
179.IR gzip ", " bzip2 ", " lzma " and " xz .
180The default is \fIxz\fP for formats 2.0 and newer, and \fIgzip\fP for
181format 1.0. \fIxz\fP is only supported since dpkg 1.15.5.
182.TP
183.BR \-z "\fIlevel\fP, " \-\-compression\-level =\fIlevel\fP
184Compression level to use (\fB\-\-compression\-level\fP since dpkg 1.15.5).
185As with \fB\-Z\fP it only affects newly created
186files. Supported values are:
187.IR 1 " to " 9 ", " best ", and " fast .
188The default is \fI9\fP for gzip and bzip2, \fI6\fP for xz and lzma.
189.TP
190.BR \-i "[\fIregex\fP], " \-\-diff\-ignore [=\fIregex\fP]
191You may specify a perl regular expression to match files you want
192filtered out of the list of files for the diff (\fB\-\-diff\-ignore\fP
193since dpkg 1.15.6).
194(This list is
195generated by a find command.) (If the source package is being built as a
196version 3 source package using a VCS, this can be used to ignore
197uncommitted changes on specific files. Using \-i.* will ignore all of them.)
198
199The \fB\-i\fP option by itself enables this setting with a default regex
200(preserving any modification to the default regex done by a previous use
201of \fB\-\-extend\-diff\-ignore\fP) that will filter out control files and
202directories of the most common revision control systems, backup and swap
203files and Libtool build output directories. There can only be one active
204regex, of multiple \fB\-i\fP options only the last one will take effect.
205
206This is very helpful in cutting out extraneous files that get included
207in the diff, e.g. if you maintain your source in a revision control
208system and want to use a checkout to build a source package without
209including the additional files and directories that it will usually
210contain (e.g. CVS/, .cvsignore, .svn/). The default regex is already
211very exhaustive, but if you need to replace it, please note that by
212default it can match any part of a path, so if you want to match the
213begin of a filename or only full filenames, you will need to provide
214the necessary anchors (e.g. ‘(^|/)’, ‘($|/)’) yourself.
215.TP
216.BR \-\-extend\-diff\-ignore =\fIregex\fP
217The perl regular expression specified will extend the default value used by
218\fB\-\-diff\-ignore\fP and its current value, if set (since dpkg 1.15.6).
219It does this by concatenating “\fB|\fP\fIregex\fP” to the existing value.
220This option is convenient to use in \fBdebian/source/options\fP to exclude
221some auto-generated files from the automatic patch generation.
222.TP
223.BR \-I "[\fIfile-pattern\fP], " \-\-tar\-ignore [=\fIfile-pattern\fP]
224If this option is specified, the pattern will be passed to
225.BR tar (1)'s
226.B \-\-exclude
227option when it is called to generate a .orig.tar or .tar file
228(\fB\-\-tar\-ignore\fP since dpkg 1.15.6).
229For
230example, \fB\-I\fPCVS will make tar skip over CVS directories when generating
231a .tar.gz file. The option may be repeated multiple times to list multiple
232patterns to exclude.
233
234\fB\-I\fP by itself adds default \fB\-\-exclude\fP options that will
235filter out control files and directories of the most common revision
236control systems, backup and swap files and Libtool build output
237directories.
238.PP
239.B Note:
240While they have similar purposes, \fB\-i\fP and \fB\-I\fP have very
241different syntax and semantics. \fB\-i\fP can only be specified once and
242takes a perl compatible regular expression which is matched against
243the full relative path of each file. \fB\-I\fP can specified
244multiple times and takes a filename pattern with shell wildcards.
245The pattern is applied to the full relative path but also
246to each part of the path individually. The exact semantic of tar's
247\fB\-\-exclude\fP option is somewhat complicated, see
248https://www.gnu.org/software/tar/manual/tar.html#wildcards for a full
249documentation.
250
251The default regex and patterns for both options can be seen
252in the output of the \fB\-\-help\fP command.
253.SS Generic extract options
254.TP
255.BI \-\-no\-copy
256Do not copy original tarballs near the extracted source package
257(since dpkg 1.14.17).
258.TP
259.BI \-\-no\-check
260Do not check signatures and checksums before unpacking (since dpkg 1.14.17).
261.TP
262.B \-\-no\-overwrite\-dir
263Do not overwrite the extraction directory if it already exists
264(since dpkg 1.18.8).
265.TP
266.BI \-\-require\-valid\-signature
267Refuse to unpack the source package if it doesn't contain an OpenPGP
268signature that can be verified (since dpkg 1.15.0) either with the user's
269\fItrustedkeys.gpg\fP keyring, one of the vendor-specific keyrings, or one
270of the official Debian keyrings
271(\fI/usr/share/keyrings/debian\-keyring.gpg\fP
272and \fI/usr/share/keyrings/debian\-maintainers.gpg\fP).
273.TP
274.BI \-\-require\-strong\-checksums
275Refuse to unpack the source package if it does not contain any strong
276checksums (since dpkg 1.18.7).
277Currently the only known checksum considered strong is \fBSHA-256\fP.
278.TP
279.B \-\-ignore\-bad\-version
280Turns the bad source package version check into a non-fatal warning
281(since dpkg 1.17.7).
282This option should only be necessary when extracting ancient source
283packages with broken versions, just for backwards compatibility.
284
285.SH SOURCE PACKAGE FORMATS
286If you don't know what source format to use, you should probably pick
287either “3.0 (quilt)” or “3.0 (native)”.
288See https://wiki.debian.org/Projects/DebSrc3.0 for information on the
289deployment of those formats within Debian.
290
291.SS Format: 1.0
292A source package in this format consists either of a \fB.orig.tar.gz\fP
293associated to a \fB.diff.gz\fP or a single \fB.tar.gz\fP (in that case
294the package is said to be \fInative\fP).
295Optionally the original tarball might be accompanied by a detached
296upstream signature \fB.orig.tar.gz.asc\fP, extraction
297supported since dpkg 1.18.5.
298
299.B Extracting
300
301Extracting a native package is a simple extraction of the single
302tarball in the target directory. Extracting a non-native package
303is done by first unpacking the \fB.orig.tar.gz\fP and then applying
304the patch contained in the \fB.diff.gz\fP file. The timestamp of
305all patched files is reset to the extraction time of the source
306package (this avoids timestamp skews leading to problems when
307autogenerated files are patched). The diff can create new files (the whole
308debian directory is created that way) but can't remove files (empty files
309will be left over).
310
311.B Building
312
313Building a native package is just creating a single tarball with
314the source directory. Building a non-native package involves
315extracting the original tarball in a separate “.orig” directory and
316regenerating the \fB.diff.gz\fP by comparing the source package
317\fIdirectory\fP with the .orig directory.
318
319.B Build options (with \-\-build):
320
321If a second non-option argument is supplied it should be the name of the
322original source directory or tarfile or the empty string if the package is
323a Debian-specific one and so has no debianization diffs. If no second
324argument is supplied then
325.B dpkg\-source
326will look for the original source tarfile
327.IB package _ upstream-version .orig.tar.gz
328or the original source directory
329.IB directory .orig
330depending on the \fB\-sX\fP arguments.
331
332.BR \-sa ", " \-sp ", " \-sk ", " \-su " and " \-sr
333will not overwrite existing tarfiles or directories. If this is
334desired then
335.BR \-sA ", " \-sP ", " \-sK ", " \-sU " and " \-sR
336should be used instead.
337.PP
338.TP
339.BR \-sk
340Specifies to expect the original source as a tarfile, by default
341.IB package _ upstream-version .orig.tar. extension \fR.
342It will leave this original source in place as a tarfile, or copy it
343to the current directory if it isn't already there. The
344tarball will be unpacked into
345.IB directory .orig
346for the generation of the diff.
347.TP
348.B \-sp
349Like
350.B \-sk
351but will remove the directory again afterwards.
352.TP
353.B \-su
354Specifies that the original source is expected as a directory, by
355default
356.IB package - upstream-version .orig
357and
358.B dpkg\-source
359will create a new original source archive from it.
360.TP
361.B \-sr
362Like
363.B \-su
364but will remove that directory after it has been used.
365.TP
366.B \-ss
367Specifies that the original source is available both as a directory
368and as a tarfile. \fBdpkg\-source\fP will use the directory to create
369the diff, but the tarfile to create the
370.BR .dsc .
371This option must be used with care - if the directory and tarfile do
372not match a bad source archive will be generated.
373.TP
374.B \-sn
375Specifies to not look for any original source, and to not generate a diff.
376The second argument, if supplied, must be the empty string. This is
377used for Debian-specific packages which do not have a separate
378upstream source and therefore have no debianization diffs.
379.TP
380.BR \-sa " or " \-sA
381Specifies to look for the original source archive as a tarfile or as a
382directory - the second argument, if any, may be either, or the empty
383string (this is equivalent to using
384.BR \-sn ).
385If a tarfile is found it will unpack it to create the diff and remove
386it afterwards (this is equivalent to
387.BR \-sp );
388if a directory is found it will pack it to create the original source
389and remove it afterwards (this is equivalent to
390.BR \-sr );
391if neither is found it will assume that the package has no
392debianization diffs, only a straightforward source archive (this is
393equivalent to
394.BR \-sn ).
395If both are found then \fBdpkg\-source\fP will ignore the directory,
396overwriting it, if
397.B \-sA
398was specified (this is equivalent to
399.BR \-sP )
400or raise an error if
401.B \-sa
402was specified.
403.B \-sA
404is the default.
405.TP
406.B \-\-abort\-on\-upstream\-changes
407The process fails if the generated diff contains changes to files
408outside of the debian sub-directory (since dpkg 1.15.8).
409This option is not allowed in
410\fBdebian/source/options\fP but can be used in
411\fBdebian/source/local\-options\fP.
412.PP
413
414.B Extract options (with \-\-extract):
415
416In all cases any existing original source tree will be removed.
417.TP
418.B \-sp
419Used when extracting then the original source (if any) will be left
420as a tarfile. If it is not already located in the current directory
421or if an existing but different file is there it will be copied there.
422(\fBThis is the default\fP).
423.TP
424.B \-su
425Unpacks the original source tree.
426.TP
427.B \-sn
428Ensures that the original source is neither copied to the current
429directory nor unpacked. Any original source tree that was in the
430current directory is still removed.
431.PP
432All the
433.BI \-s X
434options are mutually exclusive. If you specify more than one only the
435last one will be used.
436.TP
437.B \-\-skip\-debianization
438Skips application of the debian diff on top of the upstream sources
439(since dpkg 1.15.1).
440.
441.SS Format: 2.0
442Extraction supported since dpkg 1.13.9, building supported since dpkg 1.14.8.
443Also known as wig&pen. This format is not recommended for wide-spread
444usage, the format “3.0 (quilt)” replaces it.
445Wig&pen was the first specification of a new-generation source package format.
446
447The behaviour of this format is the same as the “3.0 (quilt)” format
448except that it doesn't use an explicit list of patches. All files in
449\fBdebian/patches/\fP matching the perl regular expression \fB[\\w\-]+\fP
450must be valid patches: they are applied at extraction time.
451
452When building a new source package, any change to the upstream source
453is stored in a patch named \fBzz_debian\-diff\-auto\fP.
454.
455.SS Format: 3.0 (native)
456Supported since dpkg 1.14.17.
457This format is an extension of the native package format as defined
458in the 1.0 format. It supports all compression methods and
459will ignore by default any VCS specific files and directories
460as well as many temporary files (see default value associated to
461\fB\-I\fP option in the \fB\-\-help\fP output).
462.
463.SS Format: 3.0 (quilt)
464Supported since dpkg 1.14.17.
465A source package in this format contains at least
466an original tarball (\fB.orig.tar.\fP\fIext\fP where \fIext\fP can be
467\fBgz\fP, \fBbz2\fP, \fBlzma\fP and \fBxz\fP) and a debian tarball
468(\fB.debian.tar.\fP\fIext\fP). It can also contain additional original
469tarballs (\fB.orig\-\fP\fIcomponent\fP\fB.tar.\fP\fIext\fP).
470\fIcomponent\fP can only contain alphanumeric characters and hyphens
471(‘\-’).
472Optionally each original tarball can be accompanied by a detached
473upstream signature (\fB.orig.tar.\fP\fIext\fP\fB.asc\fP and
474\fB.orig\-\fP\fIcomponent\fP\fB.tar.\fP\fIext\fP\fB.asc\fP), extraction
475supported since dpkg 1.17.20, building supported since dpkg 1.18.5.
476
477.PP
478.B Extracting
479.PP
480The main original tarball is extracted first, then all additional original
481tarballs are extracted in subdirectories named after the \fIcomponent\fP
482part of their filename (any pre-existing directory is replaced). The
483debian tarball is extracted on top of the source directory after prior
484removal of any pre-existing \fBdebian\fP directory. Note that the
485debian tarball must contain a \fBdebian\fP sub-directory but it
486can also contain binary files outside of that directory (see
487\fB\-\-include\-binaries\fP option).
488.PP
489All patches listed in \fBdebian/patches/debian.series\fP or
490\fBdebian/patches/series\fP are then applied.
491If the former file is used and the latter one doesn't exist (or is a
492symlink), then the latter is replaced with a symlink to the former. This
493is meant to simplify usage of \fBquilt\fP to manage the set of patches. Note
494however that while \fBdpkg\-source\fP parses correctly series files with
495explicit options used for patch application (stored on each line
496after the patch filename and one or more spaces), it does ignore those
497options and always expect patches that can be applied with the \fB\-p1\fP
498option of \fBpatch\fP. It will thus emit a warning when it encounters
499such options, and the build is likely to fail.
500.PP
501The timestamp of all patched files is reset to the extraction time of
502the source package (this avoids timestamp skews leading to problems
503when autogenerated files are patched).
504.PP
505Contrary to \fBquilt\fP's default behaviour, patches are expected to apply
506without any fuzz. When that is not the case, you should refresh such
507patches with \fBquilt\fP, or \fBdpkg\-source\fP will error out while
508trying to apply them.
509.PP
510Similarly to \fBquilt\fP's default behaviour, the patches can remove
511files too.
512.PP
513The file \fB.pc/applied\-patches\fP is created if some
514patches have been applied during the extraction.
515.PP
516.B Building
517.PP
518All original tarballs found in the current directory are extracted in a
519temporary directory by following the same logic as for the unpack, the
520debian directory is copied over in the temporary directory, and all
521patches except the automatic patch (\fBdebian\-changes\-\fP\fIversion\fP
522or \fBdebian\-changes\fP, depending on \fB\-\-single\-debian\-patch\fP) are
523applied. The temporary directory is compared to the source package
524directory. When the diff is non-empty, the build fails unless
525\fB\-\-single\-debian\-patch\fP or \fB\-\-auto\-commit\fP
526has been used, in which case the diff is stored in the automatic patch.
527If the automatic patch is created/deleted, it's added/removed from the
528series file and from the \fBquilt\fP metadata.
529
530Any change
531on a binary file is not representable in a diff and will thus lead to a
532failure unless the maintainer deliberately decided to include that
533modified binary file in the debian tarball (by listing it in
534\fBdebian/source/include\-binaries\fP). The build will also fail if it
535finds binary files in the debian sub-directory unless they have been
536whitelisted through \fBdebian/source/include\-binaries\fP.
537
538The updated debian directory and the list of modified binaries is then
539used to generate the debian tarball.
540
541The automatically generated diff doesn't include changes on VCS specific
542files as well as many temporary files (see default value associated to
543\fB\-i\fP option in the \fB\-\-help\fP output). In particular, the
544\fB.pc\fP directory used by \fBquilt\fP is ignored during generation of the
545automatic patch.
546
547Note: \fBdpkg\-source\fP \fB\-\-before\-build\fP (and \fB\-\-build\fP) will
548ensure that all patches listed in the series file are applied so that a
549package build always has all patches applied. It does this by finding
550unapplied patches (they are listed in the \fBseries\fP file but not in
551\fB.pc/applied\-patches\fP), and if the first patch in that set can be
552applied without errors, it will apply them all. The option
553\fB\-\-no\-preparation\fP can be used to disable this
554behavior.
555
556.PP
557.B Recording changes
558.TP
559.RI "\fB\-\-commit\fP [" directory "] [" patch-name "] [" patch-file ]
560Generates a patch corresponding to the local changes that are not managed
561by the \fBquilt\fP patch system and integrates it in the patch system under
562the name \fIpatch-name\fP. If the name is missing, it will be asked
563interactively. If \fIpatch-file\fP is given, it is used as the patch
564corresponding to the local changes to integrate. Once integrated, an
565editor is launched so that you can edit the meta-information in the patch
566header.
567
568Passing \fIpatch-file\fP is mainly useful after a build failure that
569pre-generated this file, and on this ground the given file is removed
570after integration. Note also that the changes contained in the patch file
571must already be applied on the tree and that the files modified by the
572patch must not have supplementary unrecorded changes.
573
574If the patch generation detects modified binary files, they will be
575automatically added to \fBdebian/source/include\-binaries\fP so that
576they end up in the debian tarball (exactly like \fBdpkg-source
577\-\-include\-binaries \-\-build\fP would do).
578.PP
579.B Build options
580.TP
581.BI \-\-allow\-version\-of\-quilt\-db= version
582Allow \fBdpkg\-source\fP to build the source package if the version of
583the \fBquilt\fP metadata is the one specified, even if \fBdpkg\-source\fP
584doesn't know about it (since dpkg 1.15.5.4).
585Effectively this says that the given version of the
586\fBquilt\fP metadata is compatible with the version 2 that \fBdpkg\-source\fP
587currently supports. The version of the \fBquilt\fP metadata is stored in
588\fB.pc/.version\fP.
589.TP
590.B \-\-include\-removal
591Do not ignore removed files and include them in the automatically
592generated patch.
593.TP
594.B \-\-include\-timestamp
595Include timestamp in the automatically generated patch.
596.TP
597.B \-\-include\-binaries
598Add all modified binaries in the debian tarball. Also add them to
599\fBdebian/source/include\-binaries\fP: they will be added by default
600in subsequent builds and this option is thus no more needed.
601.TP
602.B \-\-no\-preparation
603Do not try to prepare the build tree by applying patches which are
604apparently unapplied (since dpkg 1.14.18).
605.TP
606.B \-\-single\-debian\-patch
607Use \fBdebian/patches/debian\-changes\fP instead of
608\fBdebian/patches/debian\-changes\-\fP\fIversion\fP for the name of the
609automatic patch generated during build (since dpkg 1.15.5.4).
610This option is particularly
611useful when the package is maintained in a VCS and a patch set can't reliably
612be generated. Instead the current diff with upstream should be stored in a
613single patch. The option would be put in \fBdebian/source/local\-options\fP
614and would be accompanied by a \fBdebian/source/local\-patch\-header\fP file
615explaining how the Debian changes can be best reviewed, for example in the
616VCS that is used.
617.TP
618.B \-\-create\-empty\-orig
619Automatically create the main original tarball as empty if it's missing
620and if there are supplementary original tarballs (since dpkg 1.15.6).
621This option is meant to
622be used when the source package is just a bundle of multiple upstream
623software and where there's no “main” software.
624.TP
625.B \-\-no\-unapply\-patches, \-\-unapply\-patches
626By default, \fBdpkg\-source\fP will automatically unapply the patches in the
627\fB\-\-after\-build\fP hook if it did apply them during
628\fB\-\-before\-build\fP (\fB\-\-unapply\-patches\fP since dpkg 1.15.8,
629\fB\-\-no\-unapply\-patches\fP since dpkg 1.16.5).
630Those options allow you to forcefully disable
631or enable the patch unapplication process. Those options are only allowed
632in \fBdebian/source/local\-options\fP so that all generated source
633packages have the same behavior by default.
634.TP
635.B \-\-abort\-on\-upstream\-changes
636The process fails if an automatic patch has been generated
637(since dpkg 1.15.8).
638This option
639can be used to ensure that all changes were properly recorded in separate
640\fBquilt\fP patches prior to the source package build. This option is not
641allowed in \fBdebian/source/options\fP but can be used in
642\fBdebian/source/local\-options\fP.
643.TP
644.B \-\-auto\-commit
645The process doesn't fail if an automatic patch has been generated, instead
646it's immediately recorded in the \fBquilt\fP series.
647
648.PP
649.B Extract options
650.TP
651.B \-\-skip\-debianization
652Skips extraction of the debian tarball on top of the upstream sources
653(since dpkg 1.15.1).
654.TP
655.B \-\-skip\-patches
656Do not apply patches at the end of the extraction (since dpkg 1.14.18).
657.
658.SS Format: 3.0 (custom)
659Supported since dpkg 1.14.17.
660This format is special.
661It doesn't represent a real source package
662format but can be used to create source packages with arbitrary files.
663.PP
664.B Build options
665.PP
666All non-option arguments are taken as files to integrate in the
667generated source package. They must exist and are preferably
668in the current directory. At least one file must be given.
669.TP
670.BI \-\-target\-format= value
671\fBRequired\fP. Defines the real format of the generated source package.
672The generated .dsc file will contain this value in its \fBFormat\fP field
673and not “3.0 (custom)”.
674.
675.SS Format: 3.0 (git)
676Supported since dpkg 1.14.17.
677This format is experimental.
678.PP
679A source package in this format consists of a
680single bundle of a git repository \fB.git\fP to hold the source of a package.
681There may also be a \fB.gitshallow\fP file listing revisions for a shallow
682git clone.
683.PP
684.B Extracting
685.PP
686The bundle is cloned as a git repository to the target directory.
687If there is a gitshallow file, it is installed as \fI.git/shallow\fP inside
688the cloned git repository.
689.PP
690Note that by default the new repository will have the same branch checked
691out that was checked out in the original source.
692(Typically “master”, but it could be anything.)
693Any other branches will be available under \fIremotes/origin/\fP.
694.PP
695.B Building
696.PP
697Before going any further, some checks are done to ensure that we
698don't have any non-ignored uncommitted changes.
699.PP
700\fBgit\-bundle\fP(1) is used to generate a bundle of the git repository.
701By default, all branches and tags in the repository are included in the
702bundle.
703.PP
704.B Build options
705.TP
706.BI \-\-git\-ref= ref
707Allows specifying a git ref to include in the git bundle. Use disables
708the default behavior of including all branches and tags. May be specified
709multiple times. The \fIref\fP can be the name of a branch or tag to
710include. It may also be any parameter that can be passed to
711\fBgit\-rev\-list\fP(1). For example, to include only
712the master branch, use \fB\-\-git\-ref=\fPmaster. To include all tags and
713branches, except for the private branch, use \fB\-\-git\-ref=\fP\-\-all
714\fB\-\-git\-ref=\fP^private
715.TP
716.BI \-\-git\-depth= number
717Creates a shallow clone with a history truncated to the specified number of
718revisions.
719.SS Format: 3.0 (bzr)
720Supported since dpkg 1.14.17.
721This format is experimental.
722It generates a single tarball containing the bzr repository.
723.PP
724.B Extracting
725.PP
726The tarball is unpacked and then bzr is used to checkout the current
727branch.
728.PP
729.B Building
730.PP
731Before going any further, some checks are done to ensure that we
732don't have any non-ignored uncommitted changes.
733.PP
734Then the VCS specific part of the source directory is copied over to a
735temporary directory. Before this temporary directory is packed in a tarball,
736various cleanup are done to save space.
737.SH DIAGNOSTICS
738.SS no source format specified in debian/source/format
739The file \fBdebian/source/format\fP should always exist and indicate the
740desired source format. For backwards compatibility, format “1.0” is
741assumed when the file doesn't exist but you should not rely on this:
742at some point in the future \fBdpkg\-source\fP will be modified to fail
743when that file doesn't exist.
744
745The rationale is that format “1.0” is no longer the recommended format,
746you should usually pick one of the newer formats (“3.0 (quilt)”, “3.0
747(native)”) but \fBdpkg\-source\fP will not do this automatically for you.
748If you want to continue using the old format, you should be explicit about
749it and put “1.0” in \fBdebian/source/format\fP.
750.SS the diff modifies the following upstream files
751When using source format “1.0” it is usually a bad idea to modify
752upstream files directly as the changes end up hidden and mostly
753undocumented in the .diff.gz file. Instead you should store your changes
754as patches in the debian directory and apply them at build-time. To avoid
755this complexity you can also use the format “3.0 (quilt)” that offers
756this natively.
757.SS cannot represent change to \fIfile\fP
758Changes to upstream sources are usually stored with patch files, but not
759all changes can be represented with patches: they can only alter the
760content of plain text files. If you try replacing a file with something of
761a different type (for example replacing a plain file with a symlink or a
762directory), you will get this error message.
763.SS newly created empty file \fIfile\fB will not be represented in diff
764Empty files can't be created with patch files. Thus this change is not
765recorded in the source package and you are warned about it.
766.SS executable mode \fIperms\fB of \fIfile\fB will not be represented in diff
767Patch files do not record permissions of files and thus executable
768permissions are not stored in the source package. This warning reminds you
769of that fact.
770.SS special mode \fIperms\fB of \fIfile\fB will not be represented in diff
771Patch files do not record permissions of files and thus modified
772permissions are not stored in the source package. This warning reminds you
773of that fact.
774.
775.SH ENVIRONMENT
776.TP
777.B SOURCE_DATE_EPOCH
778If set, it will be used as the timestamp (as seconds since the epoch) to
779clamp the mtime in the \fBtar\fP(5) file entries.
780.TP
781.B VISUAL
782.TQ
783.B EDITOR
784Used by the “2.0” and “3.0 (quilt)” source format modules.
785.TP
786.B GIT_DIR
787.TQ
788.B GIT_INDEX_FILE
789.TQ
790.B GIT_OBJECT_DIRECTORY
791.TQ
792.B GIT_ALTERNATE_OBJECT_DIRECTORIES
793.TQ
794.B GIT_WORK_TREE
795Used by the “3.0 (git)” source format modules.
796.
797.SH FILES
798.SS debian/source/format
799This file contains on a single line the format that should be used to
800build the source package (possible formats are described above). No leading
801or trailing spaces are allowed.
802.SS debian/source/include\-binaries
803This file contains a list of binary files (one per line) that should be
804included in the debian tarball. Leading and trailing spaces are stripped.
805Lines starting with ‘\fB#\fP’ are comments and are skipped.
806Empty lines are ignored.
807.SS debian/source/options
808This file contains a list of long options that should be automatically
809prepended to the set of command line options of a \fBdpkg\-source \-\-build\fR
810or \fBdpkg\-source \-\-print\-format\fR call. Options like
811\fB\-\-compression\fR and \fB\-\-compression\-level\fR are well suited for
812this file.
813.P
814Each option should be put on a separate line. Empty lines and lines
815starting with ‘\fB#\fP’ are ignored.
816The leading ‘\fB\-\-\fP’ should be stripped and short options are
817not allowed.
818Optional spaces are allowed around the ‘\fB=\fP’ symbol and optional
819quotes are allowed around the value.
820Here's an example of such a file:
821.P
822 # let dpkg\-source create a debian.tar.bz2 with maximal compression
823 compression = "bzip2"
824 compression\-level = 9
825 # use debian/patches/debian\-changes as automatic patch
826 single\-debian\-patch
827 # ignore changes on config.{sub,guess}
828 extend-diff-ignore = "(^|/)(config\.sub|config\.guess)$"
829.P
830Note: \fBformat\fR options are not accepted in this file, you should
831use \fBdebian/source/format\fR instead.
832.SS debian/source/local\-options
833Exactly like \fBdebian/source/options\fP except that the file is not
834included in the generated source package. It can be useful to store
835a preference tied to the maintainer or to the VCS repository where
836the source package is maintained.
837.SS debian/source/local\-patch\-header \fRand\fP debian/source/patch\-header
838Free form text that is put on top of the automatic patch generated
839in formats “2.0” or “3.0 (quilt)”. \fBlocal\-patch\-header\fP is not
840included in the generated source package while \fBpatch\-header\fP is.
841.SS debian/patches/series
842This file lists all patches that have to be applied (in the given order)
843on top of the upstream source package. Leading and trailing spaces are
844stripped.
845Lines starting with ‘\fB#\fP’ are comments and are skipped.
846Empty lines are ignored.
847Remaining lines start with a patch filename (relative
848to the \fBdebian/patches/\fP directory) up to the first space character or
849the end of line. Optional \fBquilt\fP options can follow up to the end of line
850or the first ‘\fB#\fP’ preceded by one or more spaces (which marks the
851start of a comment up to the end of line).
852.SH BUGS
853The point at which field overriding occurs compared to certain
854standard output field settings is rather confused.
855.SH SEE ALSO
856.ad l
857.BR deb\-src\-control (5),
858.BR deb\-changelog (5),
859.BR dsc (5).