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