man-pages/man1/dpkg-source.1.html
2021-03-31 01:06:50 +01:00

1159 lines
42 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of dpkg-source</TITLE>
</HEAD><BODY>
<H1>dpkg-source</H1>
Section: dpkg suite (1)<BR>Updated: 2020-03-23<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
dpkg-source - Debian source package (.dsc) manipulation tool
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>dpkg-source</B>
[<I>option</I>...] <I>command</I>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<B>dpkg-source</B>
packs and unpacks Debian source archives.
<P>
None of these commands allow multiple options to be combined into one,
and they do not allow the value for an option to be specified in a
separate argument.
<A NAME="lbAE">&nbsp;</A>
<H2>COMMANDS</H2>
<DL COMPACT>
<DT id="1"><B>-x</B>, <B>--extract</B> <I>filename</I>.dsc [<I>output-directory</I>]
<DD>
Extract a source package (<B>--extract</B> since dpkg 1.17.14).
One non-option argument must be supplied,
the name of the Debian source control file
(<B>.dsc</B>).
An optional second non-option argument may be supplied to specify the
directory to extract the source package to, this must not exist. If
no output directory is specified, the source package is extracted into
a directory named <I>source</I>-<I>version</I> under the current working
directory.
<P>
<B>dpkg-source</B>
will read the names of the other file(s) making up the source package
from the control file; they are assumed to be in the same directory as
the
<B>.dsc</B>.
<P>
The files in the extracted package will have their permissions and
ownerships set to those which would have been expected if the files
and directories had simply been created - directories and executable
files will be 0777 and plain files will be 0666, both modified by the
extractors' umask; if the parent directory is setgid then the
extracted directories will be too, and all the files and directories
will inherit its group ownership.
<P>
If the source package uses a non-standard format (currently this means all
formats except "1.0"), its name will be stored in
<B>debian/source/format</B> so that the following builds of the source
package use the same format by default.
<P>
<DT id="2"><B>-b</B>, <B>--build</B> <I>directory</I> [<I>format-specific-parameters</I>]
<DD>
Build a source package (<B>--build</B> since dpkg 1.17.14).
The first non-option argument is taken as the
name of the directory containing the debianized source tree (i.e. with a
debian sub-directory and maybe changes to the original files).
Depending on the source package format used to build the package,
additional parameters might be accepted.
<P>
<B>dpkg-source</B> will build the source package with the first format
found in this ordered list:
the format indicated with the <I>--format</I> command line option,
the format indicated in <B>debian/source/format</B>,
"1.0".
The fallback to "1.0" is deprecated and will be removed at some
point in the future, you should always document the desired source format
in <B>debian/source/format</B>. See section <B>SOURCE PACKAGE FORMATS</B>
for an extensive description of the various source package formats.
<P>
<DT id="3"><B>--print-format</B> <I>directory</I>
<DD>
Print the source format that would be used to build the source package if
<B>dpkg-source --build </B><I>directory</I> was called (in the same conditions
and with the same parameters; since dpkg 1.15.5).
<P>
<DT id="4"><B>--before-build</B> <I>directory</I>
<DD>
Run the corresponding hook of the source package format (since dpkg 1.15.8).
This hook is
called before any build of the package (<B>dpkg-buildpackage</B> calls it
very early even before <B>debian/rules clean</B>). This command is
idempotent and can be called multiple times. Not all source formats
implement something in this hook, and those that do usually prepare the
source tree for the build for example by ensuring that the Debian patches
are applied.
<P>
<DT id="5"><B>--after-build</B> <I>directory</I>
<DD>
Run the corresponding hook of the source package format (since dpkg 1.15.8).
This hook is
called after any build of the package (<B>dpkg-buildpackage</B> calls it
last). This command is idempotent and can be called multiple times. Not
all source formats implement something in this hook, and those that do
usually use it to undo what <B>--before-build</B> has done.
<P>
<DT id="6"><B>--commit</B> [<I>directory</I>] ...
<DD>
Record changes in the source tree unpacked in <I>directory</I>
(since dpkg 1.16.1).
This command can take supplementary parameters depending on the source format.
It will error out for formats where this operation doesn't mean anything.
<P>
<DT id="7"><B>-?</B>, <B>--help</B>
<DD>
Show the usage message and exit.
The format specific build and extract options can be shown by using the
<B>--format</B> option.
<DT id="8"><B>--version</B>
<DD>
Show the version and exit.
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>OPTIONS</H2>
<A NAME="lbAG">&nbsp;</A>
<H3>Generic build options</H3>
<DL COMPACT>
<DT id="9"><B>-c</B><I>control-file</I>
<DD>
Specifies the main source control file to read information from. The
default is
<B>debian/control</B>.
If given with relative pathname this is interpreted starting at
the source tree's top level directory.
<DT id="10"><B>-l</B><I>changelog-file</I>
<DD>
Specifies the changelog file to read information from. The
default is
<B>debian/changelog</B>.
If given with relative pathname this is interpreted starting at
the source tree's top level directory.
<DT id="11"><B>-F</B><I>changelog-format</I>
<DD>
Specifies the format of the changelog. See <B><A HREF="/cgi-bin/man/man2html?1+dpkg-parsechangelog">dpkg-parsechangelog</A></B>(1)
for information about alternative formats.
<DT id="12"><B>--format=</B><I>value</I>
<DD>
Use the given format for building the source package (since dpkg 1.14.17).
It does override any format given in <B>debian/source/format</B>.
<DT id="13"><B>-V</B><I>name</I><B>=</B><I>value</I>
<DD>
Set an output substitution variable.
See <B><A HREF="/cgi-bin/man/man2html?5+deb-substvars">deb-substvars</A></B>(5) for a discussion of output substitution.
<DT id="14"><B>-T</B><I>substvars-file</I>
<DD>
Read substitution variables in
<I>substvars-file</I>;
the default is to not read any file. This option can be used multiple
times to read substitution variables from multiple files (since dpkg 1.15.6).
<DT id="15"><B>-D</B><I>field</I><B>=</B><I>value</I>
<DD>
Override or add an output control file field.
<DT id="16"><B>-U</B><I>field</I>
<DD>
Remove an output control file field.
<DT id="17"><B>-Z</B><I>compression</I>, <B>--compression</B>=<I>compression</I>
<DD>
Specify the compression to use for created tarballs and diff files
(<B>--compression</B> since dpkg 1.15.5).
Note that this option will not cause existing tarballs to be recompressed,
it only affects new files. Supported values are:
<I>gzip</I>, <I>bzip2</I>, <I>lzma</I> and <I>xz</I>.
The default is <I>xz</I> for formats 2.0 and newer, and <I>gzip</I> for
format 1.0. <I>xz</I> is only supported since dpkg 1.15.5.
<DT id="18"><B>-z</B><I>level</I>, <B>--compression-level</B>=<I>level</I>
<DD>
Compression level to use (<B>--compression-level</B> since dpkg 1.15.5).
As with <B>-Z</B> it only affects newly created
files. Supported values are:
<I>1</I> to <I>9</I>, <I>best</I>, and <I>fast</I>.
The default is <I>9</I> for gzip and bzip2, <I>6</I> for xz and lzma.
<DT id="19"><B>-i</B>[<I>regex</I>], <B>--diff-ignore</B>[=<I>regex</I>]
<DD>
You may specify a perl regular expression to match files you want
filtered out of the list of files for the diff (<B>--diff-ignore</B>
since dpkg 1.15.6).
(This list is
generated by a find command.) (If the source package is being built as a
version 3 source package using a VCS, this can be used to ignore
uncommitted changes on specific files. Using -i.* will ignore all of them.)
<P>
The <B>-i</B> option by itself enables this setting with a default regex
(preserving any modification to the default regex done by a previous use
of <B>--extend-diff-ignore</B>) that will filter out control files and
directories of the most common revision control systems, backup and swap
files and Libtool build output directories. There can only be one active
regex, of multiple <B>-i</B> options only the last one will take effect.
<P>
This is very helpful in cutting out extraneous files that get included
in the diff, e.g. if you maintain your source in a revision control
system and want to use a checkout to build a source package without
including the additional files and directories that it will usually
contain (e.g. CVS/, .cvsignore, .svn/). The default regex is already
very exhaustive, but if you need to replace it, please note that by
default it can match any part of a path, so if you want to match the
begin of a filename or only full filenames, you will need to provide
the necessary anchors (e.g. '(^|/)', '($|/)') yourself.
<DT id="20"><B>--extend-diff-ignore</B>=<I>regex</I>
<DD>
The perl regular expression specified will extend the default value used by
<B>--diff-ignore</B> and its current value, if set (since dpkg 1.15.6).
It does this by concatenating "<B>|</B><I>regex</I>" to the existing value.
This option is convenient to use in <B>debian/source/options</B> to exclude
some auto-generated files from the automatic patch generation.
<DT id="21"><B>-I</B>[<I>file-pattern</I>], <B>--tar-ignore</B>[=<I>file-pattern</I>]
<DD>
If this option is specified, the pattern will be passed to
<B><A HREF="/cgi-bin/man/man2html?1+tar">tar</A></B>(1)'s
<B>--exclude</B>
option when it is called to generate a .orig.tar or .tar file
(<B>--tar-ignore</B> since dpkg 1.15.6).
For
example, <B>-I</B>CVS will make tar skip over CVS directories when generating
a .tar.gz file. The option may be repeated multiple times to list multiple
patterns to exclude.
<P>
<B>-I</B> by itself adds default <B>--exclude</B> options that will
filter out control files and directories of the most common revision
control systems, backup and swap files and Libtool build output
directories.
</DL>
<P>
<B>Note:</B>
While they have similar purposes, <B>-i</B> and <B>-I</B> have very
different syntax and semantics. <B>-i</B> can only be specified once and
takes a perl compatible regular expression which is matched against
the full relative path of each file. <B>-I</B> can specified
multiple times and takes a filename pattern with shell wildcards.
The pattern is applied to the full relative path but also
to each part of the path individually. The exact semantic of tar's
<B>--exclude</B> option is somewhat complicated, see
<A HREF="https://www.gnu.org/software/tar/manual/tar.html#wildcards">https://www.gnu.org/software/tar/manual/tar.html#wildcards</A> for a full
documentation.
<P>
The default regex and patterns for both options can be seen
in the output of the <B>--help</B> command.
<A NAME="lbAH">&nbsp;</A>
<H3>Generic extract options</H3>
<DL COMPACT>
<DT id="22"><B>--no-copy</B>
<DD>
Do not copy original tarballs near the extracted source package
(since dpkg 1.14.17).
<DT id="23"><B>--no-check</B>
<DD>
Do not check signatures and checksums before unpacking (since dpkg 1.14.17).
<DT id="24"><B>--no-overwrite-dir</B>
<DD>
Do not overwrite the extraction directory if it already exists
(since dpkg 1.18.8).
<DT id="25"><B>--require-valid-signature</B>
<DD>
Refuse to unpack the source package if it doesn't contain an OpenPGP
signature that can be verified (since dpkg 1.15.0) either with the user's
<I>trustedkeys.gpg</I> keyring, one of the vendor-specific keyrings, or one
of the official Debian keyrings
(<I>/usr/share/keyrings/debian-keyring.gpg</I>
and <I>/usr/share/keyrings/debian-maintainers.gpg</I>).
<DT id="26"><B>--require-strong-checksums</B>
<DD>
Refuse to unpack the source package if it does not contain any strong
checksums (since dpkg 1.18.7).
Currently the only known checksum considered strong is <B>SHA-256</B>.
<DT id="27"><B>--ignore-bad-version</B>
<DD>
Turns the bad source package version check into a non-fatal warning
(since dpkg 1.17.7).
This option should only be necessary when extracting ancient source
packages with broken versions, just for backwards compatibility.
<P>
</DL>
<A NAME="lbAI">&nbsp;</A>
<H2>SOURCE PACKAGE FORMATS</H2>
If you don't know what source format to use, you should probably pick
either "3.0 (quilt)" or "3.0 (native)".
See <A HREF="https://wiki.debian.org/Projects/DebSrc3.0">https://wiki.debian.org/Projects/DebSrc3.0</A> for information on the
deployment of those formats within Debian.
<P>
<A NAME="lbAJ">&nbsp;</A>
<H3>Format: 1.0</H3>
A source package in this format consists either of a <B>.orig.tar.gz</B>
associated to a <B>.diff.gz</B> or a single <B>.tar.gz</B> (in that case
the package is said to be <I>native</I>).
Optionally the original tarball might be accompanied by a detached
upstream signature <B>.orig.tar.gz.asc</B>, extraction
supported since dpkg 1.18.5.
<P>
<B>Extracting</B>
<P>
Extracting a native package is a simple extraction of the single
tarball in the target directory. Extracting a non-native package
is done by first unpacking the <B>.orig.tar.gz</B> and then applying
the patch contained in the <B>.diff.gz</B> file. The timestamp of
all patched files is reset to the extraction time of the source
package (this avoids timestamp skews leading to problems when
autogenerated files are patched). The diff can create new files (the whole
debian directory is created that way) but can't remove files (empty files
will be left over).
<P>
<B>Building</B>
<P>
Building a native package is just creating a single tarball with
the source directory. Building a non-native package involves
extracting the original tarball in a separate ".orig" directory and
regenerating the <B>.diff.gz</B> by comparing the source package
<I>directory</I> with the .orig directory.
<P>
<B>Build options (with --build):</B>
<P>
If a second non-option argument is supplied it should be the name of the
original source directory or tarfile or the empty string if the package is
a Debian-specific one and so has no debianization diffs. If no second
argument is supplied then
<B>dpkg-source</B>
will look for the original source tarfile
<I>package</I><B>_</B><I>upstream-version</I><B>.orig.tar.gz</B>
or the original source directory
<I>directory</I><B>.orig</B>
depending on the <B>-sX</B> arguments.
<P>
<B>-sa</B>, <B>-sp</B>, <B>-sk</B>, <B>-su</B> and <B>-sr</B>
will not overwrite existing tarfiles or directories. If this is
desired then
<B>-sA</B>, <B>-sP</B>, <B>-sK</B>, <B>-sU</B> and <B>-sR</B>
should be used instead.
<P>
<DL COMPACT>
<DT id="28"><B>-sk</B>
<DD>
Specifies to expect the original source as a tarfile, by default
<I>package</I><B>_</B><I>upstream-version</I><B>.orig.tar.</B><I>extension</I><B></B>.
It will leave this original source in place as a tarfile, or copy it
to the current directory if it isn't already there. The
tarball will be unpacked into
<I>directory</I><B>.orig</B>
for the generation of the diff.
<DT id="29"><B>-sp</B>
<DD>
Like
<B>-sk</B>
but will remove the directory again afterwards.
<DT id="30"><B>-su</B>
<DD>
Specifies that the original source is expected as a directory, by
default
<I>package</I><B>-</B><I>upstream-version</I><B>.orig</B>
and
<B>dpkg-source</B>
will create a new original source archive from it.
<DT id="31"><B>-sr</B>
<DD>
Like
<B>-su</B>
but will remove that directory after it has been used.
<DT id="32"><B>-ss</B>
<DD>
Specifies that the original source is available both as a directory
and as a tarfile. <B>dpkg-source</B> will use the directory to create
the diff, but the tarfile to create the
<B>.dsc</B>.
This option must be used with care - if the directory and tarfile do
not match a bad source archive will be generated.
<DT id="33"><B>-sn</B>
<DD>
Specifies to not look for any original source, and to not generate a diff.
The second argument, if supplied, must be the empty string. This is
used for Debian-specific packages which do not have a separate
upstream source and therefore have no debianization diffs.
<DT id="34"><B>-sa</B> or <B>-sA</B>
<DD>
Specifies to look for the original source archive as a tarfile or as a
directory - the second argument, if any, may be either, or the empty
string (this is equivalent to using
<B>-sn</B>).
If a tarfile is found it will unpack it to create the diff and remove
it afterwards (this is equivalent to
<B>-sp</B>);
if a directory is found it will pack it to create the original source
and remove it afterwards (this is equivalent to
<B>-sr</B>);
if neither is found it will assume that the package has no
debianization diffs, only a straightforward source archive (this is
equivalent to
<B>-sn</B>).
If both are found then <B>dpkg-source</B> will ignore the directory,
overwriting it, if
<B>-sA</B>
was specified (this is equivalent to
<B>-sP</B>)
or raise an error if
<B>-sa</B>
was specified.
<B>-sa</B>
is the default.
<DT id="35"><B>--abort-on-upstream-changes</B>
<DD>
The process fails if the generated diff contains changes to files
outside of the debian sub-directory (since dpkg 1.15.8).
This option is not allowed in
<B>debian/source/options</B> but can be used in
<B>debian/source/local-options</B>.
</DL>
<P>
<P>
<B>Extract options (with --extract):</B>
<P>
In all cases any existing original source tree will be removed.
<DL COMPACT>
<DT id="36"><B>-sp</B>
<DD>
Used when extracting then the original source (if any) will be left
as a tarfile. If it is not already located in the current directory
or if an existing but different file is there it will be copied there.
(<B>This is the default</B>).
<DT id="37"><B>-su</B>
<DD>
Unpacks the original source tree.
<DT id="38"><B>-sn</B>
<DD>
Ensures that the original source is neither copied to the current
directory nor unpacked. Any original source tree that was in the
current directory is still removed.
</DL>
<P>
All the
<B>-s</B><I>X</I>
options are mutually exclusive. If you specify more than one only the
last one will be used.
<DL COMPACT>
<DT id="39"><B>--skip-debianization</B>
<DD>
Skips application of the debian diff on top of the upstream sources
(since dpkg 1.15.1).
</DL>
<A NAME="lbAK">&nbsp;</A>
<H3>Format: 2.0</H3>
Extraction supported since dpkg 1.13.9, building supported since dpkg 1.14.8.
Also known as wig&amp;pen. This format is not recommended for wide-spread
usage, the format "3.0 (quilt)" replaces it.
Wig&amp;pen was the first specification of a new-generation source package format.
<P>
The behaviour of this format is the same as the "3.0 (quilt)" format
except that it doesn't use an explicit list of patches. All files in
<B>debian/patches/</B> matching the perl regular expression <B>[\w-]+</B>
must be valid patches: they are applied at extraction time.
<P>
When building a new source package, any change to the upstream source
is stored in a patch named <B>zz_debian-diff-auto</B>.
<A NAME="lbAL">&nbsp;</A>
<H3>Format: 3.0 (native)</H3>
Supported since dpkg 1.14.17.
This format is an extension of the native package format as defined
in the 1.0 format. It supports all compression methods and
will ignore by default any VCS specific files and directories
as well as many temporary files (see default value associated to
<B>-I</B> option in the <B>--help</B> output).
<A NAME="lbAM">&nbsp;</A>
<H3>Format: 3.0 (quilt)</H3>
Supported since dpkg 1.14.17.
A source package in this format contains at least
an original tarball (<B>.orig.tar.</B><I>ext</I> where <I>ext</I> can be
<B>gz</B>, <B>bz2</B>, <B>lzma</B> and <B>xz</B>) and a debian tarball
(<B>.debian.tar.</B><I>ext</I>). It can also contain additional original
tarballs (<B>.orig-</B><I>component</I><B>.tar.</B><I>ext</I>).
<I>component</I> can only contain alphanumeric ('a-zA-Z0-9') characters
and hyphens ('-').
Optionally each original tarball can be accompanied by a detached
upstream signature (<B>.orig.tar.</B><I>ext</I><B>.asc</B> and
<B>.orig-</B><I>component</I><B>.tar.</B><I>ext</I><B>.asc</B>), extraction
supported since dpkg 1.17.20, building supported since dpkg 1.18.5.
<P>
<P>
<B>Extracting</B>
<P>
The main original tarball is extracted first, then all additional original
tarballs are extracted in subdirectories named after the <I>component</I>
part of their filename (any pre-existing directory is replaced). The
debian tarball is extracted on top of the source directory after prior
removal of any pre-existing <B>debian</B> directory. Note that the
debian tarball must contain a <B>debian</B> sub-directory but it
can also contain binary files outside of that directory (see
<B>--include-binaries</B> option).
<P>
All patches listed in <B>debian/patches/</B><I>vendor</I><B>.series</B> or
<B>debian/patches/series</B> are then applied, where <I>vendor</I> will be
the lowercase name of the current vendor, or <B>debian</B> if there is
no vendor defined.
If the former file is used and the latter one doesn't exist (or is a
symlink), then the latter is replaced with a symlink to the former.
This is meant to simplify usage of <B>quilt</B> to manage the set of patches.
Vendor-specific series files are intended to make it possible to serialize
multiple development branches based on the vendor, in a declarative way,
in preference to open-coding this handling in <B>debian/rules</B>.
This is particularly useful when the source would need to be patched
conditionally because the affected files do not have built-in conditional
occlusion support.
Note however that while <B>dpkg-source</B> parses correctly series files
with explicit options used for patch application (stored on each line
after the patch filename and one or more spaces), it does ignore those
options and always expect patches that can be applied with the <B>-p1</B>
option of <B>patch</B>. It will thus emit a warning when it encounters
such options, and the build is likely to fail.
<P>
Note that <B><A HREF="/cgi-bin/man/man2html?1+lintian">lintian</A></B>(1) will emit unconditional warnings when using
vendor series due to a controversial Debian specific ruling, which should
not affect any external usage; to silence these, the dpkg lintian profile
can be used by passing &laquo;<B>--profile dpkg</B>&raquo; to <B><A HREF="/cgi-bin/man/man2html?1+lintian">lintian</A></B>(1).
<P>
The timestamp of all patched files is reset to the extraction time of
the source package (this avoids timestamp skews leading to problems
when autogenerated files are patched).
<P>
Contrary to <B>quilt</B>'s default behaviour, patches are expected to apply
without any fuzz. When that is not the case, you should refresh such
patches with <B>quilt</B>, or <B>dpkg-source</B> will error out while
trying to apply them.
<P>
Similarly to <B>quilt</B>'s default behaviour, the patches can remove
files too.
<P>
The file <B>.pc/applied-patches</B> is created if some
patches have been applied during the extraction.
<P>
<B>Building</B>
<P>
All original tarballs found in the current directory are extracted in a
temporary directory by following the same logic as for the unpack, the
debian directory is copied over in the temporary directory, and all
patches except the automatic patch (<B>debian-changes-</B><I>version</I>
or <B>debian-changes</B>, depending on <B>--single-debian-patch</B>) are
applied. The temporary directory is compared to the source package
directory. When the diff is non-empty, the build fails unless
<B>--single-debian-patch</B> or <B>--auto-commit</B>
has been used, in which case the diff is stored in the automatic patch.
If the automatic patch is created/deleted, it's added/removed from the
series file and from the <B>quilt</B> metadata.
<P>
Any change
on a binary file is not representable in a diff and will thus lead to a
failure unless the maintainer deliberately decided to include that
modified binary file in the debian tarball (by listing it in
<B>debian/source/include-binaries</B>). The build will also fail if it
finds binary files in the debian sub-directory unless they have been
whitelisted through <B>debian/source/include-binaries</B>.
<P>
The updated debian directory and the list of modified binaries is then
used to generate the debian tarball.
<P>
The automatically generated diff doesn't include changes on VCS specific
files as well as many temporary files (see default value associated to
<B>-i</B> option in the <B>--help</B> output). In particular, the
<B>.pc</B> directory used by <B>quilt</B> is ignored during generation of the
automatic patch.
<P>
Note: <B>dpkg-source</B> <B>--before-build</B> (and <B>--build</B>) will
ensure that all patches listed in the series file are applied so that a
package build always has all patches applied. It does this by finding
unapplied patches (they are listed in the <B>series</B> file but not in
<B>.pc/applied-patches</B>), and if the first patch in that set can be
applied without errors, it will apply them all. The option
<B>--no-preparation</B> can be used to disable this
behavior.
<P>
<P>
<B>Recording changes</B>
<DL COMPACT>
<DT id="40"><B>--commit</B> [<I>directory</I>] [<I>patch-name</I>] [<I>patch-file</I>]
<DD>
Generates a patch corresponding to the local changes that are not managed
by the <B>quilt</B> patch system and integrates it in the patch system under
the name <I>patch-name</I>. If the name is missing, it will be asked
interactively. If <I>patch-file</I> is given, it is used as the patch
corresponding to the local changes to integrate. Once integrated, an
editor is launched so that you can edit the meta-information in the patch
header.
<P>
Passing <I>patch-file</I> is mainly useful after a build failure that
pre-generated this file, and on this ground the given file is removed
after integration. Note also that the changes contained in the patch file
must already be applied on the tree and that the files modified by the
patch must not have supplementary unrecorded changes.
<P>
If the patch generation detects modified binary files, they will be
automatically added to <B>debian/source/include-binaries</B> so that
they end up in the debian tarball (exactly like <B>dpkg-source
--include-binaries --build</B> would do).
</DL>
<P>
<B>Build options</B>
<DL COMPACT>
<DT id="41"><B>--allow-version-of-quilt-db=</B><I>version</I>
<DD>
Allow <B>dpkg-source</B> to build the source package if the version of
the <B>quilt</B> metadata is the one specified, even if <B>dpkg-source</B>
doesn't know about it (since dpkg 1.15.5.4).
Effectively this says that the given version of the
<B>quilt</B> metadata is compatible with the version 2 that <B>dpkg-source</B>
currently supports. The version of the <B>quilt</B> metadata is stored in
<B>.pc/.version</B>.
<DT id="42"><B>--include-removal</B>
<DD>
Do not ignore removed files and include them in the automatically
generated patch.
<DT id="43"><B>--include-timestamp</B>
<DD>
Include timestamp in the automatically generated patch.
<DT id="44"><B>--include-binaries</B>
<DD>
Add all modified binaries in the debian tarball. Also add them to
<B>debian/source/include-binaries</B>: they will be added by default
in subsequent builds and this option is thus no more needed.
<DT id="45"><B>--no-preparation</B>
<DD>
Do not try to prepare the build tree by applying patches which are
apparently unapplied (since dpkg 1.14.18).
<DT id="46"><B>--single-debian-patch</B>
<DD>
Use <B>debian/patches/debian-changes</B> instead of
<B>debian/patches/debian-changes-</B><I>version</I> for the name of the
automatic patch generated during build (since dpkg 1.15.5.4).
This option is particularly
useful when the package is maintained in a VCS and a patch set can't reliably
be generated. Instead the current diff with upstream should be stored in a
single patch. The option would be put in <B>debian/source/local-options</B>
and would be accompanied by a <B>debian/source/local-patch-header</B> file
explaining how the Debian changes can be best reviewed, for example in the
VCS that is used.
<DT id="47"><B>--create-empty-orig</B>
<DD>
Automatically create the main original tarball as empty if it's missing
and if there are supplementary original tarballs (since dpkg 1.15.6).
This option is meant to
be used when the source package is just a bundle of multiple upstream
software and where there's no "main" software.
<DT id="48"><B>--no-unapply-patches, --unapply-patches</B>
<DD>
By default, <B>dpkg-source</B> will automatically unapply the patches in the
<B>--after-build</B> hook if it did apply them during
<B>--before-build</B> (<B>--unapply-patches</B> since dpkg 1.15.8,
<B>--no-unapply-patches</B> since dpkg 1.16.5).
Those options allow you to forcefully disable
or enable the patch unapplication process. Those options are only allowed
in <B>debian/source/local-options</B> so that all generated source
packages have the same behavior by default.
<DT id="49"><B>--abort-on-upstream-changes</B>
<DD>
The process fails if an automatic patch has been generated
(since dpkg 1.15.8).
This option
can be used to ensure that all changes were properly recorded in separate
<B>quilt</B> patches prior to the source package build. This option is not
allowed in <B>debian/source/options</B> but can be used in
<B>debian/source/local-options</B>.
<DT id="50"><B>--auto-commit</B>
<DD>
The process doesn't fail if an automatic patch has been generated, instead
it's immediately recorded in the <B>quilt</B> series.
<P>
</DL>
<P>
<B>Extract options</B>
<DL COMPACT>
<DT id="51"><B>--skip-debianization</B>
<DD>
Skips extraction of the debian tarball on top of the upstream sources
(since dpkg 1.15.1).
<DT id="52"><B>--skip-patches</B>
<DD>
Do not apply patches at the end of the extraction (since dpkg 1.14.18).
</DL>
<A NAME="lbAN">&nbsp;</A>
<H3>Format: 3.0 (custom)</H3>
Supported since dpkg 1.14.17.
This format is special.
It doesn't represent a real source package
format but can be used to create source packages with arbitrary files.
<P>
<B>Build options</B>
<P>
All non-option arguments are taken as files to integrate in the
generated source package. They must exist and are preferably
in the current directory. At least one file must be given.
<DL COMPACT>
<DT id="53"><B>--target-format=</B><I>value</I>
<DD>
<B>Required</B>. Defines the real format of the generated source package.
The generated .dsc file will contain this value in its <B>Format</B> field
and not "3.0 (custom)".
</DL>
<A NAME="lbAO">&nbsp;</A>
<H3>Format: 3.0 (git)</H3>
Supported since dpkg 1.14.17.
This format is experimental.
<P>
A source package in this format consists of a
single bundle of a git repository <B>.git</B> to hold the source of a package.
There may also be a <B>.gitshallow</B> file listing revisions for a shallow
git clone.
<P>
<B>Extracting</B>
<P>
The bundle is cloned as a git repository to the target directory.
If there is a gitshallow file, it is installed as <I>.git/shallow</I> inside
the cloned git repository.
<P>
Note that by default the new repository will have the same branch checked
out that was checked out in the original source.
(Typically "master", but it could be anything.)
Any other branches will be available under <I>remotes/origin/</I>.
<P>
<B>Building</B>
<P>
Before going any further, some checks are done to ensure that we
don't have any non-ignored uncommitted changes.
<P>
<B><A HREF="/cgi-bin/man/man2html?1+git-bundle">git-bundle</A></B>(1) is used to generate a bundle of the git repository.
By default, all branches and tags in the repository are included in the
bundle.
<P>
<B>Build options</B>
<DL COMPACT>
<DT id="54"><B>--git-ref=</B><I>ref</I>
<DD>
Allows specifying a git ref to include in the git bundle. Use disables
the default behavior of including all branches and tags. May be specified
multiple times. The <I>ref</I> can be the name of a branch or tag to
include. It may also be any parameter that can be passed to
<B><A HREF="/cgi-bin/man/man2html?1+git-rev-list">git-rev-list</A></B>(1). For example, to include only
the master branch, use <B>--git-ref=</B>master. To include all tags and
branches, except for the private branch, use <B>--git-ref=</B>--all
<B>--git-ref=</B>^private
<DT id="55"><B>--git-depth=</B><I>number</I>
<DD>
Creates a shallow clone with a history truncated to the specified number of
revisions.
</DL>
<A NAME="lbAP">&nbsp;</A>
<H3>Format: 3.0 (bzr)</H3>
Supported since dpkg 1.14.17.
This format is experimental.
It generates a single tarball containing the bzr repository.
<P>
<B>Extracting</B>
<P>
The tarball is unpacked and then bzr is used to checkout the current
branch.
<P>
<B>Building</B>
<P>
Before going any further, some checks are done to ensure that we
don't have any non-ignored uncommitted changes.
<P>
Then the VCS specific part of the source directory is copied over to a
temporary directory. Before this temporary directory is packed in a tarball,
various cleanup are done to save space.
<A NAME="lbAQ">&nbsp;</A>
<H2>DIAGNOSTICS</H2>
<A NAME="lbAR">&nbsp;</A>
<H3>no source format specified in debian/source/format</H3>
The file <B>debian/source/format</B> should always exist and indicate the
desired source format. For backwards compatibility, format "1.0" is
assumed when the file doesn't exist but you should not rely on this:
at some point in the future <B>dpkg-source</B> will be modified to fail
when that file doesn't exist.
<P>
The rationale is that format "1.0" is no longer the recommended format,
you should usually pick one of the newer formats ("3.0 (quilt)", "3.0
(native)") but <B>dpkg-source</B> will not do this automatically for you.
If you want to continue using the old format, you should be explicit about
it and put "1.0" in <B>debian/source/format</B>.
<A NAME="lbAS">&nbsp;</A>
<H3>the diff modifies the following upstream files</H3>
When using source format "1.0" it is usually a bad idea to modify
upstream files directly as the changes end up hidden and mostly
undocumented in the .diff.gz file. Instead you should store your changes
as patches in the debian directory and apply them at build-time. To avoid
this complexity you can also use the format "3.0 (quilt)" that offers
this natively.
<A NAME="lbAT">&nbsp;</A>
<H3>cannot represent change to <I>file</I></H3>
Changes to upstream sources are usually stored with patch files, but not
all changes can be represented with patches: they can only alter the
content of plain text files. If you try replacing a file with something of
a different type (for example replacing a plain file with a symlink or a
directory), you will get this error message.
<A NAME="lbAU">&nbsp;</A>
<H3>newly created empty file </B><I>file</I><B> will not be represented in diff</H3>
Empty files can't be created with patch files. Thus this change is not
recorded in the source package and you are warned about it.
</B><A NAME="lbAV">&nbsp;</A>
<H3>executable mode </B><I>perms</I><B> of </B><I>file</I><B> will not be represented in diff</H3>
Patch files do not record permissions of files and thus executable
permissions are not stored in the source package. This warning reminds you
of that fact.
</B><A NAME="lbAW">&nbsp;</A>
<H3>special mode </B><I>perms</I><B> of </B><I>file</I><B> will not be represented in diff</H3>
Patch files do not record permissions of files and thus modified
permissions are not stored in the source package. This warning reminds you
of that fact.
</B><A NAME="lbAX">&nbsp;</A>
<H2>ENVIRONMENT</H2>
<DL COMPACT>
<DT id="56"><B>DPKG_COLORS</B>
<DD>
Sets the color mode (since dpkg 1.18.5).
The currently accepted values are: <B>auto</B> (default), <B>always</B> and
<B>never</B>.
<DT id="57"><B>DPKG_NLS</B>
<DD>
If set, it will be used to decide whether to activate Native Language Support,
also known as internationalization (or i18n) support (since dpkg 1.19.0).
The accepted values are: <B>0</B> and <B>1</B> (default).
<DT id="58"><B>SOURCE_DATE_EPOCH</B>
<DD>
If set, it will be used as the timestamp (as seconds since the epoch) to
clamp the mtime in the <B><A HREF="/cgi-bin/man/man2html?5+tar">tar</A></B>(5) file entries.
<DT id="59"><B>VISUAL</B>
<DD>
<B>EDITOR</B>
Used by the "2.0" and "3.0 (quilt)" source format modules.
<DT id="60"><B>GIT_DIR</B>
<DD>
<B>GIT_INDEX_FILE</B>
<B>GIT_OBJECT_DIRECTORY</B>
<B>GIT_ALTERNATE_OBJECT_DIRECTORIES</B>
<B>GIT_WORK_TREE</B>
Used by the "3.0 (git)" source format modules.
</DL>
<A NAME="lbAY">&nbsp;</A>
<H2>FILES</H2>
<A NAME="lbAZ">&nbsp;</A>
<H3>debian/source/format</H3>
This file contains on a single line the format that should be used to
build the source package (possible formats are described above). No leading
or trailing spaces are allowed.
<A NAME="lbBA">&nbsp;</A>
<H3>debian/source/include-binaries</H3>
This file contains a list of binary files (one per line) that should be
included in the debian tarball. Leading and trailing spaces are stripped.
Lines starting with '<B>#</B>' are comments and are skipped.
Empty lines are ignored.
<A NAME="lbBB">&nbsp;</A>
<H3>debian/source/options</H3>
This file contains a list of long options that should be automatically
prepended to the set of command line options of a <B>dpkg-source --build</B>
or <B>dpkg-source --print-format</B> call. Options like
<B>--compression</B> and <B>--compression-level</B> are well suited for
this file.
<P>
Each option should be put on a separate line. Empty lines and lines
starting with '<B>#</B>' are ignored.
The leading '<B>--</B>' should be stripped and short options are
not allowed.
Optional spaces are allowed around the '<B>=</B>' symbol and optional
quotes are allowed around the value.
Here's an example of such a file:
<P>
<BR>&nbsp;&nbsp;#&nbsp;let&nbsp;dpkg-source&nbsp;create&nbsp;a&nbsp;debian.tar.bz2&nbsp;with&nbsp;maximal&nbsp;compression
<BR>&nbsp;&nbsp;compression&nbsp;=&nbsp;&quot;bzip2&quot;
<BR>&nbsp;&nbsp;compression-level&nbsp;=&nbsp;9
<BR>&nbsp;&nbsp;#&nbsp;use&nbsp;debian/patches/debian-changes&nbsp;as&nbsp;automatic&nbsp;patch
<BR>&nbsp;&nbsp;single-debian-patch
<BR>&nbsp;&nbsp;#&nbsp;ignore&nbsp;changes&nbsp;on&nbsp;config.{sub,guess}
<BR>&nbsp;&nbsp;extend-diff-ignore&nbsp;=&nbsp;&quot;(^|/)(config.sub|config.guess)$&quot;
<P>
Note: <B>format</B> options are not accepted in this file, you should
use <B>debian/source/format</B> instead.
<A NAME="lbBC">&nbsp;</A>
<H3>debian/source/local-options</H3>
Exactly like <B>debian/source/options</B> except that the file is not
included in the generated source package. It can be useful to store
a preference tied to the maintainer or to the VCS repository where
the source package is maintained.
<A NAME="lbBD">&nbsp;</A>
<H3>debian/source/local-patch-header and debian/source/patch-header</H3>
Free form text that is put on top of the automatic patch generated
in formats "2.0" or "3.0 (quilt)". <B>local-patch-header</B> is not
included in the generated source package while <B>patch-header</B> is.
<A NAME="lbBE">&nbsp;</A>
<H3>debian/patches/<I>vendor</I>.series</H3>
<A NAME="lbBF">&nbsp;</A>
<H3>debian/patches/series</H3>
This file lists all patches that have to be applied (in the given order)
on top of the upstream source package. Leading and trailing spaces are
stripped.
The <I>vendor</I> will be the lowercase name of the current vendor, or
<B>debian</B> if there is no vendor defined.
If the vendor-specific series file does not exist, the vendor-less series
file will be used.
Lines starting with '<B>#</B>' are comments and are skipped.
Empty lines are ignored.
Remaining lines start with a patch filename (relative
to the <B>debian/patches/</B> directory) up to the first space character or
the end of line. Optional <B>quilt</B> options can follow up to the end of line
or the first '<B>#</B>' preceded by one or more spaces (which marks the
start of a comment up to the end of line).
<A NAME="lbBG">&nbsp;</A>
<H2>BUGS</H2>
The point at which field overriding occurs compared to certain
standard output field settings is rather confused.
<A NAME="lbBH">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?5+deb-src-control">deb-src-control</A></B>(5),
<B><A HREF="/cgi-bin/man/man2html?5+deb-changelog">deb-changelog</A></B>(5),
<B><A HREF="/cgi-bin/man/man2html?5+dsc">dsc</A></B>(5).
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="61"><A HREF="#lbAB">NAME</A><DD>
<DT id="62"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="63"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="64"><A HREF="#lbAE">COMMANDS</A><DD>
<DT id="65"><A HREF="#lbAF">OPTIONS</A><DD>
<DL>
<DT id="66"><A HREF="#lbAG">Generic build options</A><DD>
<DT id="67"><A HREF="#lbAH">Generic extract options</A><DD>
</DL>
<DT id="68"><A HREF="#lbAI">SOURCE PACKAGE FORMATS</A><DD>
<DL>
<DT id="69"><A HREF="#lbAJ">Format: 1.0</A><DD>
<DT id="70"><A HREF="#lbAK">Format: 2.0</A><DD>
<DT id="71"><A HREF="#lbAL">Format: 3.0 (native)</A><DD>
<DT id="72"><A HREF="#lbAM">Format: 3.0 (quilt)</A><DD>
<DT id="73"><A HREF="#lbAN">Format: 3.0 (custom)</A><DD>
<DT id="74"><A HREF="#lbAO">Format: 3.0 (git)</A><DD>
<DT id="75"><A HREF="#lbAP">Format: 3.0 (bzr)</A><DD>
</DL>
<DT id="76"><A HREF="#lbAQ">DIAGNOSTICS</A><DD>
<DL>
<DT id="77"><A HREF="#lbAR">no source format specified in debian/source/format</A><DD>
<DT id="78"><A HREF="#lbAS">the diff modifies the following upstream files</A><DD>
<DT id="79"><A HREF="#lbAT">cannot represent change to <I>file</I></A><DD>
<DT id="80"><A HREF="#lbAU">newly created empty file <I>file</I><B> will not be represented in diff</A><DD>
<DT id="81"><A HREF="#lbAV">executable mode <I>perms</I><B> of </B><I>file</I><B> will not be represented in diff</A><DD>
<DT id="82"><A HREF="#lbAW">special mode <I>perms</I><B> of </B><I>file</I><B> will not be represented in diff</A><DD>
</DL>
<DT id="83"><A HREF="#lbAX">ENVIRONMENT</A><DD>
<DT id="84"><A HREF="#lbAY">FILES</A><DD>
<DL>
<DT id="85"><A HREF="#lbAZ">debian/source/format</A><DD>
<DT id="86"><A HREF="#lbBA">debian/source/include-binaries</A><DD>
<DT id="87"><A HREF="#lbBB">debian/source/options</A><DD>
<DT id="88"><A HREF="#lbBC">debian/source/local-options</A><DD>
<DT id="89"><A HREF="#lbBD">debian/source/local-patch-header and debian/source/patch-header</A><DD>
<DT id="90"><A HREF="#lbBE">debian/patches/<I>vendor</I>.series</A><DD>
<DT id="91"><A HREF="#lbBF">debian/patches/series</A><DD>
</DL>
<DT id="92"><A HREF="#lbBG">BUGS</A><DD>
<DT id="93"><A HREF="#lbBH">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:11 GMT, March 31, 2021
</BODY>
</HTML>