dpkg-source.1 34 KB

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