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