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