| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497 |
- .\" Authors: Ian Jackson, Raphael Hertzog
- .TH dpkg\-source 1 "2008-08-18" "Debian Project" "dpkg utilities"
- .SH NAME
- dpkg\-source \- Debian source package (.dsc) manipulation tool
- .
- .SH SYNOPSIS
- .B dpkg\-source
- .RI [ options ]
- .I command
- .
- .SH DESCRIPTION
- .B dpkg\-source
- packs and unpacks Debian source archives.
- 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.
- .
- .SH COMMANDS
- .TP
- .BI "\-x " filename ".dsc " \fR[\fPoutput-directory\fR]\fP
- Extract a source package. One non-option argument must be supplied,
- the name of the Debian source control file
- .RB ( .dsc ).
- 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 \fIsource\fR-\fIversion\fR under the current working
- directory.
- .B dpkg\-source
- 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
- .BR .dsc .
- 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.
- If the source package uses a non-standard format (currently this means all
- formats except "1.0"), its name will be stored in
- \fBdebian/source/format\fP so that the following builds of the source
- package use the same format by default.
- .TP
- .RI "\fB\-b\fP " directory " [" format-specific-parameters ]
- Build a source package. 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.
- \fBdpkg\-source\fP will build the source package with the first format
- that works from this ordered list:
- the format indicated in the \fIFormat\fP field of \fBdebian/control\fP,
- the format(s) indicated with the \fI\-\-format\fP command-line option(s),
- the format indicated in \fBdebian/source/format\fP,
- "1.0", "3.0 (native)". See below for an extensive description of
- various source package formats.
- .TP
- .BR \-h ", " \-\-help
- Show the usage message and exit.
- .TP
- .BR \-\-version
- Show the version and exit.
- .
- .SH GENERIC BUILD OPTIONS
- .TP
- .BI \-c controlfile
- Specifies the main source control file to read information from. The
- default is
- .BR debian/control .
- If given with relative pathname this is interpreted starting at
- the source tree's top level directory.
- .TP
- .BI \-l changelogfile
- Specifies the change log file to read information from. The
- default is
- .BR debian/changelog .
- If given with relative pathname this is interpreted starting at
- the source tree's top level directory.
- .TP
- .BI \-F changelogformat
- Specifies the format of the changelog. By default the format is read
- from a special line near the bottom of the changelog or failing that
- defaults to the debian standard format.
- .TP
- .BI \-\-format= value
- Try first the given format for building the source package. If used
- multiple times, they are tried in order. It doesn't override
- any explicit \fIFormat\fP field in \fBdebian/control\fP but it does
- override any format given in \fBdebian/source/format\fP.
- .TP
- .BI \-V name = value
- \fBDeprecated\fP. Set an output substitution variable.
- See \fBdeb\-substvars\fP(5) for a discussion of output substitution.
- .TP
- .BI \-T substvarsfile
- \fBDeprecated\fP. Read substitution variables in
- .IR substvarsfile ;
- the default is to not read any file.
- .TP
- .BI \-D field = value
- Override or add an output control file field.
- .TP
- .BI \-U field
- Remove an output control file field.
- .TP
- .BR \-Z \fIcompression\fP
- Specify the compression to use for created files (tarballs and diffs).
- Note that this option will not cause existing tarballs to be recompressed,
- it only affects new files. Supported values are:
- .IR gzip ", " bzip2 ", and " lzma .
- \fIgzip\fP is the default.
- .TP
- .BR \-z \fIlevel\fP
- Compression level to use. As with \fB\-Z\fP it only affects newly created
- files. Supported values are:
- .IR 1 " to " 9 ", " best ", and " fast .
- \fI9\fP is the default.
- .TP
- .BR \-i [\fIregexp\fP]
- You may specify a perl regular expression to match files you want
- filtered out of the list of files for the diff. (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
- uncommited changes on specific files. Using \-i.* will ignore all of them.)
- \fB\-i\fP by itself enables the option, with a default regexp 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 regexp, of multiple
- \fB\-i\fP options only the last one will take effect.
- 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 regexp 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.
- .TP
- .BR \-I [\fIfile-pattern\fP]
- If this option is specified, the pattern will be passed to
- .BR tar (1)'s
- \-\-exclude
- option when it is called to generate a .orig.tar or .tar file. For
- example, \-ICVS 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.
- \fB\-I\fP by itself adds default \-\-exclude 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.
- .PP
- .B Note:
- While they have similar purposes, \fB-i\fP and \fB-I\fP have very
- different syntax and semantics. \fB-i\fP can only be specified once and
- takes a perl compatible regular expression which is matched against
- the full relative path of each file. \fB-I\fP 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
- \-\-exclude option is somewhat complicated, see
- http://www.gnu.org/software/tar/manual/tar.html#wildcards for a full
- documentation.
- The default regexp and patterns for both options can be seen
- in the output of the \fB\-\-help\fP command.
- .SH GENERIC EXTRACT OPTIONS
- .TP
- .BI \-\-no\-copy
- Do not copy original tarballs near the extracted source package.
- .TP
- .BI \-\-no\-check
- Do not check signatures and checksums before unpacking.
- .TP
- .BI \-\-require\-valid\-signature
- Refuse to unpack the source package if it doesn't contain an OpenPGP
- signature that can be verified either with the user's keyring or one
- of the official Debian keyrings
- (\fI/usr/share/keyrings/debian-keyring.gpg\fP
- and \fI/usr/share/keyrings/debian-maintainers.gpg\fP).
- .SH SOURCE PACKAGE FORMATS
- .SS Format: 1.0
- A source package in this format consists either of a \fB.orig.tar.gz\fP
- associated to a \fB.diff.gz\fP or a single \fB.tar.gz\fP (in that case
- the package is said to be \fInative\fP).
- .B Extracting
- 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 \fB.orig.tar.gz\fP and then applying
- the patch contained in the \fB.diff.gz\fP 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).
- .B Building
- 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 \fB.diff.gz\fP by comparing the source package
- \fIdirectory\fP with the .orig directory.
- .TP
- .B Build options (with \-b):
- .PP
- 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 Debianisation diffs. If no second
- argument is supplied then
- .B dpkg\-source
- will look for the original source tarfile
- .IB package _ upstream-version .orig.tar.gz
- or the original source directory
- .IB directory .orig
- depending on the \fB\-sX\fP arguments.
- .BR \-sa ", " \-sp ", " \-sk ", " \-su " and " \-sr
- will not overwrite existing tarfiles or directories. If this is
- desired then
- .BR \-sA ", " \-sP ", " \-sK ", " \-sU " and " \-sR
- should be used instead.
- .TP
- .BR \-sk
- Specifies to expect the original source as a tarfile, by default
- .IB package _ upstream-version .orig.tar. extension \fR.
- 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
- .IB directory .orig
- for the generation of the diff.
- .TP
- .B \-sp
- Like
- .B \-sk
- but will remove the directory again afterwards.
- .TP
- .B \-su
- Specifies that the original source is expected as a directory, by
- default
- .IB package - upstream-version .orig
- and
- .B dpkg\-source
- will create a new original source archive from it.
- .TP
- .B \-sr
- Like
- .B \-su
- but will remove that directory after it has been used.
- .TP
- .B \-ss
- Specifies that the original source is available both as a directory
- and as a tarfile. dpkg-source will use the directory to create the diff, but
- the tarfile to create the
- .BR .dsc .
- This option must be used with care - if the directory and tarfile do
- not match a bad source archive will be generated.
- .TP
- .B \-sn
- 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 debianisation diffs.
- .TP
- .BR \-sa " or " \-sA
- 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
- .BR \-sn ).
- If a tarfile is found it will unpack it to create the diff and remove
- it afterwards (this is equivalent to
- .BR \-sp );
- if a directory is found it will pack it to create the original source
- and remove it afterwards (this is equivalent to
- .BR \-sr );
- if neither is found it will assume that the package has no
- debianisation diffs, only a straightforward source archive (this is
- equivalent to
- .BR \-sn ).
- If both are found then \fBdpkg\-source\fP will ignore the directory,
- overwriting it, if
- .B \-sA
- was specified (this is equivalent to
- .BR \-sP )
- or raise an error if
- .B \-sa
- was specified.
- .B \-sA
- is the default.
- .TP
- .B Extract options (with \-x):
- .PP
- In all cases any existing original source tree will be removed.
- .TP
- .B \-sp
- 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.
- (\fBThis is the default\fP).
- .TP
- .B \-su
- Unpacks the original source tree.
- .TP
- .B \-sn
- 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.
- .PP
- All the
- .BI \-s X
- options are mutually exclusive. If you specify more than one only the
- last one will be used.
- .
- .SS Format: 2.0
- Also known as wig&pen. This format is not recommended for wide-spread
- usage, the format "3.0 (quilt)" replaces it. Wig&pen was the first
- specification of a new-generation source package format.
- 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
- \fBdebian/patches/\fP matching the perl regular expression \fB[\\w\-]+\fP
- must be valid patches: they are applied at extraction time.
- When building a new source package, any change to the upstream source
- is stored in a patch named \fBzz_debian-diff-auto\fP.
- .
- .SS Format: 3.0 (native)
- 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
- \fB-I\fP option in the \fB\-\-help\fP output).
- .
- .SS Format: 3.0 (quilt)
- A source package in this format contains at least
- an original tarball (\fB.orig.tar.\fP\fIext\fP where \fIext\fP can be
- \fBgz\fP, \fBbz2\fP and \fBlzma\fP) and a debian tarball
- (\fB.debian.tar.\fP\fIext\fP). It can also contain additional original
- tarballs (\fB.orig-\fP\fIcomponent\fP\fB.tar.\fP\fIext\fP).
- .PP
- .B Extracting
- .PP
- The main original tarball is extracted first, then all additional original
- tarballs are extracted in subdirectories named after the \fIcomponent\fP
- 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 \fBdebian\fP directory. Note that the
- debian tarball must contain a \fBdebian\fP sub-directory but it
- can also contain binary files outside of that directory (see
- \fB\-\-include\-binaries\fP option).
- .PP
- All patches listed in \fBdebian/patches/debian.series\fP or
- \fBdebian/patches/series\fP are then applied.
- 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 quilt to manage the set of patches. Note
- however that while \fBdpkg\-source\fP 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 \fB-p1\fP
- option of \fBpatch\fP. It will thus emit a warning when it encounters
- such options, and the build is likely to fail.
- .PP
- Similarly to quilt's default behaviour, the patches can remove files too.
- .PP
- The file \fBdebian/patches/.dpkg-source-applied\fP is created if some
- patches have been applied during the extraction.
- .PP
- .B Building
- .PP
- 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 \fBdebian-changes-\fP\fIversion\fP are applied.
- The temporary directory is compared to the source package directory
- and the diff (if non-empty) is stored in
- \fBdebian/patches/debian-changes-\fP\fIversion\fP. 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
- \fBdebian/source/include-binaries\fP). The build will also fail if it
- finds binary files in the debian sub-directory unless they have been
- whitelisted through \fBdebian/source/include-binaries\fP.
- The updated debian directory and the list of modified binaries is then
- used to regenerate the debian tarball.
- The automatically generated diff doesn't include changes on VCS specific
- files as well as many temporary files (see default value associated to
- \fB-i\fP option in the \fB\-\-help\fP output). In particular, the
- \fB.pc\fP directory used by quilt is ignored during generation of the
- automatic patch.
- Note: \fBdpkg\-source\fP expects the source tree to have all patches
- applied when you generate the source package. This is not the case
- when the source tree has been obtained by unpacking a source package using
- the Format: 1.0 for instance. To mitigate the problem, \fBdpkg\-source\fP
- will apply patches before building unless it finds
- \fBdebian/patches/.dpkg-source-applied\fP. The presence of a \fB.pc\fP
- subdirectory is also interpreted as a sign that some patches have been
- applied and in this case \fBquilt unapplied\fP is called to verify that
- all patches are applied. The option \fB\-\-no\-preparation\fP can be used
- to disable this behaviour.
- .PP
- .B Build options
- .TP
- .B \-\-include\-removal
- Do not ignore removed files and include them in the automatically
- generated patch.
- .TP
- .B \-\-include\-timestamp
- Include timestamp in the automatically generated patch.
- .TP
- .B \-\-include\-binaries
- Add all modified binaries in the debian tarball. Also add them to
- \fBdebian/source/include-binaries\fP: they will be added by default
- in subsequent builds and this option is thus no more needed.
- .TP
- .B \-\-no\-preparation
- Do not try to prepare the build tree by applying patches which are
- apparently unapplied.
- .PP
- .B Extract options
- .TP
- .B \-\-skip\-patches
- Do not apply patches at the end of the extraction.
- .TP
- .B \-\-without\-quilt
- Don't use quilt to apply patches but dpkg-source's own code. It won't be
- possible to use quilt directly on the unpacked directory but it will be
- free of quilt's temporary files as well.
- .
- .SS Format: 3.0 (custom)
- This format is particular. It doesn't represent a real source package
- format but can be used to create source packages with arbitrary files.
- .PP
- .B Build options
- .PP
- All non-option arguments are taken as files to integrate in the
- generated source package. They must exist and are preferrably
- in the current directory. At least one file must be given.
- .TP
- .BI \-\-target\-format= value
- \fBRequired\fP. Defines the real format of the generated source package.
- The generated .dsc file will contain this value in its \fIFormat\fP field
- and not "3.0 (custom)".
- .
- .SS Format: 3.0 (git) and 3.0 (bzr)
- Those formats are experimental. They generate a single tarball
- containing the corresponding VCS repository.
- .PP
- .B Extracting
- .PP
- The tarball is unpacked and then the VCS is used to checkout the current
- branch.
- .PP
- .B Building
- .PP
- Before going any further, some checks are done to ensure that we
- don't have any non-ignored uncommitted changes.
- .PP
- 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.
- .SH BUGS
- The point at which field overriding occurs compared to certain
- standard output field settings is rather confused.
- .SH SEE ALSO
- .BR dpkg\-deb (1),
- .BR dpkg (1),
- .BR dselect (1).
- .
- .SH AUTHORS
- Copyright \(co 1995-1996 Ian Jackson
- .br
- Copyright \(co 2000 Wichert Akkerman
- .br
- Copyright \(co 2008 Rapha\[:e]l Hertzog
- .sp
- This is free software; see the GNU General Public Licence version 2 or later
- for copying conditions. There is NO WARRANTY.
|