chiark / gitweb /
New --damp-run mode, for more convenient and fuller testing etc.
[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 dpkg-buildpackage
86 with some suitable options.  Options and argumments after build
87 will be passed on to dpkg-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 Tagging, signing and actually uploading should be left to dgit push.
93 .TP
94 \fBdgit build-source\fR ...
95 Builds the source package, and a changes file for a prospective
96 source-only upload, using
97 .BR dpkg-source .
98 The output is left in
99 .IR package \fB_\fR version \fB.dsc\fR
100 and
101 .IR package \fB_\fR version \fB_source.changes\fR.
102
103 Tagging, signing and actually uploading should be left to dgit push.
104 .TP
105 .B dgit help
106 Print a usage summary.
107 .TP
108 \fBdgit sbuild\fR ...
109 Constructs the source package, uses
110 .B  sbuild
111 to do a binary build, and uses mergechanges to merge the source and
112 binary changes files.  Options and argumments after sbuild will be
113 passed on to sbuild.  Changes files matching
114 .IB package _ version _*.changes
115 in the parent directory will be removed; the output is left in
116 .IR package \fB_\fR version \fB_multi.changes\fR.
117
118 Tagging, signing and actually uploading should be left to dgit push.
119 .TP
120 \fBdgit git-build\fR ...
121 Runs
122 .B git-buildpackage
123 with some suitable options.  Options and argumments after git-build
124 will be passed on to git-buildpackage.
125
126 Tagging, signing and actually uploading should be left to dgit push.
127 .TP
128 .B dgit push
129 Does an `upload', pushing the current HEAD to the archive (as a source
130 package) and to dgit-repos (as git commits).  The package must already
131 have been built ready for upload, with the .dsc and .changes
132 left in the parent directory.
133
134 In more detail: dgit push checks that the current HEAD corresponds to
135 the .dsc.  It then pushes the HEAD to the suite's dgit-repos branch,
136 makes a signed git tag, edits the .dsc to contain the dgit metadata
137 field, runs debsign to sign the upload (.dsc and .changes), pushes the
138 signed tag, and finally uses dput to upload the .changes to the
139 archive.
140
141 dgit push always uses the package, suite and version specified in the
142 debian/changelog and the .dsc, which must agree.
143
144 If dgit push fails while uploading, it is fine to simply retry the
145 dput on the .changes file at your leisure.
146 .TP
147 .B dgit quilt-fixup
148 Looks to see if the tree is one which dpkg-source cannot properly
149 represent.  If it isn't, dgit will fix it up for you (in quilt terms,
150 by making a new debian/ patch containing your unquilty changes) and
151 make a commit of the changes it has made.
152
153 This is normally done automatically by dgit build and dgit push.
154 .TP
155 .B dgit version
156 Prints version information and exits.
157 .SH OPTIONS
158 .TP
159 .BR --dry-run | -n
160 Go through the motions, fetching all information needed, but do not
161 actually update the output(s).  For push, dgit does
162 the required checks and leaves the new .dsc in a temporary file,
163 but does not sign, tag, push or upload.
164 .TP
165 .BR --damp-run | -L
166 Go through many more of the motions: do everything that doesn't
167 involve either signing things, or making changes on the public
168 servers.
169 .TP
170 .BI -k keyid
171 Use
172 .I keyid
173 for signing the tag and the upload.
174 .TP
175 .BR --no-sign
176 does not sign tags or uploads (meaningful only with push).
177 .TP
178 .TP
179 .BI -p package
180 Specifies that we should process source package
181 .I package
182 rather than looking in debian/control or debian/changelog.
183 Valid with dgit fetch and dgit pull, only.
184 .TP
185 .BR --clean=git | -wg
186 The source tree should be cleaned, before building a source package
187 with one of the build options, using
188 .BR "git clean -xdf" .
189 This will delete all files which are not tracked by git.
190 .TP
191 .BR --clean=none | -wn
192 Do not clean the tree before building a source package.  If there are
193 files which are not in git, a subsequent dgit push will fail.
194 .TP
195 .BR --clean=dpkg-source | -wd
196 Use dpkg-buildpackage to do the build, so that the source package
197 is cleaned by dpkg-source running the package's clean target.
198 This is the default.  It requires the package's build dependencies.
199 .TP
200 .BR -N | --new
201 The package may be new in this suite.  Without this, dgit will
202 refuse to push.
203 .TP
204 .BR --ignore-dirty
205 Do not complain if the working tree does not match your git HEAD.
206 This can be useful with build, if you plan to commit later.  (dgit
207 push will still ensure that the .dsc you upload and the git tree
208 you push are identical, so this option won't make broken pushes.)
209
210 This option may not work properly on `3.0 (quilt)' packages, as in
211 that case dgit needs to use and perhaps commit parts of your working
212 tree.
213 .TP
214 .BR --no-quilt-fixup
215 Do not fix up source format `3.0 (quilt)' metadata.  If you use this
216 option and the package did in fact need fixing up, dgit push will
217 fail.
218 .TP
219 .BI -D
220 Prints debugging information to stderr.  Repeating the option produces
221 more output (currently, up to -DD is meaningfully different).
222 .TP
223 .BI -c name = value
224 Specifies a git configuration option.  dgit itself is also controlled
225 by git configuration options.
226 .TP
227 .RI \fB-v\fR version |\fB-m\fR maintaineraddress
228 Passed to dpkg-genchanges (eventually).
229 .TP
230 .RI \fB--ch:\fR option
231 Specifies a single additional option to pass, eventually, to
232 dpkg-genchanges.
233 .TP
234 .RI \fB--dget=\fR program |\fB--dput=\fR program |...
235 Specifies alternative programs to use instead of
236 .BR dget ,
237 .BR dput ,
238 .BR debsign ,
239 .BR dpkg-source ,
240 .BR dpkg-buildpackage ,
241 .BR dpkg-genchanges ,
242 .BR sbuild ,
243 or
244 .BR mergechanges .
245 This applies only when the program is invoked directly by dgit.
246 .TP
247 .RI \fB--dget:\fR option |\fB--dput:\fR option |...
248 Specifies a single additional option to pass to
249 .BR dget ,
250 .BR dput ,
251 .BR debsign ,
252 .BR dpkg-source ,
253 .BR dpkg-buildpackage ,
254 .BR dpkg-genchanges ,
255 .BR sbuild ,
256 or
257 .BR mergechanges .
258 Can be repeated as necessary.
259 This applies only when the program is invoked directly by dgit.
260 Usually, for passing options to dpkg-genchanges, use
261 .BR --ch: \fIoption\fR.
262 .TP
263 .BR -d "\fIdistro\fR | " --distro= \fIdistro\fR
264 Specifies that the suite to be operated on is part of distro
265 .IR distro .
266 This overrides the default value found from the git config option
267 .BR dgit-suite. \fIsuite\fR .distro .
268 The only effect is that other configuration variables (used
269 for accessing the archive and dgit-repos) used are
270 .BR dgit-distro. \fIdistro\fR .* .
271
272 If your suite is part of a distro that dgit already knows about, you
273 can use this option to make dgit work even if your dgit doesn't know
274 about the suite.  For example, specifying
275 .B -ddebian
276 will work when the suite is an unknown suite in the Debian archive.
277
278 To define a new distro it is necessary to define methods and URLs
279 for fetching (and, for dgit push, altering) a variety of information both
280 in the archive and in dgit-repos.  How to do this is not yet
281 documented, and currently the arrangements are unpleasant.  See
282 BUGS.
283 .TP
284 .BI -C changesfile
285 Specifies the .changes file which is to be uploaded.  By default
286 dgit push looks for single .changes file in the parent directory whose
287 filename suggests it is for the right package and version - or,
288 if there is a _multi.changes file, dgit uses that.
289 .TP
290 .BI --existing-package= package
291 dgit push needs to canonicalise the suite name.  But currently
292 there is no way to ask the archive to do this without knowing the
293 name of an existing package.  Without --new we can just use the
294 package we are trying to push.  But with --new that will not work, so
295 we guess
296 .B dpkg
297 or use the value of this option.
298 .TP
299 .BR -h | --help
300 Print a usage summary.
301 .SH WORKFLOW - SIMPLE
302 It is always possible with dgit to clone or fetch a package, make
303 changes in git (using git-commit) on the suite branch
304 .RB ( "git checkout dgit/" \fIsuite\fR)
305 and then dgit push.  You can use whatever gitish techniques you like
306 to construct the commit to push; the only requirement is that it is a
307 descendant of the state of the archive, as provided by dgit in the
308 remote tracking branch
309 .BR remotes/dgit/dgit/ \fIsuite\fR.
310
311 If you are lucky the other uploaders have also used dgit and
312 integrated the other relevant git history; if not you can fetch it
313 into your tree and cherry-pick etc. as you wish.
314 .SH WORKFLOW - INTEGRATING BETWEEN DGIT AND OTHER GIT HISTORY
315 If you are the maintainer of a package dealing with uploads made
316 without dgit, you will probably want to merge the synthetic commits
317 (made by dgit to represent the uploads) into your git history.
318 Normally you can just merge the dgit branch into your own master, or
319 indeed if you do your work on the dgit local suite branch
320 .BI dgit/ suite
321 you can just use dgit pull.
322
323 However the first time dgit is used it will generate a new origin
324 commit from the archive which won't be linked into the rest of your
325 git history.  You will need to merge this.
326
327 If last upload was in fact made with git, you should usually proceed
328 as follows: identify the commit which was actually used to build the
329 package.  (Hopefully you have a tag for this.)  Check out the dgit
330 branch
331 .RB ( "git checkout dgit/" \fIsuite\fR)
332 and merge that other commit
333 .RB ( "git merge debian/" \fIversion\fR).
334 Hopefully this merge will be trivial because the two trees should
335 be the same.  The resulting branch head can be merged into your
336 working branches
337 .RB ( "git checkout master && git merge dgit/" \fIsuite\fR).
338
339 If last upload was not made with git, a different approach is required
340 to start using dgit.  First, do
341 .B dgit fetch
342 (or clone) to obtain a git history representation of what's in the
343 archive and record it in the
344 .BI remotes/dgit/dgit/ suite
345 tracking branch.  Then somehow, using your other git history
346 plus appropriate diffs and cherry picks from the dgit remote tracking
347 branch, construct a git commit whose tree corresponds to the tree to use for the
348 next upload.  If that commit-to-be-uploaded is not a descendant of the
349 dig remote tracking branch, check it out and say
350 .BR "git merge -s ours remotes/dgit/dgit/" \fIsuite\fR;
351 that tells git that we are deliberately throwing away any differences
352 between what's in the archive and what you intend to upload.
353 Then run
354 .BR "dgit push"
355 to actually upload the result.
356 .SH MODEL
357 You may use any suitable git workflow with dgit, provided you
358 satisfy dgit's requirements:
359
360 dgit maintains a pseudo-remote called
361 .BR dgit ,
362 with one branch per suite.  This remote cannot be used with
363 plain git.
364
365 The
366 .B dgit-repos
367 repository for each package contains one ref per suite named
368 \fBrefs/dgit/\fR\fIsuite\fR.  These should be pushed to only by
369 dgit.  They are fast forwarding.  Each push on this branch
370 corresponds to an upload (or attempted upload).
371
372 However, it is perfectly fine to have other branches in dgit-repos;
373 normally the dgit-repos repo for the package will be accessible via
374 the remote name `origin'.
375
376 dgit push will also (by default) make signed tags called
377 .BI debian/ version
378 and push them to dgit-repos, but nothing depends on these tags
379 existing.
380
381 dgit push can operate on any commit which is a descendant of the
382 current dgit/suite tip in dgit-repos.
383
384 Uploads made by dgit contain an additional field
385 .B Dgit
386 in the source package .dsc.  (This is added by dgit push.)
387 This specifies a commit (an ancestor of the dgit/suite
388 branch) whose tree is identical to the unpacked source upload.
389
390 Uploads not made by dgit are represented in git by commits which are
391 synthesised by dgit.  The tree of each such commit corresponds to the
392 unpacked source; there is an origin commit with the contents, and a
393 psuedo-merge from last known upload - that is, from the contents of
394 the dgit/suite branch.
395
396 dgit expects repos that it works with to have a
397 .B dgit
398 remote.  This refers to the well-known dgit-repos location
399 (currently, the dgit-repos project on Alioth).  dgit fetch updates
400 the remote tracking branch for dgit/suite.
401
402 dgit does not (currently) represent the orig tarball(s) in git; nor
403 does it represent the patch statck of a `3.0 (quilt)' package.  The
404 orig tarballs are downloaded and kept in the parent directory, as with
405 a traditional (non-gitish) dpkg-source workflow.
406
407 To a user looking at the archive, changes pushed using dgit look like
408 changes made in an NMU: in a `3.0 (quilt)' package the delta from the
409 previous upload is recorded in a new patch constructed by dpkg-source.
410 .SH PACKAGE SOURCE FORMATS
411 If you are not the maintainer, you do not need to worry about the
412 source format of the package.  You can just make changes as you like
413 in git.  If the package is a `3.0 (quilt)' package, the patch stack
414 will usually not be represented in the git history.
415
416 If you are the maintainer of a non-native package, you currently have
417 two sensible options:
418
419 Firstly, you can regard your git history as primary, and the archive
420 as an export format.  For example, you could maintain topic branches
421 in git and a fast-forwarding release branch; or you could do your work
422 directly in a merging way on the
423 .BI dgit/ suite
424 branches.  If you do this you should probably use a `1.0' format
425 source package if you can.  In the archive, the delta between upstream
426 will be represented in the single Debian patch.
427
428 Secondly, you can use `3.0 (quilt)', and regard your quiltish patch
429 stack in the archive as primary.  You will have to use other tools
430 besides dgit to import and export this patch stack.  But see below:
431 .SH FORMAT 3.0 (QUILT)
432 For a format `3.0 (quilt)' source package, dgit may have to make a
433 commit on your current branch to contain metadata used by quilt and
434 dpkg-source.
435
436 This is because (i) the `3.0 (quilt)' source format cannot represent
437 certain trees, and (ii) packing up a tree in `3.0 (quilt)' and then
438 unpacking it does not always yield the same tree.  Instead,
439 dpkg-source insists on the trees having extra quilty metadata and
440 patch files in the debian/ and .pc/ directories, which dpkg-source
441 sometimes modifies.
442
443 dgit will automatically work around this braindamage for you when
444 building and pushing.  The only thing you need to know is that dgit
445 build, sbuild, etc., may make a new commit on your HEAD.  If you're
446 not a quilt user this commit won't contain any changes to files you
447 care about.
448
449 You can explicitly request that dgit do just this fixup, by running
450 dgit quilt-fixup.
451
452 We recommend against the use of `3.0 (quilt)'.
453 .SH FILES IN THE SOURCE PACKAGE BUT NOT IN GIT
454 This section is mainly of interest to maintainers who want to use dgit
455 with their existing git history for the Debian package.
456
457 Some developers like to have an extra-clean git tree which lacks files
458 which are normally found in source tarballs and therefore in Debian
459 source packages.  For example, it is conventional to ship ./configure
460 in the source tarball, but some people prefer not to have it present
461 in the git view of their project.
462
463 dgit requires that the source package unpacks to exactly the same
464 files as are in the git commit on which dgit push operates.  So if you
465 just try to dgit push directly from one of these extra-clean git
466 branches, it will fail.
467
468 As the maintainer you therefore have the following options:
469 .TP
470 \(bu
471 Persuade upstream that the source code in their git history and the
472 source they ship as tarballs should be identical.  Of course simply
473 removing the files from the tarball may make the tarball hard for
474 people to use.
475 .IP
476 One answer is to commit the (maybe autogenerated)
477 files, perhaps with some simple automation to deal with conflicts and
478 spurious changes.  This has the advantage that someone who clones
479 the git repository finds the program just as easy to build as someone
480 who uses the tarball.
481 .TP
482 \(bu
483 Have separate git branches which do contain the extra files, and after
484 regenerating the extra files (whenever you would have to anyway),
485 commit the result onto those branches.
486 .TP
487 \(bu
488 Provide source packages which lack the files you don't want
489 in git, and arrange for your package build to create them as needed.
490 This may mean not using upstream source tarballs and makes the Debian
491 source package less useful for people without Debian build
492 infrastructure.
493 .LP
494 Of course it may also be that the differences are due to build system
495 bugs, which cause unintended files to end up in the source package.
496 dgit will notice this and complain.  You may have to fix these bugs
497 before you can unify your existing git history with dgit's.
498 .SH CONFIGURATION
499 dgit looks at the following git config keys to control its behaviour.
500 You may set them with git-config (either in system-global or per-tree
501 configuration), or provide
502 .BI -c key = value
503 on the dgit command line.
504 .TP
505 .BI dgit-suite. suite .distro
506 .TP
507 .BI dgit.default.distro
508 .TP
509 .BI dgit-distro. distro .username
510 .TP
511 .BI dgit-distro. distro .git-url
512 .TP
513 .BI dgit-distro. distro .git-user
514 .TP
515 .BI dgit-distro. distro .git-host
516 .TP
517 .BI dgit-distro. distro .git-proto
518 .TP
519 .BI dgit-distro. distro .git-path
520 .TP
521 .BI dgit-distro. distro .git-check
522 .TP
523 .BI dgit-distro. distro .git-create
524 .TP
525 .BI dgit-distro. distro .upload-host
526 .TP
527 .BI dgit-distro. distro .mirror
528 .TP
529 .BI dgit-distro. distro .archive-query
530 .TP
531 .BI dgit-distro. distro .archive-query-default-component
532 .TP
533 .BI dgit-distro. distro .sshdakls-user
534 .TP
535 .BI dgit-distro. distro .sshdakls-host
536 .TP
537 .BI dgit-distro. distro .sshdakls-dir
538 .TP
539 .BI dgit-distro. distro .ssh
540 .TP
541 .BI dgit-distro. distro .keyid
542 .TP
543 .BR dgit.default. *
544 for each
545 .BR dgit-distro. \fIdistro\fR . *
546 .SH BUGS
547 We should be using some kind of vhost/vpath setup for the git repos on
548 alioth, so that they can be moved later if and when this turns out to
549 be a good idea.
550
551 Debian Policy needs to be updated to describe the new Dgit .dsc
552 field (and to specify that it is an RC bug for that field to refer
553 to an unavailable commit).
554
555 The method of canonicalising suite names is bizarre.  See the
556 .B --existing-package
557 option for one of the implications.
558
559 dgit push should perhaps do `git push origin', or something similar,
560 by default.
561
562 Debian does not have a working rmadison server, so to find out what
563 version of a package is in the archive, or to canonicalise suite
564 names, we ssh directly into the ftpmaster server.
565
566 The mechanism for checking for and creating per-package repos on
567 alioth is a hideous bodge.  One consequence is that dgit currently
568 only works for people with push access.
569
570 Debian Maintainers are currently not able to push, as there is not
571 currently any mechanism for determining and honouring the archive's
572 ideas about access control.  Currently only DDs can push.
573
574 dgit's representation of format `3.0 (quilt)' source packages does not
575 represent the patch stack.  Currently the patch series representation
576 cannot round trip through the archive.  Ideally dgit would represent a
577 quilty package with an origin commit of some kind followed by the
578 patch stack as a series of commits followed by a pseudo-merge (to make
579 the branch fast-forwarding).  This would also mean a new `dgit
580 rebase-prep' command or some such to turn such a fast-forwarding
581 branch back into a rebasing patch stack, and a `force' option to dgit
582 push (perhaps enabled automatically by a note left by rebase-prep)
583 which will make the required pseudo-merge.
584
585 If the dgit push fails halfway through, it should be restartable and
586 idempotent.  However this is not true for the git tag operation.
587 Also, it would be good to check that the proposed signing key is
588 available before starting work.
589
590 dgit's handling of .orig.tar.gz is not very sophisticated.  Ideally
591 the .orig.tar.gz could be transported via the git repo as git tags.
592 Doing this is made more complicated by the possibility of a `3.0
593 (quilt)' package with multiple .orig tarballs.
594
595 dgit's build functions, and dgit push, should not make any changes to
596 your current HEAD.  Sadly this is necessary for packages in the `3.0
597 (quilt)' source format.  This is ultimately due to design problems in
598 quilt and dpkg-source.
599
600 There should be an option which arranges for the `3.0 (quilt)'
601 autocommit to not appear on your HEAD, but instead only in the
602 remote tracking suite branch.
603
604 There should at the very least be some advice in the manpage about how
605 to use dgit when the signing key is not available on the same machine
606 as the build host.
607
608 The option parser requires values to be cuddled to the option name.
609
610 dgit assumes knowledge of the archive layout.  There appears to be no
611 sane way to find the path in the archive pool of the .dsc for a
612 particular suite.  I'm assured that the archive layout is a
613 `well known algorithm' by now.
614
615 --dry-run does not always work properly, as not doing some of the git
616 fetches may result in subsequent actions being different.  Doing a
617 non-dry-run dgit fetch first will help.
618 .SH SEE ALSO
619 \fBdget\fP(1),
620 \fBdput\fP(1),
621 \fBdebsign\fP(1),
622 \fBgit-config\fP(1),
623 \fBgit-buildpackage\fP(1),
624 \fBdpkg-buildpackage\fP(1),
625 .br
626 https://wiki.debian.org/Alioth