chiark / gitweb /
i18n: po4a: Add a symlink to po/README
[dgit.git] / dgit.7
1 .TH dgit 7 "" "Debian Project" "dgit"
2 .SH NAME
3 dgit \- principles of operation
4 .SH SUMMARY
5 .B dgit
6 treats the Debian archive as a version control system, and
7 bidirectionally gateways between the archive and git.  The git view of
8 the package can contain the usual upstream git history, and will be
9 augmented by commits representing uploads done by other developers not
10 using dgit.  This git history is stored in a canonical location known
11 as
12 .B dgit-repos
13 which lives on a dedicated git server.
14
15 git branches suitable for use with dgit
16 can be edited directly in git,
17 and used directly for building binary packages.
18 They can be shared using all conventional means for sharing git
19 branches.
20 It is not necessary to use dgit to work with dgitish git branches.
21 However, dgit is (usually) needed in order to convert to or from
22 Debian-format source packages.
23 .SH SEE ALSO
24 .TP
25 \fBdgit\fP(1)
26 Reference manual and documentation catalogue.
27 .TP
28 \fBdgit-*\fB(7)
29 Tutorials and workflow guides.  See dgit(1) for a list.
30 .SH MODEL
31 You may use any suitable git workflow with dgit, provided you
32 satisfy dgit's requirements:
33
34 dgit maintains a pseudo-remote called
35 .BR dgit ,
36 with one branch per suite.  This remote cannot be used with
37 plain git.
38
39 The
40 .B dgit-repos
41 repository for each package contains one ref per suite named
42 \fBrefs/dgit/\fR\fIsuite\fR.  These should be pushed to only by
43 dgit.  They are fast forwarding.  Each push on this branch
44 corresponds to an upload (or attempted upload).
45
46 However, it is perfectly fine to have other branches in dgit-repos;
47 normally the dgit-repos repo for the package will be accessible via
48 the remote name `origin'.
49
50 dgit push will also make signed tags called
51 .BI archive/debian/ version
52 (with version encoded a la DEP-14)
53 and push them to dgit-repos.  These are used at the
54 server to authenticate pushes.
55
56 Uploads made by dgit contain an additional field
57 .B Dgit
58 in the source package .dsc.  (This is added by dgit push.)
59 This specifies: a commit (an ancestor of the dgit/suite
60 branch) whose tree is identical to the unpacked source upload;
61 the distro to which the upload was made;
62 a tag name which can be used to fetch the git commits;
63 and
64 a url to use as a hint for the dgit git server for that distro.
65
66 Uploads not made by dgit are represented in git by commits which are
67 synthesised by dgit.  The tree of each such commit corresponds to the
68 unpacked source; there is a
69 commit with the contents,
70 and a
71 pseudo-merge from last known upload - that is, from the contents of
72 the dgit/suite branch.
73 Depending on the source package format,
74 the contents commit may have a more complex structure,
75 but ultimately it will be a convergence of stubby branches
76 from origin commits representing the components of the source package.
77
78 dgit expects trees that it works with to have a
79 .B dgit
80 (pseudo) remote.  This refers to the dgit-created git view of
81 the corresponding archive.
82
83 The dgit archive tracking view is synthesised locally,
84 on demand,
85 by each copy of dgit.
86 The tracking view is always a descendant of the
87 dgit-repos suite branch (if one exists),
88 but may be ahead of it if uploads have been done without dgit.
89 The archive tracking view is always fast forwarding within
90 each suite.
91
92 dgit push can operate on any commit which is a descendant of
93 the suite tracking branch.
94
95 dgit does not make a systematic record of
96 its imports of orig tarball(s).
97 So it does not work by finding git tags or branches
98 referring to orig tarball(s).
99 The
100 orig tarballs are downloaded (by dgit clone) into the parent
101 directory, as with a traditional (non-gitish) dpkg-source workflow.
102 You need to retain these tarballs in the parent directory for dgit
103 build and dgit push.
104 (They are not needed for purely-git-based workflows.)
105
106 dgit repositories could be cloned with standard (git) methods.
107 However,
108 the dgit repositories do not contain uploads not made with dgit.
109 And
110 for sourceful builds / uploads the orig
111 tarball(s) will need to be present in the parent directory.
112
113 To a user looking at the archive, changes pushed
114 in a simple NMU
115 using dgit look like
116 reasonable
117 changes made in an NMU: in a `3.0 (quilt)' package the delta from the
118 previous upload is recorded in new patch(es) constructed by dpkg-source.
119 .SH COMBINED SUITES
120 dgit can synthesize a combined view of several underlying suites.
121 This is requested by specifying, for
122 .I suite,
123 a comma-separated list:
124 .IP
125 .IR mainsuite \fB,\fR subsuite ...
126 .LP
127 This facility is available with dgit clone, fetch and pull, only.
128
129 dgit will fetch the same package from each specified underlying suite,
130 separately (as if with dgit fetch).
131 dgit will then generate a pseudomerge commit
132 on the tracking branch
133 .BI remotes/dgit/dgit/ suite
134 which has the tip of each of the underlying suites
135 as an ancestor,
136 and which contains the same as the suite which
137 has the highest version of the package.
138
139 The package must exist in mainsuite,
140 but need not exist in the subsuites.
141
142 If a specified subsuite starts with
143 .B -
144 then mainsuite is prepended.
145
146 So, for example,
147 .B stable,-security
148 means to look for the package in stable, and stable-security,
149 taking whichever is newer.
150 If stable is currently jessie,
151 dgit clone would leave you on the branch
152 .BR dgit/jessie,-security .
153
154 Combined suites are not supported by the dgit build operations.
155 This is because those options are intended for building for
156 uploading source packages,
157 and look in the changelog to find the relevant suite.
158 It does not make sense to name a dgit-synthesised combined suite
159 in a changelog,
160 or to try to upload to it.
161
162 When using this facility, it is important to always specify the
163 same suites in the same order:
164 dgit will not be make a coherent fast-forwarding history
165 view otherwise.
166
167 The history generated by this feature is not normally suitable
168 for merging back into upstreams,
169 as it necessarily contains unattractive pseudomerges.
170 .SH LIMITATIONS
171 Because the synthesis
172 of the suite tracking branches
173 is done locally based only on the current archive state,
174 it will not necessarily see every upload
175 not done with dgit.
176 Also, different versions of dgit
177 (or the software it calls)
178 might import the same .dscs differently
179 (although we try to minimise this).
180 As a consequence, the dgit tracking views of the same
181 suite, made by different instances of dgit, may vary.
182 They will have the same contents, but may have different history.
183
184 There is no uniform linkage between the tracking branches for
185 different suites.
186 The Debian infrastructure
187 does not do any automatic import of uploads made without dgit.
188 It would be possible for a distro's infrastructure to do this;
189 in that case,
190 different dgit client instances
191 would see exactly the same history.
192
193 There has been no bulk import of historical uploads into
194 Debian's dgit infrastructure.
195 To do this it would be necessary to decide whether to
196 import existing vcs history
197 (which might not be faithful to dgit's invariants)
198 or previous non-Dgit uploads
199 (which would not provide a very rich history).
200
201 git represents only file executability.
202 git does not represent empty directories,
203 or any leaf objects other than plain files and symlinks.
204 The behaviour of Debian source package formats
205 on objects with unusual permissions is complicated.
206 Some pathological Debian source packages will no longer build
207 if empty directories are pruned
208 (or if other things not reproduced by git are changed).
209 Such sources cannot be worked with properly in git,
210 and therefore not with dgit either.
211 .SH READ-ONLY DISTROS
212 Distros which do not maintain a set of dgit history git repositories
213 can still be used in a read-only mode with dgit.  Currently Ubuntu
214 is configured this way.
215 .SH GITATTRIBUTES
216 git has features which can automatically transform files
217 as they are being copied between the working tree
218 and the git history.
219 The attributes can be specified in the source tree itself,
220 in
221 .BR .gitattributes .
222 See \fBgitattributes\fP(5).
223
224 These transformations are context-sensitive
225 and not, in general, reversible,
226 so dgit operates on the principle that
227 the dgit git history contains the actual contents of the package.
228 (When dgit is manipulating a .dsc,
229 it does so in a private area,
230 where the transforming gitattributes are defused,
231 to achieve this.)
232
233 If transforming gitattributes are used,
234 they can cause trouble,
235 because the working tree files can differ from
236 the git revision history
237 (and therefore from the source packages).
238 dgit warns if it finds a .gitattributes file
239 (in a package being fetched or imported),
240 unless the transforming gitattributes have been defused.
241
242 dgit clone
243 and dgit setup-new-tree
244 disable transforming gitattributes
245 by default,
246 by creating a suitable .git/info/attributes.
247 See
248 .B dgit setup-new-tree
249 and
250 .B dgit setup-gitattributes
251 in dgit(1).
252
253 Note that dgit does not disable gitattributes
254 unless they would actually interfere with your work on dgit branches.
255 In particular, gitattributes which affect
256 .B git archive
257 are not disabled,
258 so .origs you generate by hand can be wrong.
259 You should consider using
260 .B git-deborig (1)
261 which gets this right, suppressing the attributes.
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 .SH FILE EXECUTABILITY
268 Debian source package formats
269 do not always faithfully reproduce
270 changes to executability.
271 But dgit insists that the result of dgit clone is identical
272 (as far as git can represent - see Limitations, above)
273 to the result of dpkg-source -x.
274
275 So files that are executable in your git tree
276 must be executable in the result of dpkg-source -x
277 (but often aren't).
278 If a package has such troublesome files,
279 they have to be non-executable in dgit-compatible git branches.
280 .SH FORMAT 3.0 (QUILT)
281 For a format `3.0 (quilt)' source package, dgit may have to make a
282 commit on your current branch to contain metadata used by quilt and
283 dpkg-source.
284
285 This is because `3.0 (quilt)' source format represents the patch stack
286 as files in debian/patches/ actually inside the source tree.  This
287 means that, taking the whole tree (as seen by git or ls) (i)
288 dpkg-source cannot represent certain trees, and (ii) packing up a tree
289 in `3.0 (quilt)' and then unpacking it does not always yield the same
290 tree.
291
292 dgit will automatically work around this for you when building and
293 pushing.  The only thing you need to know is that dgit build, sbuild,
294 etc., may make new commits on your HEAD.  If you're not a quilt user
295 this commit won't contain any changes to files you care about.
296
297 Simply commiting to source files
298 (whether in debian/ or not, but not to patches)
299 will result in a branch that dgit quilt-fixup can linearise.
300 Other kinds of changes,
301 including editing patches or merging,
302 cannot be handled this way.
303
304 You can explicitly request that dgit do just this fixup, by running
305 dgit quilt-fixup.
306
307 If you are a quilt user you need to know that dgit's git trees are
308 `patches applied packaging branches' and do not contain the .pc
309 directory (which is used by quilt to record which patches are
310 applied).  If you want to manipulate the patch stack you probably want
311 to be looking at tools like
312 git-debrebase, gbp pq, or git-dpm.
313
314 .SS quilt fixup error messages
315 When dgit's quilt fixup fails, it prints messages like this:
316
317 .EX
318 dgit: base trees orig=5531f03d8456b702eab6 o+d/p=135338e9cc253cc85f84
319 dgit: quilt differences: src:  == orig ##     gitignores:  == orig ##
320 dgit: quilt differences:      HEAD ## o+d/p               HEAD ## o+d/p
321 starting quiltify (multiple patches, linear mode)
322
323 dgit: error: quilt fixup cannot be linear.  Stopped at:
324 dgit:  696c9bd5..84ae8f96: changed debian/patches/test-gitignore
325 .EE
326
327 .TP
328 .B orig
329 is an import of the .orig tarballs dgit found,
330 with the debian/ directory from your HEAD substituted.
331 This is a git tree object, not a commit:
332 you can pass its hash to git-diff but not git-log.
333
334 .TP
335 .B o+d/p
336 is another tree object,
337 which is the same as orig
338 but with the patches from debian/patches applied.
339
340 .TP
341 .B HEAD
342 is of course your own git HEAD.
343
344 .TP
345 .B quilt differences
346 shows whether each of the these trees differs from the others
347 (i) in upstream files excluding .gitignore files;
348 (ii) in upstream .gitignore files.
349 .B ==
350 indicates equality;
351 .B ##
352 indicates inequality.
353 .LP
354 dgit quilt-fixup --quilt=linear walks commits
355 backwards from your HEAD
356 trying to construct a linear set of additional patches,
357 starting at the end.
358 It hopes to eventually find an ancestor
359 whose tree is identical to o+d/p in all upstream files.
360
361 In the error message,
362 696c9bd5..84ae8f96
363 is the first commit child-parent edge
364 which cannot be sensibly be
365 either ignored, or turned into a patch in debian/patches.
366 In this example, this is because
367 it itself changes files in debian/patches,
368 indicating that something unusual is going on
369 and that continuing is not safe.
370 But you might also see other kinds of troublesome commit or edge.
371
372 Your appropriate response depends on the cause and the context.
373 If you have been freely merging your git branch
374 and do not need need a pretty linear patch queue,
375 you can use
376 .B --quilt=smash
377 (or use the
378 .B 1.0
379 or
380 .B single-debian-patch
381 source formats; see
382 .BR dpkg-source(1) .)
383 If you want a pretty linear series,
384 and this message is unexpected,
385 it can mean that you have unwittingly committed changes
386 that are not representable by dpkg-source (such as some mode changes).
387 Or maybe you just forgot a necessary
388 .B --quilt=
389 option.
390
391 Finally,
392 this problem can occur if you have provided
393 Debian git tooling such as git-debrebase, git-dpm or git-buildpackage
394 with upstream git commit(s) or tag(s)
395 which are not 100% identical to your orig tarball(s).
396 .SH SPLIT VIEW QUILT MODE
397 When working with git branches intended
398 for use with the `3.0 (quilt)' source format
399 dgit can automatically convert a suitable
400 maintainer-provided git branch
401 (in one of a variety of formats)
402 into a dgit branch.
403
404 When a split view mode is engaged
405 dgit build commands and
406 dgit push
407 will, on each invocation,
408 convert the user's HEAD into the dgit view,
409 so that it can be built and/or uploaded.
410
411 dgit push in split view mode will push the dgit view to the dgit
412 git server.
413 The dgit view is always a descendant of the maintainer view.
414 dgit push will also make a maintainer view tag
415 according to DEP-14
416 and push that to the dgit git server.
417
418 Split view mode must be enabled explicitly
419 (by the use of the applicable command line options,
420 subcommands, or configuration).
421 This is because it is not possible to reliably tell
422 (for example)
423 whether a git tree for a dpkg-source `3.0 (quilt)' package
424 is a patches-applied or patches-unapplied tree.
425
426 Split view conversions are cached in the ref
427 dgit-intern/quilt-cache.
428 This should not be manipulated directly.
429 .SH FILES IN THE ORIG TARBALL BUT NOT IN GIT - AUTOTOOLS ETC.
430 This section is mainly of interest to maintainers who want to use dgit
431 with their existing git history for the Debian package.
432
433 Some developers like to have an extra-clean git tree which lacks files
434 which are normally found in source tarballs and therefore in Debian
435 source packages.  For example, it is conventional to ship ./configure
436 in the source tarball, but some people prefer not to have it present
437 in the git view of their project.
438
439 dgit requires that the source package unpacks to exactly the same
440 files as are in the git commit on which dgit push operates.  So if you
441 just try to dgit push directly from one of these extra-clean git
442 branches, it will fail.
443
444 As the maintainer you therefore have the following options:
445 .TP
446 \(bu
447 Delete the files from your git branches,
448 and your Debian source packages,
449 and carry the deletion as a delta from upstream.
450 (With `3.0 (quilt)' this means represeting the deletions as patches.
451 You may need to pass --include-removal to dpkg-source --commit,
452 or pass corresponding options to other tools.)
453 This can make the Debian
454 source package less useful for people without Debian build
455 infrastructure.
456 .TP
457 \(bu
458 Persuade upstream that the source code in their git history and the
459 source they ship as tarballs should be identical.  Of course simply
460 removing the files from the tarball may make the tarball hard for
461 people to use.
462 .IP
463 One answer is to commit the (maybe autogenerated)
464 files, perhaps with some simple automation to deal with conflicts and
465 spurious changes.  This has the advantage that someone who clones
466 the git repository finds the program just as easy to build as someone
467 who uses the tarball.
468 .LP
469 Of course it may also be that the differences are due to build system
470 bugs, which cause unintended files to end up in the source package.
471 dgit will notice this and complain.  You may have to fix these bugs
472 before you can unify your existing git history with dgit's.
473 .LP
474 .SH FILES IN THE SOURCE PACKAGE BUT NOT IN GIT - DOCS, BINARIES ETC.
475 Some upstream tarballs contain build artifacts which upstream expects
476 some users not to want to rebuild (or indeed to find hard to rebuild),
477 but which in Debian we always rebuild.
478 .LP
479 Examples sometimes include crossbuild firmware binaries and
480 documentation.
481 To avoid problems when building updated source
482 packages
483 (in particular, to avoid trying to represent as changes in
484 the source package uninteresting or perhaps unrepresentable changes
485 to such files)
486 many maintainers arrange for the package clean target
487 to delete these files.
488 .LP
489 dpkg-source does not
490 (with any of the commonly used source formats)
491 represent deletion of binaries (outside debian/) present in upstream.
492 Thus deleting such files in a dpkg-source working tree does not
493 actually result in them being deleted from the source package.
494 Thus
495 deleting the files in rules clean sweeps this problem under the rug.
496 .LP
497 However, git does always properly record file deletion.
498 Since dgit's
499 principle is that the dgit git tree is the same of dpkg-source -x,
500 that means that a dgit-compatible git tree always contains these
501 files.
502 .LP
503 For the non-maintainer,
504 this can be observed in the following suboptimal occurrences:
505 .TP
506 \(bu
507 The package clean target often deletes these files, making the git
508 tree dirty trying to build the source package, etc.
509 This can be fixed
510 by using
511 .BR "dgit -wg" " aka " "--clean=git" ,
512 so that the package clean target is never run.
513 .TP
514 \(bu
515 The package build modifies these files, so that builds make the git
516 tree dirty.
517 This can be worked around by using `git reset --hard'
518 after each build
519 (or at least before each commit or push).
520 .LP
521 From the maintainer's point of view,
522 the main consequence is that to make a dgit-compatible git branch
523 it is necessary to commit these files to git.
524 The maintainer has a few additional options for mitigation:
525 for example,
526 it may be possible for the rules file to arrange to do the
527 build in a temporary area, which avoids updating the troublesome
528 files;
529 they can then be left in the git tree without seeing trouble.
530 .SH PROBLEMS WITH PACKAGE CLEAN TARGETS ETC.
531 A related problem is other unexpected behaviour by a package's
532 .B clean
533 target.
534 If a package's rules
535 modify files which are distributed in the package,
536 or simply forget to remove certain files,
537 dgit will complain that the tree is dirty.
538 .LP
539 Again, the solution is to use
540 .BR "dgit -wg" " aka " "--clean=git" ,
541 which instructs dgit to use git clean instead of the package's
542 build target,
543 along with perhaps
544 .B git reset --hard
545 before each build.
546 .LP
547 This is 100% reliable, but has the downside
548 that if you forget to git add or to commit, and then use
549 .BR "dgit -wg" " or " "git reset --hard" ,
550 your changes may be lost.