chiark / gitweb /
xxxs
[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 xxx plug plug
125
126
127 ==== NMU linear history on top of basic dgit history
128
129 Sadly, unless the maintainer uses dgit, the history you see in dgit
130 will not be the maintainer's history.
131
132 This is because maintainers' git branches often differ from the source
133 packages in the archive.
134
135 If you dgit clone a package and it has an X-Vcs-Git header, dgit will
136 set up a remote for that, so you can fetch the maintainer's history and use it if you
137 like.  So in that sense dgit clone encompasses debcheckout.
138
139 But, in the general case, the X-Vcs-Git tree may not be immediately
140 useable to someone not familiar with the package, so dgit doesn't use
141 it for the dgit suite branch.
142
143 For example, the maintainer's repo might contain only a debian/
144 directory, or be a quilty tree without patches applied.  And the tag
145 and suite naming conventions can vary too.  So while the maintainer's
146 history can be useful if you want to do archeaology, it's not in
147 general suitable for use by dgit.
148
149 There is also the problem that the maintainer's nominated git server
150 might be anywhere, so it might be down, or gone away, or compromised.
151
152
153 So, if the maintainer is not using dgit, dgit has to synthesise a git
154 history.  The history you see in dgit will then have a very basic
155 branch and commit structure, rather than representing the package's
156 actual history, something like you see here.
157
158
159 Which brings me onto the other side of this talk: dgit for
160 maintainers:
161
162 ==== history comparison slide
163
164 For the reasons I've explained, downstream dgit users would like you
165 as a maintainer to use dgit push to do your uploads.  They will then
166 be able to see, and directly work with, your own history.
167
168 More generally, the point of using a dvcs like git is to publish your
169 work.  The existing ways of publishing git histories for Debian
170 packagess aren't uniformly useable for users: they require the user to
171 understand the maintainer's git working practices.
172
173 What dgit does is provide a way for you to publish a history which
174 users can rely on actually corresponding to the archive, and use
175 immediately without special knowledge.
176
177 But it's in your own selfish interest to upload with dgit, too:
178
179 If you use dgit, you will be able to directly merge NMUs, branches
180 proposed via pull-request emails, and other similar contributions:
181 Because, in this case, the dgit-using contributor will have based
182 their work on your own history.  Whereas, if you don't use dgit,
183 dgit-using contributors will be working on a stub history, and may
184 dgit push commits based on that stub.  You can dgit fetch that work
185 even if you're not using dgit for your own uploads, but if you're not
186 using dgit push yourself, at the very least you'll have to rebase the
187 NMUers' and other contributors' work onto your own history.
188
189 Another advantage of using dgit for your maintainer uploads is that it
190 will put your own history on browse.dgit.debian.org, rather than
191 advertising dgit's stub history (which can also be out of date).
192
193 If you use dgit push, you get an extra check that the source package
194 you are uploading is exactly the same as your git HEAD.  This can
195 save you some dsc-based checks.
196
197 And, of course, as I say, doing your uploads with dgit will improve
198 downstream dgit users' lives.
199
200
201 ==== data flow slide
202
203 dgit is not a replacement for existing git packaging tools; it's
204 intended to complement them.  So (unlike git-dpm) dgit does not define
205 a git history structure.
206
207 Nor, unlike git-buildpackage, does dgit define or suggest a branch
208 structure for naming upstream or downstream branches, pristine tar
209 branches, etc.
210
211 dgit doesn't require a particular source format; it couldn't, since it
212 needs to work with any package.
213
214
215 ==== data flow slide with EQUAL and FF
216
217 dgit push imposes only two requirements on your git trees, which stem
218 directly from dgit's objectives.
219
220 The most important requirement is that your git tree is identical to
221 the unpacked source package.  (Technically, in the case of a `3.0
222 (quilt)' package, it is what is sometimes called a `patches-applied
223 packaging branch without .pc directory'.  Patches-applied means that
224 the upstream source files in the main package tree correspond to the
225 actual source code that will be used when the package is built, rather
226 than to the upstream versions.)
227
228 xxx slide, longer explanation
229
230
231 For all native packages, and for users of git-dpm and raw git, this is
232 already the interchange format.  These maintainers can start using
233 dgit right away for all their maintainer uploads.  Please do!
234
235 For those using git-buildpackage with `3.0 (quilt)', things are a bit
236 more complicated.  I'm told that gbp pq can be used to generate a
237 patches-applied branch, and that some users prefer to use that as the
238 interchange git branch, but I know this is far from universal.  I'm
239 talking to the git-buildpackage maintainers about gbp integration, so
240 watch this space.  xxx
241
242 The other requirement of dgit is simply that the dgit branches are
243 fast-forwarding.  So if your tools have made a rebasing branch, you
244 may need to make a fake merge (with git merge -s ours) before pushing.
245 I'm intending to provide some rather more cooked way to do this but I
246 haven't decided the exact shape yet.
247
248
249 ==== data flow slide
250
251 There are a few other things I ought to cover, since they often come
252 up.  They're are relevant to maintainers and non-maintainers:
253
254
255 Firstly, some wrinkles.
256
257 The first wrinkle is that DMs currently need to email me a signed copy
258 of their ssh key, in order to be able to push.  This is because the
259 dgit repo server uses ssh as a transport and the project doesn't,
260 right now, have a record of DMs' ssh keys.
261
262
263 The second thing that's less than ideal is that the dgit git history
264 does not generally include the package upload history.
265 git-import-dscs can produce a git branch representing the upload
266
267 xxx patches-applied
268
269 history, but dgit doesn't run that itself.  It would be difficult for
270 dgit to do so because deciding which set of versions to include is
271 nontrivial and of course it would involve an awful lot of downloading.
272
273 One could push such a branch to the archive with dgit push.  But, it
274 seems to me that the git history structure ought to up to the
275 maintainer, and if the maintainer chooses to use dgit, the
276 maintainers's existing git history is probably better.
277
278 So I think the real way to improve this is to persuade more
279 maintainers to use dgit.  Perhaps for maintainers who do not, we
280 should at some point consider providing centrally an archive-based
281 package history.
282
283
284 ==== dgit requirements slide
285
286 But the most obvious challenge for a maintainer with an existing git
287 branch, but trying to use dgit, is dgit's insistence that the source
288 package and git tree are the same.
289
290 Sadly, quite a few source packages contain files not in the
291 maintainers' git branches, but which are needed to build: most
292 commonly, autotools output.  Such git branches are not useable with
293 dgit.
294
295 But nowadays most people recommend that the package build should
296 always rerun autotools.  If you do that, then neither your git tree
297 nor your source package need contain the autotools output and all is
298 well.
299
300 Alternatively, you can commit the autotools output to git.  Merge
301 conflicts, which do occur occasionally if you do this, are easily
302 resolved by rerunning autotools.
303
304
305 And a second way dgit's rule can bite is .gitignore.  Most existing
306 packaging tools remove .gitignore from source packages by default.
307 But, dgit dgit requires that the source package and git tree are the
308 same, so if your git tree has .gitignore in it, your source package
309 should too.
310
311 ==== manpage slide
312
313 So it is normally best to use one of dgit's build operations to build
314 for upload; in generally, all that those build operations do
315 differently to the underlying tool, is pass some appropriate -I
316 options, to exclude exactly and only the .git directory.
317
318
319 ==== manpage clean slide
320
321 Finally, there is one compelling advantage of dgit's git-based
322 approach.
323
324 Many packages have strangely-behaved or plain buggy clean targets.
325 Because dgit knows that your git tree is canonical, it can help work
326 around this: you can tell dgit to use git-clean instead, avoiding the
327 package's clean target entirely.
328
329 If you're not in the habit of forgetting to say git-add, you can set a
330 configuration option to have dgit always use git-clean.  Then you will
331 never have to fight a buggy clean target, in a strange package, ever
332 again.
333
334
335
336 ==== Future plans slide
337
338 I have a number of plans for the future, some of which I may even get
339 around to:
340
341
342 dgit can't currently upload to DELAYED queues, which makes it a bit
343 awkward for a fire-and-forget NMU.  One way to implement this would be
344 to push to the suite branch but send the package upload to DELAYED.
345 But such an upload which was deleted by the maintainer would still
346 present be in the suite branch, and the changes might be resurrected
347 by a future dgit user.  At the very least there should be a way for
348 the maintainer to revert a push which was accompanied by a DELAYED
349 upload.
350
351 The other implementation would have the pushed branch stashed away
352 somewhere and "revealed" only when it was ready, if it was still a
353 fast forward.  That makes it tricker for someone else to find it to
354 work on top of it, and is more work to implement, but it's probably
355 better.
356
357
358 It would be easy for dgit, when pushing an NMU, to construct the
359 NMUdiff and email it to the BTS.  Of course a maintainer can fetch
360 your NMU as git commits easily with dgit fetch, but maybe the
361 maintainer isn't using dgit (or, even, isn't using git at all), so you
362 for the benefit of those maintainers we should still be sending these
363 diffs.
364
365
366 dgit push is slightly more work than it needs to be when doing a
367 source-only upload.  In this case there is not really any need for a
368 separate `dgit build-source' step.  I think there should be a way to
369 have dgit push make the source package as well, since it easily can.
370
371
372 The dgit git server has most of the moving parts to become a
373 fairly-general-purpose git server with access control equivalent to
374 the Debian archive.  In this role it could replace some uses of
375 Alioth, which is good because Alioth is doing too many other things.
376
377 In particular, with the use of signed pushes, we could have
378 traceability of pushes, which makes a gitish packaging workflow more
379 practical - in particular, maintainers would not need to as thoroughly
380 audit work found on for-upload branches on the git server, before
381 pushing the code to the archive.  (I suspect many maintainers already
382 don't do this as thoroughly as they should.)
383
384
385 dgit requires the suite branches to be fast forwarding.  If you have a
386 workflow involving git rebase, you need to make a fake merge (ie, a
387 merge made with git merge -s ours), at the tip of your branch, to make
388 it be a fast forward from the previous state of the suite branch.  And
389 then when you want to work on the package again, you need to strip
390 that same fake merge.
391
392 This can be done with raw git operations (git merge and git reset)
393 quite easily, but it's ugly.  Also doing it by hand like this doesn't
394 provide many safety catches.
395
396 I intend to provide some tooling which will help with this, but I
397 haven't exactly decided what the UI should be and how it should work.
398
399
400 The final thing I can do myself is arrange for non-dgit uploads to be
401 automatically converted, and appended to the dgit suite branches on
402 the dgit git server.  That would make the dgit history, as shown on
403 browse.dgit.debian.org for example, for any package be more useful,
404 starting with the first dgit-based upload.  In particular it would
405 avoid the browse view ever being out of date.
406
407
408 There are also some things that I need help with.
409
410 The documentation for how dgit works together with existing git
411 management tools is rather sparse.  Ideally each git workflow tool
412 would explain how (or whether) it works with dgit.  Tasks that should
413 be covered include how to incorporate changes made in an NMU into the
414 tool's favoured history format, and how to upgrade a package to a new
415 upstream version.
416
417 The bug I mention there is my request against git-dpm for anew manpage
418 covering these topics, since I think the moving parts for git-dpm to
419 work with dgit are generally in place.
420
421 And this leads on to the question of how to use git-buildpackage and
422 dgit together.  As I say, I'm talking to the gbp maintainers.
423
424
425 And then there are a couple of exciting possibilities for new uses:
426
427 Firstly, it would be very nice to have a way for a sponsee to provide
428 a dgitish git branch, which the sponsor could work with directly and
429 ultimately dgit push.  I'm really need to talk about this with some
430 people more familiar than me with the sponsorship queue infrastructure.
431
432 Secondly, dgit is not just for Debian.  Other distros currently using
433 only source packages can use it too.  Read-only support doesn't
434 necessarily depend on specific support at the distro end.  So, you can
435 already dgit fetch from ubuntu; I'd welcome patches for read-only
436 support for Mint, for example.
437
438 dgit push support requires a suitably set up git server, and maybe
439 some thought, depending on the distro's views on push access control.
440 I hear rumours that Ubuntu might grow a dgit git server and support
441 dgit push.  Patches very welcome!
442
443
444 ==== Thanks and more info slide
445
446 xxx thank dsa ftpmaster
447
448
449 So that's most of what I have prepared.  There's, of course, a lot
450 more detailed information in the manpages.
451
452 I'm going to take questions now.