dpkg-source.1 18 KB

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