chiark / gitweb /
223503358ed6ec8c8340e361748538f1140e2846
[talk-2015-debconf-dgit.git] / talk.txt
1
2 ==== overview slide
3
4
5 Hi.  I'm here to plug dgit, which is a system for treating the Debian
6 archive like a git remote.
7
8 I'm going to talk for about 25 minutess and then I'll take questions.
9
10
11 Firstly, a bit of framing.
12
13 When we work on Debian we take on different roles.  The biggest
14 difference is between the maintainer (or maintainers) of a package,
15 working on their own package, and everyone else.
16
17 I'm going to start by presenting dgit from the point of view of
18 everyone else: NMUers, sponsorship, bug squashers, downstream distros
19 and users, teams doing cross-archive work like transitions and
20 reproducible builds, and so on.  Maintainers, please be patient - I'll
21 get to you a bit later in the talk.
22
23
24 ==== manpage slide
25
26 The point of dgit is that it lets everyone treat the archive as if it
27 were a git repository.
28
29 You can dgit clone any package, in any suite (so, for example, sid or
30 experimental) and you will get a git tree which is exactly the same as
31 dpkg-source -x.
32
33 So dgit always works the same, from the non-maintainer's point of
34 view, on any package: the operation is completely uniform.  You don't
35 need to know anything about the maintainer's verson control workflow
36 tools or source format preferences.
37
38 You can then work on the package in git, the way you would work in git
39 with any other project.  In particular, you can:
40
41  * commit locally
42  * cherry pick changes from other branches
43  * git reset, git clean
44  * git rebase -i to polish a more complex set of changes into
45    a patch queue
46  * all the other usual gitish stuff
47
48 If you have the right authority you can also dgit push, to upload.
49 That is, a DD can dgit push any package; a DM can dgit push the
50 packages that the archive thinks they can upload.
51
52 Before you push you still have to do a build.  dgit does not replace
53 existing ways of building source and binary packages, although it does
54 provide some helpful build rune wrappers (more about that later).
55
56
57 If you don't want to, or can't, upload to Debian, but do want so share
58 your work with other people, you can git push your dgit
59 branch anywhere suitable, so other can fetch it.  So, for example, you
60 could share your branch with your sponsor, who could then approve it
61 by running dgit push.  dgit's branches are ordinary git branches for
62 this purpose.
63
64 A downstream such as a derivative or partial derivative of Debian can
65 use the dgit branches directly as the upstreams for a git-based setup,
66 and work entirley without source packages.
67
68 ==== data flow slide
69
70 Behind the scenes, dgit works by providing a set of git repositories
71 in parallel to the existing archive.
72
73 Every dgit push is actually two underlying operations: the first is a
74 git tag and push, to the dgit git server.  The second is a
75 conventional package upload - with a wrinkle: the .dsc of an upload
76 done with dgit contains an extra field with the git commit hash that
77 was pushed.
78
79 Likewise, fetch and clone combine information from the archive and the
80 git history.  If the most recent upload was done with dgit, the commit
81 hash in the dsc enables dgit fetch to find the right commit and
82 present it to you.  If the most recent upload was not done with dgit,
83 dgit imports the source package into git - and stitches it into the
84 existing dgit history, if there is one.
85
86 You do need to treat dgit git branches a bit specially is if you need
87 to build source pacakges (for upload, for example).  In this case dgit
88 needs the .orig tarballs for your source package.  If you are not
89 doing a new upstream version, dgit fetch will get the relevant .origs
90 for you.  If you /are/ doing a new upstream version, then presumably
91 you have obtained the origs as part of preparing your package, or you
92 can build them easily.
93
94 I should mention that currently only dgit push updates the history on
95 the dgit git server.  So until a package is pushed with dgit push for
96 the first time, doesn't exist on that server; and even after then,
97 non-dgit uploads are not recorded, so the history can be out of date.
98 I'm hoping to improve this in the future.
99
100
101 ==== NMU linear history slide
102
103 As a general rule, the dgit history structure should be up to the
104 maintainer - at least, if they care.
105
106 If you are doing a straightforward NMU you should produce a
107 well-structured linear sequence of commits, as you would for any other
108 git upstream, based on the dgit suite branch.  Not only does this mean
109 that if the maintainer is using dgit, they can hopefully easily
110 include your changes; it also means that if they _aren't_ using dgit,
111 at least you have published a history which is suitable for rebasing
112 onto theirs, or whatever it is they might want to do with it.
113
114 If the source package is `3.0 (quilt)', you shouldn't touch
115 debian/patches; dgit will take care of that for you.  This is the
116 other reason why you should provide a tidy linear patch series: if the
117 maintainer likes quilt and is not using dgit, your changes will be
118 automatically presented to them in a fairly plausible format - a
119 series of extra patches - like they should expect from any other NMU.
120
121 An ordinary NMUer should not normally update a patch in the quilt
122 stack directly.  Ie, an NMUer shouldn't squash their changes into an
123 existing patch.  This is because while it's easy for the maintainer to
124 squash it themselves, if they want, it's a little harder for the
125 maintainer to disentangle a squashed patch.  Working directly on
126 patches can also result in people having to read interdiffs, which are
127 notoriously confusing.
128
129
130 So, in summary, if you are doing cross-archive work, or bug squashing,
131 you can start using dgit right away and I hope it will make your life
132 a lot easier.
133
134
135 ==== NMU linear history on top of basic dgit history
136
137 Sadly, unless the maintainer uses dgit, the history you see in dgit
138 will not be the maintainer's history.
139
140 This is because maintainers' git branches often differ from the source
141 packages in the archive.
142
143 If you dgit clone a package and it has an X-Vcs-Git header, dgit will
144 set up a remote for that, so you can fetch the maintainer's history and use it if you
145 like.  So in that sense dgit clone encompasses debcheckout.
146
147 But, in the general case, the X-Vcs-Git tree may not be immediately
148 useable to someone not familiar with the package, so dgit doesn't use
149 it for the dgit suite branch.
150
151 For example, the maintainer's repo might contain only a debian/
152 directory, or be a quilty tree without patches applied.  And the tag
153 and suite naming conventions can vary too.  So while the maintainer's
154 history can be useful if you want to do archeaology, it's not in
155 general suitable for use by dgit.
156
157 There is also the problem that the maintainer's nominated git server
158 might be anywhere, so it might be down, or gone away, or compromised.
159
160
161 So, if the maintainer is not using dgit, dgit has to synthesise a git
162 history.  The history you see in dgit will then have a very basic
163 branch and commit structure, rather than representing the package's
164 actual history, something like you see here.
165
166
167 Which brings me onto the other side of this talk: dgit for
168 maintainers:
169
170 ==== history comparison slide
171
172 For the reasons I've explained, downstream dgit users would like you
173 as a maintainer to use dgit push to do your uploads.  They will then
174 be able to see, and directly work with, your own history.
175
176 More generally, the point of using a dvcs like git is to publish your
177 work.  The existing ways of publishing git histories for Debian
178 packagess aren't uniformly useable for users: they require the user to
179 understand the maintainer's git working practices.
180
181 What dgit does is provide a way for you to publish a history which
182 users can rely on actually corresponding to the archive, and use
183 immediately without special knowledge.
184
185 But it's in your own selfish interest to upload with dgit, too:
186
187 If you use dgit, you will be able to directly merge NMUs, branches
188 proposed via pull-request emails, and other similar contributions:
189 Because, in this case, the dgit-using contributor will have based
190 their work on your own history.  Whereas, if you don't use dgit,
191 dgit-using contributors will be working on a stub history, and may
192 dgit push commits based on that stub.  You can dgit fetch that work
193 even if you're not using dgit for your own uploads, but if you're not
194 using dgit push yourself, at the very least you'll have to rebase the
195 NMUers' and other contributors' work onto your own history.
196
197 Another advantage of using dgit for your maintainer uploads is that it
198 will put your own history on browse.dgit.debian.org, rather than
199 advertising dgit's stub history (which can also be out of date).
200
201 If you use dgit push, you get an extra check that the source package
202 you are uploading is exactly the same as your git HEAD.  This can
203 save you some dsc-based checks.
204
205 And, of course, as I say, doing your uploads with dgit will improve
206 downstream dgit users' lives.
207
208
209 ==== data flow slide
210
211 dgit is not a replacement for existing git packaging tools; it's
212 intended to complement them.  So (unlike git-dpm) dgit does not define
213 a git history structure.
214
215 Nor, unlike git-buildpackage, does dgit define or suggest a branch
216 structure for naming upstream or downstream branches, pristine tar
217 branches, etc.
218
219 dgit doesn't require a particular source format; it couldn't, since it
220 needs to work with any package.
221
222
223 ==== data flow slide with EQUAL and FF
224
225 dgit push imposes only two requirements on your git trees, which stem
226 directly from dgit's objectives.
227
228 The most important requirement is that your git tree is identical to
229 the unpacked source package.
230
231 For all native and source format 1.0 packages (which will include
232 people using raw git to manage their delta from upstream), this is
233 already the interchange format.  These maintainers can start using
234 dgit right away for all their maintainer uploads.  Please do!
235
236 The other requirement of dgit is simply that the dgit branches are
237 fast-forwarding.  So if your tools have made a rebasing branch, you
238 may need to make a fake merge (with git merge -s ours) before pushing.
239 I'm intending to provide some rather more cooked way to do this but I
240 haven't decided the exact shape yet.
241
242
243 === Status table slide
244
245 For `3.0 (quilt)' packages, things are more complicated.  The purpose
246 of dgit is to provide a git view which is identical to the source
247 package, and can be worked on without knowledge of the maintainer's
248 chosen source format, patch system or git workflow.
249
250 This means that the dgit git tree for a `3.0 (quilt)' package is what
251 is sometimes called a `patches-applied packaging branch without .pc
252 directory'.
253
254 This means that all the changes made in Debian are represented in the
255 main source tree, as well as being contained within a patch in
256 debian/patches.
257
258 But: I think the most popular tool for working with `3.0 (quilt)' is
259 git-buildpackage, and git-buildpackage likes to work with
260 patches-unapplied tress.  I've spoken to Guido Guenther (the
261 git-buildpackage maintainer) about this.  We had a really good
262 conversation.  We have a plan for interoperating, which involves dgit
263 synthesising an extra git commit, to apply the patches, and then
264 pushing that to the dgit git server.  (The extra git commit wouldn't
265 appear on your own branch; if it did, it would cause trouble.)
266
267
268 There is another problem which affects both git-buildpackage and
269 git-dpm: namely, .gitignore files.  Neither git-buildpackage nor
270 git-dpm represent the .gitignore, which typically occurs in the git
271 tree, as a patch in debian/patches.  Rather, these tools tell
272 dpkg-source to ignore it when buildinng the source package.  So the
273 source package does not contain .gitignore, although the git tree
274 does.
275
276 I have spoken to Bernhard Link (the git-dpm maintainer) about this and
277 he wasn't keen on having git-dpm treat .gitignore normally, and record
278 .gitignores in a patch in the git-dpm branch.  So unless we can
279 persuade Bernhard to offer this, at least as an option, dgit is
280 probably going to have to synthesise a commit to add them, in much the
281 same way as it will add a commit to convert a git-buildpackage
282 patches-unapplied branch to a directly-editable patches-applied one.
283
284
285
286 ==== data flow slide
287
288 There are a few other things I ought to cover, since they often come
289 up.  They're are relevant to maintainers and non-maintainers:
290
291
292 Firstly, some wrinkles.
293
294 The first wrinkle is that DMs currently need to email me a signed copy
295 of their ssh key, in order to be able to push.  This is because the
296 dgit repo server uses ssh as a transport and the project doesn't,
297 right now, have a record of DMs' ssh keys.
298
299
300 The second thing that's less than ideal is that the dgit git history
301 does not generally include the package upload history.
302 git-import-dscs can produce a git branch more or less representing the
303 upload history, but dgit doesn't run that itself.  It would be
304 difficult for dgit to do so because deciding which set of versions to
305 include is nontrivial and of course it would involve an awful lot of
306 downloading.
307
308 One could push such a branch to the archive with dgit push.  But, it
309 seems to me that the git history structure ought to up to the
310 maintainer, and if the maintainer chooses to use dgit, the
311 maintainers's existing git history is probably better.
312
313 So I think the real way to improve this is to persuade more
314 maintainers to use dgit.  Perhaps for maintainers who do not, we
315 should at some point consider providing centrally an archive-based
316 package history.
317
318
319 ==== dgit requirements slide
320
321 But the most obvious challenge for a maintainer with an existing git
322 branch, but trying to use dgit, is dgit's insistence that the source
323 package and git tree are the same.
324
325 Sadly, quite a few source packages contain files not in the
326 maintainers' git branches, but which are needed to build: most
327 commonly, autotools output.  Such git branches are not useable with
328 dgit.
329
330 But nowadays most people recommend that the package build should
331 always rerun autotools.  If you do that, then neither your git tree
332 nor your source package need contain the autotools output and all is
333 well.
334
335 Alternatively, you can commit the autotools output to git.  Merge
336 conflicts, which do occur occasionally if you do this, are easily
337 resolved by rerunning autotools.
338
339
340 And a second way dgit's rule can bite is .gitignore.  Most existing
341 packaging tools remove .gitignore from source packages by default.
342 But, dgit dgit requires that the source package and git tree are the
343 same, so if your git tree has .gitignore in it, your source package
344 should too.
345
346 ==== manpage slide
347
348 So it is normally best to use one of dgit's build operations to build
349 for upload; in generally, all that those build operations do
350 differently to the underlying tool, is pass some appropriate -I
351 options, to exclude exactly and only the .git directory.
352
353
354 ==== manpage clean slide
355
356 Finally, there is one compelling advantage of dgit's git-based
357 approach.
358
359 Many packages have strangely-behaved or plain buggy clean targets.
360 Because dgit knows that your git tree is canonical, it can help work
361 around this: you can tell dgit to use git-clean instead, avoiding the
362 package's clean target entirely.
363
364 If you're not in the habit of forgetting to say git-add, you can set a
365 configuration option to have dgit always use git-clean.  Then you will
366 never have to fight a buggy clean target, in a strange package, ever
367 again.
368
369
370
371 ==== Future plans slide
372
373 I have a number of plans for the future, some of which I may even get
374 around to:
375
376
377 dgit can't currently upload to DELAYED queues, which makes it a bit
378 awkward for a fire-and-forget NMU.  One way to implement this would be
379 to push to the suite branch but send the package upload to DELAYED.
380 But such an upload which was deleted by the maintainer would still
381 present be in the suite branch, and the changes might be resurrected
382 by a future dgit user.  At the very least there should be a way for
383 the maintainer to revert a push which was accompanied by a DELAYED
384 upload.
385
386 The other implementation would have the pushed branch stashed away
387 somewhere and "revealed" only when it was ready, if it was still a
388 fast forward.  That makes it tricker for someone else to find it to
389 work on top of it, and is more work to implement, but it's probably
390 better.
391
392
393 It would be easy for dgit, when pushing an NMU, to construct the
394 NMUdiff and email it to the BTS.  Of course a maintainer can fetch
395 your NMU as git commits easily with dgit fetch, but maybe the
396 maintainer isn't using dgit (or, even, isn't using git at all), so you
397 for the benefit of those maintainers we should still be sending these
398 diffs.
399
400
401 dgit push is slightly more work than it needs to be when doing a
402 source-only upload.  In this case there is not really any need for a
403 separate `dgit build-source' step.  I think there should be a way to
404 have dgit push make the source package as well, since it easily can.
405
406
407 The dgit git server has most of the moving parts to become a
408 fairly-general-purpose git server with access control equivalent to
409 the Debian archive.  In this role it could replace some uses of
410 Alioth, which is good because Alioth is doing too many other things.
411
412 In particular, with the use of signed pushes, we could have
413 traceability of pushes, which makes a gitish packaging workflow more
414 practical - in particular, maintainers would not need to as thoroughly
415 audit work found on for-upload branches on the git server, before
416 pushing the code to the archive.  (I suspect many maintainers already
417 don't do this as thoroughly as they should.)
418
419
420 dgit requires the suite branches to be fast forwarding.  If you have a
421 workflow involving git rebase, you need to make a fake merge (ie, a
422 merge made with git merge -s ours), at the tip of your branch, to make
423 it be a fast forward from the previous state of the suite branch.  And
424 then when you want to work on the package again, you need to strip
425 that same fake merge.
426
427 This can be done with raw git operations (git merge and git reset)
428 quite easily, but it's ugly.  Also doing it by hand like this doesn't
429 provide many safety catches.
430
431 I intend to provide some tooling which will help with this, but I
432 haven't exactly decided what the UI should be and how it should work.
433
434
435 The final thing I can do myself is arrange for non-dgit uploads to be
436 automatically converted, and appended to the dgit suite branches on
437 the dgit git server.  That would make the dgit history, as shown on
438 browse.dgit.debian.org for example, for any package be more useful,
439 starting with the first dgit-based upload.  In particular it would
440 avoid the browse view ever being out of date.
441
442
443 There are also some things that I need help with.
444
445 The documentation for how dgit works together with existing git
446 management tools is rather sparse.
447
448 Ideally each git workflow tool would explain how (or whether) it works
449 with dgit.  Tasks that should be covered include how to incorporate
450 changes made in an NMU into the tool's favoured history format, and
451 how to upgrade a package to a new upstream version.  I have spoken to
452 the git-buildpackage and git-dpm maintainers about this.  I'm
453 optimistic particularly about git-buildpackage.
454
455
456 There is a difficulty with empty directories in source packages.  git
457 refuses to handle empty directories - they tend to just vanish from
458 commits and checkouts.  But I'm told there are some source packages
459 whose orig tarballs contain empty directories, and build systems
460 depend on those empty directories.
461
462 Currently if you dgit clone such a package, it won't build.  I don't
463 have a particularly good answer to this problem right now.  It's no
464 good to have dgit create these directories in the working tree, when
465 it notices, because the git branches might be transported by plain git
466 and used elsewhere.
467
468 This can be worked around in the source package by either adding
469 something to debian/rules to create these directories, or by adding
470 some files to the directories to make them nonempty.  But at the
471 moment a maintainer is not required to do either of these things.
472
473
474 And then there are a couple of exciting possibilities for new uses:
475
476 Firstly, it would be very nice to have a way for a sponsee to provide
477 a dgitish git branch, which the sponsor could work with directly and
478 ultimately dgit push.  I'm really need to talk about this with some
479 people more familiar than me with the sponsorship queue
480 infrastructure.
481
482
483
484 Secondly, dgit is not just for Debian.  Other distros currently using
485 only source packages can use it too.  Read-only support doesn't
486 necessarily depend on specific support at the distro end.  So, you can
487 already dgit fetch from ubuntu; I'd welcome patches for read-only
488 support for Mint, for example.
489
490 dgit push support requires a suitably set up git server, and maybe
491 some thought, depending on the distro's views on push access control.
492 I hear rumours that Ubuntu might grow a dgit git server and support
493 dgit push.  Patches very welcome!
494
495
496 ==== Thanks and more info slide
497
498 Finally, there are some people I need to thank.
499
500 At least half of the design of dgit is Joey Hess's, at the now-famous
501 session in Vaumarcus.
502
503 Debian System Administration, and particularly Peter Palfrader, have
504 been absolutely brilliant.  The level of service and competence has
505 been outstanding.  Ever time I noticed some aspect I had forgotten,
506 and made a blatherous and ill-thought-out request, DSA would propose a
507 much better alternative and implement their end of it it almost
508 immediately.
509
510 Also, I'd like to thank the ftpmasters for setting up the new
511 ftpmaster data service.  This has enabled me to extend dgit's
512 useability to non-DDs.
513
514
515 So that's most of what I have prepared.  There's, of course, a lot
516 more detailed information in the manpages.
517
518 I'm going to take questions now.