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