chiark / gitweb /
Provide "dgit sbuild".
[dgit.git] / dgit.1
1 .TH dgit 1 "" "Debian Project" "dgit"
2 .SH NAME
3 dgit \- git integration with the Debian archive
4 .
5 .SH SYNOPSIS
6 .B dgit
7 [\fIdgit\-opts\fP] \fBclone\fP [\fIdgit\-opts\fP]
8 \fIpackage\fP [\fIsuite\fP] [\fB./\fP\fIdir|\fB/\fP\fIdir]
9 .br
10 .B dgit
11 [\fIdgit\-opts\fP] \fBfetch\fP|\fBpull\fP [\fIdgit\-opts\fP]
12 [\fIsuite\fP]
13 .br
14 .B dgit
15 [\fIdgit\-opts\fP] \fBbuild\fP|\fBsbuild\fP
16 [\fIbuild\-opts\fp]
17 .br
18 .B dgit
19 [\fIdgit\-opts\fP] \fBpush\fP [\fIdgit\-opts\fP]
20 [\fIsuite\fP]
21 .br
22 .B dgit
23 [\fIdgit\-opts\fP] \fIaction\fR ...
24 .SH DESCRIPTION
25 .B dgit
26 treats the Debian archive as a version control system, and
27 bidirectionally gateways between the archive and git.  The git view of
28 the package can contain the usual upstream git history, and will be
29 augmented by commits representing uploads done by other developers not
30 using dgit.  This git history is stored in a canonical location known
31 as
32 .B dgit-repos
33 which lives outside the Debian archive (currently, on Alioth).
34
35 .TP
36 \fBdgit clone\fR \fIpackage\fP [\fIsuite\fP] [\fB./\fP\fIdir|\fB/\fP\fIdir]
37 Consults the archive and dgit-repos to construct the git view of
38 history for
39 .I package
40 in
41 .I suite
42 .RB ( sid
43 by default)
44 in a new directory (named
45 .BI ./ package
46 by default);
47 also, downloads any necessary orig tarballs.
48
49 The suite's git tip is
50 left on the local branch
51 .BI dgit/ suite
52 ready for work, and on the corresponding dgit remote tracking branch.
53 Also, the
54 .B origin
55 remote will be set up to point to the package's dgit-repos tree
56 for the distro to which
57 .I suite
58 belongs.
59 .TP
60 \fBdgit fetch\fR [\fIsuite\fP]
61 Consults the archive and git-repos to update the git view of
62 history for a specific suite (and downloads any necessary orig
63 tarballs), and updates the remote tracking branch
64 .BR remotes/dgit/ \fIsuite\fR.
65 If the current branch is
66 .BI dgit/ suite
67 then dgit fetch defaults to
68 .IR suite ;
69 otherwise it parses debian/changelog and uses the suite specified
70 there.
71 .TP
72 \fBdgit pull\fR [\fIsuite\fP]
73 Does dgit fetch, and then merges the new head of the remote tracking
74 branch
75 .BI remotes/dgit/ suite
76 into the current branch.
77 .TP
78 \fBdgit build\fR ...
79 Runs
80 .B git-buildpackage
81 with some suitable options.  Options and argumments after build
82 will be passed on to git-buildpackage.  It is not necessary to use
83 dgit build when using dgit; it is OK to use any approach which ensures
84 that the generated source package corresponds to the relevant git
85 commit.  Tagging and signing should be left to dgit push.
86 .TP
87 \fBdgit sbuild\fR ...
88 Constructs the source package, and uses sbuild to do a binary
89 build, and uses mergechanges to merge the source and binary
90 changes files.  Options and argumments after sbuild will be passed on
91 to sbuild.  Changes files matching
92 .IB package _ version _*.changes
93 in the parent directory will be removed; the output is left in
94 .IR package \fB_\fR version \fB_multi.changes\fR.
95 .TP
96 .B dgit push
97 Does an `upload', pushing the current HEAD to the archive (as a source
98 package) and to dgit-repos (as git commits).  The package must already
99 have been built ready for upload, with the .dsc and .changes
100 left in the parent directory.
101
102 In more detail: dgit push checks that the current HEAD corresponds to
103 the .dsc.  It then pushes the HEAD to the suite's dgit-repos branch,
104 makes a signed git tag, edits the .dsc to contain the dgit metadata
105 field, runs debsign to sign the upload (.dsc and .changes), pushes the
106 signed tag, and finally uses dput to upload the .changes to the
107 archive.
108
109 For a format `3.0 (quilt)' source package, dgit push
110 may also have to make a commit on your current branch to contain
111 quilt metadata.  It will do this automatically if necessary.
112 You can explicitly request that dgit do just this
113 dgit quilt-fixup.
114
115 dgit push always uses the package, suite and version specified in the
116 debian/changelog and the .dsc, which must agree.
117 .TP
118 .B dgit quilt-fixup
119 Looks to see if there is quilt patch metadata left over by dpkg-source
120 -b, and if so makes a git commit of it.  This is normally done
121 automatically by dgit push.  dgit quilt-fixup takes no additional
122 arguments.  Note that it will only process a patch generated by
123 dpkg-source for the most recent version (according to the
124 debia/changelog).
125
126 It is not normally necessary to run dgit quilt-fixup explicitly;
127 where necessary it is done as part of dgit push.
128 .SH WORKFLOW - SIMPLE
129 It is always possible with dgit to clone or fetch a package, make
130 changes in git (using git-commit) on the suite branch
131 .RB ( "git checkout dgit/" \fIsuite\fR)
132 and then dgit push.  You can use whatever gitish techniques you like
133 to construct the commit to push; the only requirement is that it is a
134 descendant of the state of the archive, as provided by dgit in the
135 remote tracking branch
136 .BR remotes/dgit/ \fIsuite\fR.
137
138 If you are lucky the other uploaders have also used dgit and
139 integrated the other relevant git history; if not you can fetch it
140 into your tree and cherry-pick etc. as you wish.
141 .SH WORKFLOW - INTEGRATING BETWEEN DGIT AND OTHER GIT HISTORY
142 If you are the maintainer of a package dealing with uploads made
143 without dgit, you will probably want to merge the synthetic commits
144 (made by dgit to represent the uploads) into your git history.
145 Normally you can just merge the dgit branch into your own master, or
146 indeed if you do your work on the dgit local suite branch
147 .BI dgit/ suite
148 you can just use dgit pull.
149
150 However the first time dgit is used it will generate a new origin
151 commit from the archive which won't be linked into the rest of your
152 git history.  You will need to merge this.
153
154 If last upload was in fact made with git, you should usually proceed
155 as follows: identify the commit which was actually used to build the
156 package.  (Hopefully you have a tag for this.)  Check out the dgit
157 branch
158 .RB ( "git checkout dgit/" \fIsuite\fR)
159 and merge that other commit
160 .RB ( "git merge debian/" \fIversion\fR).
161 Hopefully this merge will be trivial because the two trees should
162 be the same.  The resulting branch head can be merged into your
163 working branches
164 .RB ( "git checkout master && git merge dgit/" \fIsuite\fR).
165
166 If last upload was not made with git, a different approach is required
167 to start using dgit.  First, do
168 .B dgit fetch
169 (or clone) to obtain a git history representation of what's in the
170 archive and record it in the
171 .BI remotes/dgit/ suite
172 tracking branch.  Then somehow, using your other git history
173 plus appropriate diffs and cherry picks from the dgit remote tracking
174 branch, construct a git commit whose tree corresponds to the tree to use for the
175 next upload.  If that commit-to-be-uploaded is not a descendant of the
176 dig remote tracking branch, check it out and say
177 .BR "git merge -s ours remotes/dgit/" \fIsuite\fR;
178 that tells git that we are deliberately throwing away any differences
179 between what's in the archive and what you intend to upload.
180 Then run
181 .BR "dgit push"
182 to actually upload the result.
183 .SH MODEL
184 You may use any suitable git workflow with dgit, provided you
185 satisfy dgit's requirements:
186
187 dgit maintains a pseudo-remote called
188 .BR dgit ,
189 with one branch per suite.  This remote cannot be used with
190 plain git.
191
192 The
193 .B dgit-repos
194 repository for each package contains one ref per suite named
195 \fBrefs/dgit/\fR\fIsuite\fR.  These should be pushed to only by
196 dgit.  They are fast forwarding.  Each push on this branch
197 corresponds to an upload (or attempted upload).
198
199 However, it is perfectly fine to have other branches in dgit-repos;
200 normally the dgit-repos repo for the package will be accessible via
201 the remote name `origin'.
202
203 dgit push will also (by default) make signed tags called
204 .BI debian/ version
205 and push them to dgit-repos, but nothing depends on these tags
206 existing.
207
208 dgit push can operate on any commit which is a descendant of the
209 current dgit/suite tip in dgit-repos.
210
211 Uploads made by dgit contain an additional field
212 .B Vcs-Dgit-Master
213 in the source package .dsc.  (This is added by dgit push.)
214 This specifies a commit (an ancestor of the dgit/suite
215 branch) whose tree is identical to the unpacked source upload.
216
217 Uploads not made by dgit are represented in git by commits which are
218 synthesised by dgit.  The tree of each such commit corresponds to the
219 unpacked source; there is an origin commit with the contents, and a
220 psuedo-merge from last known upload - that is, from the contents of
221 the dgit/suite branch.
222
223 dgit expects repos that it works with to have a
224 .B dgit
225 remote.  This refers to the well-known dgit-repos location
226 (currently, the dgit-repos project on Alioth).  dgit fetch updates
227 the remote tracking branch for dgit/suite.
228
229 dgit does not (currently) represent the orig tarball(s) in git; nor
230 does it represent the patch statck of a `3.0 (quilt)' package.  The
231 orig tarballs are downloaded and kept in the parent directory, as with
232 a traditional (non-gitish) dpkg-source workflow.
233
234 To a user looking at the archive, changes pushed using dgit look like
235 changes made in an NMU: in a `3.0 (quilt)' package the delta from the
236 previous upload is recorded in a new patch constructed by dpkg-source.
237 .SH PACKAGE SOURCE FORMATS
238 If you are not the maintainer, you do not need to worry about the
239 source format of the package.  You can just make changes as you like
240 in git.  If the package is a `3.0 (quilt)' package, the patch stack
241 will usually not be represented in the git history.
242
243 If you are the maintainer of a non-native package, you currently have
244 two sensible options:
245
246 Firstly, you can regard your git history as primary, and the archive
247 as an export format.  For example, you could maintain topic branches
248 in git and a fast-forwarding release branch; or you could do your work
249 directly in a merging way on the
250 .BI dgit/ suite
251 branches.  If you do this you should probably use a `1.0' format
252 source package.  In the archive, the delta between upstream will be
253 represented in the single Debian patch.
254
255 Secondly, you can regard your quiltish patch stack in the archive as
256 primary.  You will have to use other tools besides dgit to import and
257 export this patch stack.  For `3.0 (quilt)' packages, dgit has to do
258 more work to work around some braindamage in way dpkg-source handles
259 changes made to this format.  See also the BUGS section.  We recommend
260 against the use of `3.0 (quilt)'.
261 .SH OPTIONS
262 .TP
263 .BR --dry-run | -n
264 Go through the motions, fetching all information needed, but do not
265 actually update the output(s).  For push, dgit does
266 the required checks and leaves the new .dsc in a temporary file,
267 but does not sign, tag, push or upload.
268 .TP
269 .BI -k keyid
270 Use
271 .I keyid
272 for signing the tag and the upload.
273 .TP
274 .BR --no-sign
275 does not sign tags or uploads (meaningful only with push).
276 .TP
277 .TP
278 .BI -p package
279 Specifies that we should process source package
280 .I package
281 rather than looking in debian/control or debian/changelog.
282 Valid with dgit fetch and dgit pull, only.
283 .TP
284 .BR -N | --new
285 The package may be new in this suite.  Without this, dgit will
286 refuse to push.
287 .TP
288 .BI -D
289 Prints debugging information to stderr.  Repeating the option produces
290 more output (currently, up to -DD is meaningfully different).
291 .TP
292 .BI -c name = value
293 Specifies a git configuration option.  dgit itself is also controlled
294 by git configuration options.
295 .TP
296 .RI \fB--dget=\fR program |\fB--dput=\fR program |...
297 Specifies alternative programs to use instead of
298 .BR dget ,
299 .BR dput ,
300 .BR debsign ,
301 .BR dpkg-buildpackage
302 .BR sbuild ,
303 or
304 .BR mergechanges .
305 .TP
306 .RI \fB--dget:\fR option |\fB--dput:\fR option |...
307 Specifies a single additional option to pass to
308 .BR dget ,
309 .BR dput ,
310 .BR debsign ,
311 .BR dpkg-buildpackage
312 .BR sbuild ,
313 or
314 .BR mergechanges .
315 Can be repeated as necessary.
316 .TP
317 .BI -C changesfile
318 Specifies the .changes file which is to be uploaded.  By default
319 dgit push looks for single .changes file in the parent directory whose
320 filename suggests it is for the right package and version.
321 .TP
322 .BI --existing-package= package
323 dgit push needs to canonicalise the suite name.  But currently
324 there is no way to ask the archive to do this without knowing the
325 name of an existing package.  Without --new we can just use the
326 package we are trying to push.  But with --new that will not work, so
327 we guess
328 .B dpkg
329 or use the value of this option.
330 .TP
331 .BR -h | --help
332 Print a usage summary.
333 .SH SEE ALSO
334 \fBdget\fP(1),
335 \fBdput\fP(1),
336 \fBdebsign\fP(1),
337 \fBgit-config\fP(1),
338 \fBgit-buildpackage\fP(1),
339 \fBdpkg-buildpackage\fP(1),
340 .br
341 https://wiki.debian.org/Alioth
342 .SH CONFIGURATION
343 dgit looks at the following git config keys to control its behaviour.
344 You may set them with git-config (either in system-global or per-tree
345 configuration), or provide
346 .BI -c key = value
347 on the dgit command line.
348 .TP
349 .BI dgit-suite. suite .distro
350 .TP
351 .BI dgit.default.distro
352 .TP
353 .BI dgit-distro. distro .username
354 .TP
355 .BI dgit-distro. distro .git-url
356 .TP
357 .BI dgit-distro. distro .git-user
358 .TP
359 .BI dgit-distro. distro .git-host
360 .TP
361 .BI dgit-distro. distro .git-proto
362 .TP
363 .BI dgit-distro. distro .git-path
364 .TP
365 .BI dgit-distro. distro .git-check
366 .TP
367 .BI dgit-distro. distro .git-create
368 .TP
369 .BI dgit-distro. distro .upload-host
370 .TP
371 .BI dgit-distro. distro .mirror
372 .TP
373 .BI dgit-distro. distro .archive-query
374 .TP
375 .BI dgit-distro. distro .archive-query-default-component
376 .TP
377 .BI dgit-distro. distro .sshdakls-user
378 .TP
379 .BI dgit-distro. distro .sshdakls-host
380 .TP
381 .BI dgit-distro. distro .sshdakls-dir
382 .TP
383 .BI dgit-distro. distro .ssh
384 .TP
385 .BR dgit.default. *
386 for each
387 .BR dgit-distro. \fIdistro\fR . *
388 .SH BUGS
389 We should be using some kind of vhost/vpath setup for the git repos on
390 alioth, so that they can be moved later if and when this turns out to
391 be a good idea.
392
393 Debian Policy needs to be updated to describe the new Vcs-Dgit-Master
394 field (and to specify that it is an RC bug for that field to refer
395 to an unavailable commit).
396
397 The method of canonicalising suite names is bizarre.  See the
398 .B --existing-package
399 option for one of the implications.
400
401 dgit push should perhaps do `git push origin', or something similar,
402 by default.
403
404 Debian does not have a working rmadison server, so to find out what
405 version of a package is in the archive, or to canonicalise suite
406 names, we ssh directly into the ftpmaster server.
407
408 The mechanism for checking for and creating per-package repos on
409 alioth is a hideous bodge.  One consequence is that dgit currently
410 only works for people with push access.
411
412 Debian Maintainers are currently not able to push, as there is not
413 currently any mechanism for determining and honouring the archive's
414 ideas about access control.  Currently only DDs can push.
415
416 dgit's representation of format `3.0 (quilt)' source packages does not
417 represent the patch stack.  Currently the patch series representation
418 cannot round trip through the archive.  Ideally dgit would represent a
419 quilty package with an origin commit of some kind followed by the
420 patch stack as a series of commits followed by a pseudo-merge (to make
421 the branch fast-forwarding).  This would also mean a new `dgit
422 rebase-prep' command or some such to turn such a fast-forwarding
423 branch back into a rebasing patch stack, and a `force' option to dgit
424 push (perhaps enabled automatically by a note left by rebase-prep)
425 which will make the required pseudo-merge.
426
427 If the dgit push fails halfway through, it should be restartable and
428 idempotent.  However this is not true for the git tag operation.
429 Also, it would be good to check that the proposed signing key is
430 available before starting work.
431
432 dgit's handling of .orig.tar.gz is not very sophisticated.  Ideally
433 the .orig.tar.gz could be transported via the git repo as git tags.
434 Doing this is made more complicated by the possibility of a `3.0
435 (quilt)' package with multiple .orig tarballs.
436
437 `3.0 (quilt)' packages have an additional difficulty: if these are
438 edited in the most normal way, and then fed to dpkg-buildpackage,
439 dpkg-source will add extra quilt patch metadata to the source tree
440 during the source package build.  This extra metadata is then of
441 course not included in the git history.  So dgit push needs to commit
442 it for you, to make sure that the git history and archive contents are
443 identical.  That this is necessary is a bug in the `3.0 (quilt)'
444 format.
445
446 There should be an option which arranges for the `3.0 (quilt)'
447 autocommit to not appear on your HEAD, but instead only in the
448 remote tracking suite branch.
449
450 There should at the very least be some advice in the manpage about how
451 to use dgit when the signing key is not available on the same machine
452 as the build host.
453
454 The option parser requires values to be cuddled to the option name.
455
456 dgit assumes knowledge of the archive layout.  There appears to be no
457 sane way to find the path in the archive pool of the .dsc for a
458 particular suite.  I'm assured that the archive layout is a
459 `well known algorithm' by now.
460
461 --dry-run often does not work with fetch, even though this is a
462 logically plausible request.  (It fails, instead.)