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