dpkg-source.1 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  1. .\" Authors: Ian Jackson, Raphael Hertzog
  2. .TH dpkg\-source 1 "2009-03-09" "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 [ options ]
  9. .I command
  10. .
  11. .SH DESCRIPTION
  12. .B dpkg\-source
  13. packs and unpacks Debian source archives.
  14. None of these commands allow multiple options to be combined into one,
  15. and they do not allow the value for an option to be specified in a
  16. separate argument.
  17. .
  18. .SH COMMANDS
  19. .TP
  20. .BI "\-x " filename ".dsc " \fR[\fPoutput-directory\fR]\fP
  21. Extract a source package. One non-option argument must be supplied,
  22. the name of the Debian source control file
  23. .RB ( .dsc ).
  24. An optional second non-option argument may be supplied to specify the
  25. directory to extract the source package to, this must not exist. If
  26. no output directory is specified, the source package is extracted into
  27. a directory named \fIsource\fR-\fIversion\fR under the current working
  28. directory.
  29. .B dpkg\-source
  30. will read the names of the other file(s) making up the source package
  31. from the control file; they are assumed to be in the same directory as
  32. the
  33. .BR .dsc .
  34. The files in the extracted package will have their permissions and
  35. ownerships set to those which would have been expected if the files
  36. and directories had simply been created - directories and executable
  37. files will be 0777 and plain files will be 0666, both modified by the
  38. extractors' umask; if the parent directory is setgid then the
  39. extracted directories will be too, and all the files and directories
  40. will inherit its group ownership.
  41. If the source package uses a non-standard format (currently this means all
  42. formats except "1.0"), its name will be stored in
  43. \fBdebian/source/format\fP so that the following builds of the source
  44. package use the same format by default.
  45. .TP
  46. .RI "\fB\-b\fP " directory " [" format-specific-parameters ]
  47. Build a source package. The first non-option argument is taken as the
  48. name of the directory containing the debianized source tree (i.e. with a
  49. debian sub-directory and maybe changes to the original files).
  50. Depending on the source package format used to build the package,
  51. additional parameters might be accepted.
  52. \fBdpkg\-source\fP will build the source package with the first format
  53. that works from this ordered list:
  54. the format(s) indicated with the \fI\-\-format\fP command-line option(s),
  55. the format indicated in \fBdebian/source/format\fP,
  56. "1.0", "3.0 (native)". See section \fBSOURCE PACKAGE FORMATS\fP for an
  57. extensive description of the various source package formats.
  58. .TP
  59. .BR \-h ", " \-\-help
  60. Show the usage message and exit.
  61. .TP
  62. .BR \-\-version
  63. Show the version and exit.
  64. .
  65. .SH GENERIC BUILD OPTIONS
  66. .TP
  67. .BI \-c controlfile
  68. Specifies the main source control file to read information from. The
  69. default is
  70. .BR debian/control .
  71. If given with relative pathname this is interpreted starting at
  72. the source tree's top level directory.
  73. .TP
  74. .BI \-l changelogfile
  75. Specifies the change log file to read information from. The
  76. default is
  77. .BR debian/changelog .
  78. If given with relative pathname this is interpreted starting at
  79. the source tree's top level directory.
  80. .TP
  81. .BI \-F changelogformat
  82. Specifies the format of the changelog. By default the format is read
  83. from a special line near the bottom of the changelog or failing that
  84. defaults to the debian standard format.
  85. .TP
  86. .BI \-\-format= value
  87. Try first the given format for building the source package. If used
  88. multiple times, they are tried in order. It does
  89. override any format given in \fBdebian/source/format\fP.
  90. .TP
  91. .BI \-V name = value
  92. Set an output substitution variable.
  93. See \fBdeb\-substvars\fP(5) for a discussion of output substitution.
  94. .TP
  95. .BI \-T substvarsfile
  96. Read substitution variables in
  97. .IR substvarsfile ;
  98. the default is to not read any file.
  99. .TP
  100. .BI \-D field = value
  101. Override or add an output control file field.
  102. .TP
  103. .BI \-U field
  104. Remove an output control file field.
  105. .TP
  106. .BR \-Z \fIcompression\fP
  107. Specify the compression to use for created files (tarballs and diffs).
  108. Note that this option will not cause existing tarballs to be recompressed,
  109. it only affects new files. Supported values are:
  110. .IR gzip ", " bzip2 ", and " lzma .
  111. \fIgzip\fP is the default.
  112. .TP
  113. .BR \-z \fIlevel\fP
  114. Compression level to use. As with \fB\-Z\fP it only affects newly created
  115. files. Supported values are:
  116. .IR 1 " to " 9 ", " best ", and " fast .
  117. \fI9\fP is the default.
  118. .TP
  119. .BR \-i [\fIregexp\fP]
  120. You may specify a perl regular expression to match files you want
  121. filtered out of the list of files for the diff. (This list is
  122. generated by a find command.) (If the source package is being built as a
  123. version 3 source package using a VCS, this can be used to ignore
  124. uncommited changes on specific files. Using \-i.* will ignore all of them.)
  125. \fB\-i\fP by itself enables the option, with a default regexp that will
  126. filter out control files and directories of the most common revision
  127. control systems, backup and swap files and Libtool build output
  128. directories. There can only be one active regexp, of multiple
  129. \fB\-i\fP options only the last one will take effect.
  130. This is very helpful in cutting out extraneous files that get included
  131. in the diff, e.g. if you maintain your source in a revision control
  132. system and want to use a checkout to build a source package without
  133. including the additional files and directories that it will usually
  134. contain (e.g. CVS/, .cvsignore, .svn/). The default regexp is already
  135. very exhaustive, but if you need to replace it, please note that by
  136. default it can match any part of a path, so if you want to match the
  137. begin of a filename or only full filenames, you will need to provide
  138. the necessary anchors (e.g. '(^|/)', '($|/)') yourself.
  139. .TP
  140. .BR \-I [\fIfile-pattern\fP]
  141. If this option is specified, the pattern will be passed to
  142. .BR tar (1)'s
  143. \-\-exclude
  144. option when it is called to generate a .orig.tar or .tar file. For
  145. example, \-ICVS will make tar skip over CVS directories when generating
  146. a .tar.gz file. The option may be repeated multiple times to list multiple
  147. patterns to exclude.
  148. \fB\-I\fP by itself adds default \-\-exclude options that will
  149. filter out control files and directories of the most common revision
  150. control systems, backup and swap files and Libtool build output
  151. directories.
  152. .PP
  153. .B Note:
  154. While they have similar purposes, \fB-i\fP and \fB-I\fP have very
  155. different syntax and semantics. \fB-i\fP can only be specified once and
  156. takes a perl compatible regular expression which is matched against
  157. the full relative path of each file. \fB-I\fP can specified
  158. multiple times and takes a filename pattern with shell wildcards.
  159. The pattern is applied to the full relative path but also
  160. to each part of the path individually. The exact semantic of tar's
  161. \-\-exclude option is somewhat complicated, see
  162. http://www.gnu.org/software/tar/manual/tar.html#wildcards for a full
  163. documentation.
  164. The default regexp and patterns for both options can be seen
  165. in the output of the \fB\-\-help\fP command.
  166. .SH GENERIC EXTRACT OPTIONS
  167. .TP
  168. .BI \-\-no\-copy
  169. Do not copy original tarballs near the extracted source package.
  170. .TP
  171. .BI \-\-no\-check
  172. Do not check signatures and checksums before unpacking.
  173. .TP
  174. .BI \-\-require\-valid\-signature
  175. Refuse to unpack the source package if it doesn't contain an OpenPGP
  176. signature that can be verified either with the user's
  177. \fItrustedkeys.gpg\fP keyring, one of the vendor-specific keyrings, or one
  178. of the official Debian keyrings
  179. (\fI/usr/share/keyrings/debian-keyring.gpg\fP
  180. and \fI/usr/share/keyrings/debian-maintainers.gpg\fP).
  181. .SH SOURCE PACKAGE FORMATS
  182. .SS Format: 1.0
  183. A source package in this format consists either of a \fB.orig.tar.gz\fP
  184. associated to a \fB.diff.gz\fP or a single \fB.tar.gz\fP (in that case
  185. the package is said to be \fInative\fP).
  186. .B Extracting
  187. Extracting a native package is a simple extraction of the single
  188. tarball in the target directory. Extracting a non-native package
  189. is done by first unpacking the \fB.orig.tar.gz\fP and then applying
  190. the patch contained in the \fB.diff.gz\fP file. The timestamp of
  191. all patched files is reset to the extraction time of the source
  192. package (this avoids timestamp skews leading to problems when
  193. autogenerated files are patched). The diff can create new files (the whole
  194. debian directory is created that way) but can't remove files (empty files
  195. will be left over).
  196. .B Building
  197. Building a native package is just creating a single tarball with
  198. the source directory. Building a non-native package involves
  199. extracting the original tarball in a separate ".orig" directory and
  200. regenerating the \fB.diff.gz\fP by comparing the source package
  201. \fIdirectory\fP with the .orig directory.
  202. .TP
  203. .B Build options (with \-b):
  204. .PP
  205. If a second non-option argument is supplied it should be the name of the
  206. original source directory or tarfile or the empty string if the package is
  207. a Debian-specific one and so has no Debianisation diffs. If no second
  208. argument is supplied then
  209. .B dpkg\-source
  210. will look for the original source tarfile
  211. .IB package _ upstream-version .orig.tar.gz
  212. or the original source directory
  213. .IB directory .orig
  214. depending on the \fB\-sX\fP arguments.
  215. .BR \-sa ", " \-sp ", " \-sk ", " \-su " and " \-sr
  216. will not overwrite existing tarfiles or directories. If this is
  217. desired then
  218. .BR \-sA ", " \-sP ", " \-sK ", " \-sU " and " \-sR
  219. should be used instead.
  220. .TP
  221. .BR \-sk
  222. Specifies to expect the original source as a tarfile, by default
  223. .IB package _ upstream-version .orig.tar. extension \fR.
  224. It will leave this original source in place as a tarfile, or copy it
  225. to the current directory if it isn't already there. The
  226. tarball will be unpacked into
  227. .IB directory .orig
  228. for the generation of the diff.
  229. .TP
  230. .B \-sp
  231. Like
  232. .B \-sk
  233. but will remove the directory again afterwards.
  234. .TP
  235. .B \-su
  236. Specifies that the original source is expected as a directory, by
  237. default
  238. .IB package - upstream-version .orig
  239. and
  240. .B dpkg\-source
  241. will create a new original source archive from it.
  242. .TP
  243. .B \-sr
  244. Like
  245. .B \-su
  246. but will remove that directory after it has been used.
  247. .TP
  248. .B \-ss
  249. Specifies that the original source is available both as a directory
  250. and as a tarfile. dpkg-source will use the directory to create the diff, but
  251. the tarfile to create the
  252. .BR .dsc .
  253. This option must be used with care - if the directory and tarfile do
  254. not match a bad source archive will be generated.
  255. .TP
  256. .B \-sn
  257. Specifies to not look for any original source, and to not generate a diff.
  258. The second argument, if supplied, must be the empty string. This is
  259. used for Debian-specific packages which do not have a separate
  260. upstream source and therefore have no debianisation diffs.
  261. .TP
  262. .BR \-sa " or " \-sA
  263. Specifies to look for the original source archive as a tarfile or as a
  264. directory - the second argument, if any, may be either, or the empty
  265. string (this is equivalent to using
  266. .BR \-sn ).
  267. If a tarfile is found it will unpack it to create the diff and remove
  268. it afterwards (this is equivalent to
  269. .BR \-sp );
  270. if a directory is found it will pack it to create the original source
  271. and remove it afterwards (this is equivalent to
  272. .BR \-sr );
  273. if neither is found it will assume that the package has no
  274. debianisation diffs, only a straightforward source archive (this is
  275. equivalent to
  276. .BR \-sn ).
  277. If both are found then \fBdpkg\-source\fP will ignore the directory,
  278. overwriting it, if
  279. .B \-sA
  280. was specified (this is equivalent to
  281. .BR \-sP )
  282. or raise an error if
  283. .B \-sa
  284. was specified.
  285. .B \-sA
  286. is the default.
  287. .TP
  288. .B Extract options (with \-x):
  289. .PP
  290. In all cases any existing original source tree will be removed.
  291. .TP
  292. .B \-sp
  293. Used when extracting then the original source (if any) will be left
  294. as a tarfile. If it is not already located in the current directory
  295. or if an existing but different file is there it will be copied there.
  296. (\fBThis is the default\fP).
  297. .TP
  298. .B \-su
  299. Unpacks the original source tree.
  300. .TP
  301. .B \-sn
  302. Ensures that the original source is neither copied to the current
  303. directory nor unpacked. Any original source tree that was in the
  304. current directory is still removed.
  305. .PP
  306. All the
  307. .BI \-s X
  308. options are mutually exclusive. If you specify more than one only the
  309. last one will be used.
  310. .TP
  311. .B \-\-skip\-debianization
  312. Skips application of the debian diff on top of the upstream sources.
  313. .
  314. .SS Format: 2.0
  315. Also known as wig&pen. This format is not recommended for wide-spread
  316. usage, the format "3.0 (quilt)" replaces it. Wig&pen was the first
  317. specification of a new-generation source package format.
  318. The behaviour of this format is the same as the "3.0 (quilt)" format
  319. except that it doesn't use an explicit list of patches. All files in
  320. \fBdebian/patches/\fP matching the perl regular expression \fB[\\w\-]+\fP
  321. must be valid patches: they are applied at extraction time.
  322. When building a new source package, any change to the upstream source
  323. is stored in a patch named \fBzz_debian-diff-auto\fP.
  324. .
  325. .SS Format: 3.0 (native)
  326. This format is an extension of the native package format as defined
  327. in the 1.0 format. It supports all compression methods and
  328. will ignore by default any VCS specific files and directories
  329. as well as many temporary files (see default value associated to
  330. \fB-I\fP option in the \fB\-\-help\fP output).
  331. .
  332. .SS Format: 3.0 (quilt)
  333. A source package in this format contains at least
  334. an original tarball (\fB.orig.tar.\fP\fIext\fP where \fIext\fP can be
  335. \fBgz\fP, \fBbz2\fP and \fBlzma\fP) and a debian tarball
  336. (\fB.debian.tar.\fP\fIext\fP). It can also contain additional original
  337. tarballs (\fB.orig-\fP\fIcomponent\fP\fB.tar.\fP\fIext\fP).
  338. \fIcomponent\fP can only contain alphanumeric characters and dashes ("-").
  339. .PP
  340. .B Extracting
  341. .PP
  342. The main original tarball is extracted first, then all additional original
  343. tarballs are extracted in subdirectories named after the \fIcomponent\fP
  344. part of their filename (any pre-existing directory is replaced). The
  345. debian tarball is extracted on top of the source directory after prior
  346. removal of any pre-existing \fBdebian\fP directory. Note that the
  347. debian tarball must contain a \fBdebian\fP sub-directory but it
  348. can also contain binary files outside of that directory (see
  349. \fB\-\-include\-binaries\fP option).
  350. .PP
  351. All patches listed in \fBdebian/patches/debian.series\fP or
  352. \fBdebian/patches/series\fP are then applied.
  353. If the former file is used and the latter one doesn't exist (or is a
  354. symlink), then the latter is replaced with a symlink to the former. This
  355. is meant to simplify usage of quilt to manage the set of patches. Note
  356. however that while \fBdpkg\-source\fP parses correctly series files with
  357. explicit options used for patch application (stored on each line
  358. after the patch filename and one or more spaces), it does ignore those
  359. options and always expect patches that can be applied with the \fB-p1\fP
  360. option of \fBpatch\fP. It will thus emit a warning when it encounters
  361. such options, and the build is likely to fail.
  362. .PP
  363. Similarly to quilt's default behaviour, the patches can remove files too.
  364. .PP
  365. The file \fBdebian/patches/.dpkg-source-applied\fP is created if some
  366. patches have been applied during the extraction.
  367. .PP
  368. .B Building
  369. .PP
  370. All original tarballs found in the current directory are extracted in a
  371. temporary directory by following the same logic as for the unpack, the
  372. debian directory is copied over in the temporary directory, and all
  373. patches except \fBdebian-changes-\fP\fIversion\fP are applied.
  374. The temporary directory is compared to the source package directory
  375. and the diff (if non-empty) is stored in
  376. \fBdebian/patches/debian-changes-\fP\fIversion\fP. Any change
  377. on a binary file is not representable in a diff and will thus lead to a
  378. failure unless the maintainer deliberately decided to include that
  379. modified binary file in the debian tarball (by listing it in
  380. \fBdebian/source/include-binaries\fP). The build will also fail if it
  381. finds binary files in the debian sub-directory unless they have been
  382. whitelisted through \fBdebian/source/include-binaries\fP.
  383. The updated debian directory and the list of modified binaries is then
  384. used to generate the debian tarball.
  385. The automatically generated diff doesn't include changes on VCS specific
  386. files as well as many temporary files (see default value associated to
  387. \fB-i\fP option in the \fB\-\-help\fP output). In particular, the
  388. \fB.pc\fP directory used by quilt is ignored during generation of the
  389. automatic patch.
  390. Note: \fBdpkg\-source\fP expects the source tree to have all patches
  391. listed in the series file applied when you generate the source package.
  392. This is not the case when the source tree has been obtained by unpacking a
  393. source package using the Format: 1.0 for instance. To mitigate the
  394. problem, \fBdpkg\-source\fP will apply the patches by itself if it
  395. believes that they have not yet been applied. To detect this situation, it
  396. uses the following heuristic: if a \fB.pc\fP subdirectory is detected, it
  397. will call \fBquilt unapplied\fP to find out if some patches are not
  398. applied. After that, it will take the first patch of the series (or the
  399. first unapplied patch returned by \fBquilt unapplied\fP, if any) and
  400. verify if it can be applied without errors. If the verification succeeds,
  401. it concludes that patches have not been applied and will apply them all.
  402. The option \fB\-\-no\-preparation\fP can be used to disable this
  403. behaviour.
  404. .PP
  405. .B Build options
  406. .TP
  407. .B \-\-include\-removal
  408. Do not ignore removed files and include them in the automatically
  409. generated patch.
  410. .TP
  411. .B \-\-include\-timestamp
  412. Include timestamp in the automatically generated patch.
  413. .TP
  414. .B \-\-include\-binaries
  415. Add all modified binaries in the debian tarball. Also add them to
  416. \fBdebian/source/include-binaries\fP: they will be added by default
  417. in subsequent builds and this option is thus no more needed.
  418. .TP
  419. .B \-\-no\-preparation
  420. Do not try to prepare the build tree by applying patches which are
  421. apparently unapplied.
  422. .PP
  423. .B Extract options
  424. .TP
  425. .B \-\-skip\-debianization
  426. Skips extraction of the debian tarball on top of the upstream sources.
  427. .TP
  428. .B \-\-skip\-patches
  429. Do not apply patches at the end of the extraction.
  430. .TP
  431. .B \-\-without\-quilt
  432. Don't use quilt to apply patches but dpkg-source's own code. It won't be
  433. possible to use quilt directly on the unpacked directory but it will be
  434. free of quilt's temporary files as well.
  435. .
  436. .SS Format: 3.0 (custom)
  437. This format is particular. It doesn't represent a real source package
  438. format but can be used to create source packages with arbitrary files.
  439. .PP
  440. .B Build options
  441. .PP
  442. All non-option arguments are taken as files to integrate in the
  443. generated source package. They must exist and are preferrably
  444. in the current directory. At least one file must be given.
  445. .TP
  446. .BI \-\-target\-format= value
  447. \fBRequired\fP. Defines the real format of the generated source package.
  448. The generated .dsc file will contain this value in its \fIFormat\fP field
  449. and not "3.0 (custom)".
  450. .
  451. .SS Format: 3.0 (git) and 3.0 (bzr)
  452. Those formats are experimental. They generate a single tarball
  453. containing the corresponding VCS repository.
  454. .PP
  455. .B Extracting
  456. .PP
  457. The tarball is unpacked and then the VCS is used to checkout the current
  458. branch.
  459. .PP
  460. .B Building
  461. .PP
  462. Before going any further, some checks are done to ensure that we
  463. don't have any non-ignored uncommitted changes.
  464. .PP
  465. Then the VCS specific part of the source directory is copied over to a
  466. temporary directory. Before this temporary directory is packed in a tarball,
  467. various cleanup are done to save space.
  468. .SH FILE FORMATS
  469. .SS debian/source/format
  470. This file contains on a single line the format that should be used to
  471. build the source package (possible formats are described above). No leading
  472. or trailing spaces are allowed.
  473. .SS debian/source/include-binaries
  474. This file contains a list of binary files (one per line) that should be
  475. included in the debian tarball. Leading and trailing spaces are stripped.
  476. Lines starting with "#" are comments and are skipped. Empty lines are ignored.
  477. .SS debian/patches/series
  478. This file lists all patches that have to be applied (in the given order)
  479. on top of the upstream source package. Leading and trailing spaces are
  480. stripped. Lines starting with "#" are comments and are skipped. Empty
  481. lines are ignored. Remaining lines start with a patch filename (relative
  482. to the \fBdebian/patches/\fP directory) up to the first space character or
  483. the end of line. Optional quilt options can follow up to the end of line
  484. or the first "#" preceded by one or more spaces (which marks the start of
  485. a comment up to the end of line).
  486. .SH BUGS
  487. The point at which field overriding occurs compared to certain
  488. standard output field settings is rather confused.
  489. .SH SEE ALSO
  490. .BR dpkg\-deb (1),
  491. .BR dpkg (1),
  492. .BR dselect (1).
  493. .
  494. .SH AUTHORS
  495. Copyright \(co 1995-1996 Ian Jackson
  496. .br
  497. Copyright \(co 2000 Wichert Akkerman
  498. .br
  499. Copyright \(co 2008-2009 Rapha\[:e]l Hertzog
  500. .sp
  501. This is free software; see the GNU General Public Licence version 2 or later
  502. for copying conditions. There is NO WARRANTY.