dpkg-source.1 34 KB

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