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