dpkg-source.man 35 KB

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