dpkg-source.1 30 KB

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