chiark / gitweb /
Deal with xxx's
[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 When we work on Debian we take on different roles.  The biggest
12 difference is between the maintainer (or maintainers) of a package,
13 working on their own package, and everyone else.
14
15 I'm going to start by presenting dgit from the point of view of
16 everyone else: NMUers, sponsorship, bug squashers, downstreams,
17 users, teams doing cross-archive work
18 like transitions and reproducible builds, and so on.  Maintainers,
19 please be patient - I'll get to you later
20
21
22 ==== manpage slide
23
24 The point of dgit is that it lets everyone treat the archive as if it
25 were a git repository.
26
27 You can dgit clone any package, in any suite (so, for example, sid or
28 experimental) and you will get a git tree which is exactly the same as
29 dpkg-source -x.
30
31 So dgit always works the same, from the non-maintainer's point of
32 view, on any package: the operation is completely uniform.  You don't
33 need to know anything about the maintainer's verson control workflow
34 tools or source format preferences.
35
36 You can then work on the package in git, the way you would work in git
37 with any other project.  In particular, you can:
38
39  * commit locally
40  * cherry pick changes from other branches
41  * git reset, git clean
42  * git rebase -i to polish a more complex set of changes into
43    a patch queue
44  * all the other usual gitish stuff
45
46 If you have the right authority you can also dgit push, to upload.
47 That is, a DD can dgit push any package; a DM can dgit push the
48 packages that the archive thinks they can upload.
49
50 Before you push you still have to do a build.  dgit does not replace
51 existing ways of building source and binary packages, although it does
52 provide some helpful build rune wrappers (more about that later).
53
54
55 If you don't want to, or can't, upload to Debian, but do want so share
56 your work with other people, you can git push your dgit
57 branch anywhere suitable, so they can fetch it.  So, for example, you
58 could share your branch with your sponsor, who could then approve it
59 by running dgit push.  dgit's branches are ordinary git branches for
60 this purpose.
61
62 A downstream such as a derivative or partial derivative of Debian can
63 use the dgit branches directly as the upstream for a git-based setup,
64 and work entirley without source packages.
65
66 ==== data flow slide
67
68 Behind the scenes, dgit works by providing a set of git repositories
69 in parallel to the existing archive.
70
71 Every dgit push is actually two underlying operations: the first is a
72 git tag and push, to the dgit git server.  The second is a
73 conventional package upload - with a wrinkle: the .dsc of an upload
74 done with dgit contains an extra field with the git commit hash that
75 was pushed.
76
77 Likewise, fetch and clone combine information from the archive and the
78 git history.  If the most recent upload was done with dgit, the commit
79 hash in the dsc enables dgit fetch to find the right commit and
80 present it to you.  If the most recent upload was not done with dgit,
81 dgit imports the source package into git - and stitches it into the
82 existing dgit history, if there is one.
83
84 You do need to treat dgit git branches a bit specially is if you need
85 to build source pacakges (for upload, for example).  In this case dgit
86 needs the .orig tarballs for your source package.  If you are not
87 doing a new upstream version, dgit fetch will get the relevant .origs
88 for you.  If you /are/ doing a new upstream version, then presumably
89 you have obtained them as part of preparing your package, or you can
90 build them easily.
91
92
93 ==== NMU linear history slide
94
95 As a general rule, the dgit history structure should be up to the
96 maintainer - at least, if they care.
97
98 If you are doing a straightforward NMU you should produce a
99 well-structured linear sequence of commits, as you would for any other
100 git upstream.  Not only does this mean that if the maintainer is using
101 dgit, they can hopefully easily include your changes; it also means
102 that if they _aren't_ using dgit, at least you have published a
103 history which is suitable for rebasing onto theirs, or whatever.
104
105 If the source package is `3.0 (quilt)', you shouldn't touch
106 debian/patches; dgit will take care of that for you.  This is the
107 other reason why you should provide a tidy linear patch series: if the
108 maintainer likes quilt and is not using dgit, your changes will be
109 automatically presented to them in a fairly plausible format like they
110 should expect from any other NMU.
111
112 An ordinary NMUer should not normally update a patch in the quilt
113 stack directly.  Ie, an NMUer shouldn't squash their changes into an
114 existing patch.  This is because while it's easy for the maintainer to
115 squash it themselves, if they want, it's a little harder for the
116 maintainer to disentangle a squashed patch.  This can also result in
117 people having to read interdiffs, which are notoriously confusing.
118
119
120 ==== NMU linear history on top of basic dgit history
121
122 Sadly, unless the maintainer uses dgit, the history you see in dgit
123 will not be the maintainer's history.
124
125 This is because maintainers' git branches often differ from the source
126 packages in the archive.
127
128 If you dgit clone a package and it has an X-Vcs-Git header, dgit will
129 set up a remote for it, so you can fetch the history and use it if you
130 like.  So in that sense dgit clone encompasses debcheckout.
131
132 But, in the general case, the X-Vcs-Git tree may not be immediately
133 useable to someone not familiar with the package.
134
135 The maintainer's repo might contain only a debian/ directory, or be a
136 quilty tree without patches applied.  And the tag and suite naming
137 conventions can vary too.  So while the maintainer's history can be
138 useful if you want to do archeaology, it's not in general suitable for
139 use by dgit.
140
141 There is also the problem that the maintainer's nominated git server
142 might be anywhere, so it might be down, or gone away, or compromised.
143
144
145 So, if the maintainer is not using dgit, dgit has to synthesise a git
146 history.  The history you see in dgit will then have a very basic
147 branch and commit structure, rather than representing the package's
148 actual history.
149
150
151 Which brings me onto the other side of this talk: dgit for
152 maintainers:
153
154 ==== history comparison slide
155
156 For the reasons I've explained, downstream dgit users would like you
157 as a maintainer to use dgit push to do your uploads.  They will then
158 be able to see, and directly work with, your own history.
159
160 In general, the point of using a dvcs like git is to publish your
161 work.  The existing ways of publishing git histories for Debian
162 packagess aren't uniformly useable for users: they require the user to
163 understand the maintainer's git working practices.
164
165 What dgit does is provide a way for you to publish a history which
166 users can rely on actually corresponding to the archive, and use
167 immediately without special knowledge.
168
169 But it's in your own selfish interest to upload with dgit, too:
170
171 If you use dgit, you will be able to directly merge NMUs, patches
172 proposed via pull-request emails, and so on: Because, in this case,
173 the dgit-using contributor will have based their work on your own
174 history.  Whereas, if you don't, dgit-using contributors will be
175 working on a stub history, and may dgit push commits based on that
176 stub.  You can dgit fetch it even if you're not using dgit for your
177 uploads, but when you do at the very least you'll have to rebase the
178 NMUer's work.
179
180 Another advantage of using dgit for your maintainer uploads is that it
181 will put your own history on browse.dgit.debian.org, rather than
182 advertising dgit's stub history (which can also be out of date).
183
184 If you use dgit push, you get an extra check that the source package
185 you are uploading is exactly the same as your git HEAD.  This can
186 save you some dsc-based checks.
187
188 And, of course, as I say, doing your uploads with dgit will improve
189 downstream dgit users' lives.
190
191
192 ==== data flow slide
193
194 dgit is not a replacement for existing git packaging tools; it's
195 intended to complement them.  So (unlike git-dpm) dgit does not define
196 a git history structure.
197
198 Nor does dgit define a branch structure distinguishing upstream or
199 downstream branches, pristine tar branches, etc.
200
201 dgit doesn't require a particular source format; it couldn't, since it
202 needs to work with any package.
203
204
205 ==== data flow slide with EQUAL and FF
206
207 dgit push imposes only two requirements on your git trees, which stem
208 directly from dgit's objectives.
209
210 The most important requirement is that your git tree is identical to
211 the unpacked source package.  (Technically, in the case of a `3.0
212 (quilt)' package, it is what is sometimes called a `patches-applied
213 packaging branch without .pc directory', which means that the upstream
214 source files in the main package tree correspond to the actual source
215 code that will be used when the package is built, rather than to the
216 upstream versions.)
217
218 For all native packages, and for users of git-dpm and raw git, this is
219 already the interchange format.  These maintainers can start using
220 dgit right away.  Please do!
221
222 For those using git-buildpackage with `3.0 (quilt)', things are a bit
223 more complicated.  I'm told that gbp pq can be used to generate a
224 patches-applied branch, and that some users prefer to use that as the
225 interchange git branch, but I know this is far from universal.  I'm
226 talking to the git-buildpackage maintainers about gbp integration, so
227 watch this space.
228
229 The other requirement of dgit is simply that the dgit branches are
230 fast-forwarding.  So if your tools have made a rebasing branch, you
231 may need to make a fake merge (with git merge -s ours) before pushing.
232 I'm intending to provide some rather more cooked way to do this but I
233 haven't decided the exact shape yet.
234
235
236 ==== data flow slide
237
238 There are a few other things I ought to cover, since they often come
239 up.  They're are relevant to maintainers and non-maintainers:
240
241
242 Firstly, some wrinkles.
243
244 The first wrinkle is that DMs currently need to email me a signed copy
245 of their ssh key, in order to be able to push.  This is because the
246 dgit repo server uses ssh as a transport and the project doesn't,
247 right now, have a record of DMs' ssh keys.
248
249
250 The second thing that's less than ideal is that the dgit git history
251 does not generally include the package upload history.
252 git-import-dscs can produce a git branch representing the upload
253 history, but dgit doesn't run that itself.  It would be difficult for
254 dgit to do so because deciding which set of versions to include is
255 nontrivial and of course it would involve an awful lot of downloading.
256
257 One could push such a branch to the archive with dgit push.  But, it
258 seems to me that the git history structure ought to up to the
259 maintainer, and if the maintainer chooses to use dgit, the
260 maintainers's existing git history is probably better.
261
262 So I think the real way to improve this is to persuade more
263 maintainers to use dgit.  Perhaps for maintainers who do not, we
264 should at some point consider providing centrally an archive-based
265 package history.
266
267
268 But the most obvious challenge for a maintainer with an existing git
269 branch, but trying to use dgit, is dgit's insistence that the source
270 package and git tree are the same.
271
272 However, some source packages contain files not in the maintainers'
273 git branches, and which are needed to build: most commonly, autotools
274 output.  Such git branches are not useable with dgit.
275
276 But nowadays most people recommend that the package build should
277 always rerun autotools.  If you do that, then neither your git tree
278 nor your source package need contain the autotools output and all is
279 well.
280
281 Alternatively, you can commit the autotools output to git.  Merge
282 conflicts etc. are easily resolved by rerunning autotools.
283
284
285 And a second way this can bite is that it is normally best to use one
286 of dgit's build operations to build for upload.  This is mainly
287 because most other tools remove .gitignore by default.  dgit requires
288 that the source package and git tree are the same, so if your git tree
289 has .gitignore in it, your source package should too.
290
291
292 Finally, there is one compelling advantage of dgit's git-based
293 approach.
294
295 Many packages have strangely-behaved or plain buggy clean targets.
296 Because dgit knows that your git tree is canonical, it can help work
297 around this: you can tell dgit to use git-clean instead, avoiding the
298 package's clean target entirely.
299
300 If you're not in the habit of forgetting to say git-add, you can set a
301 configuration option to have dgit always use git-clean.  Then you will
302 never have to fight a buggy clean target, in a strange package, ever again.
303
304
305
306 ==== Future plans slide
307
308 I have a number of plans for the future, some of which I need help
309 with.  But I don't have time, I'm afraid, to go through them.
310
311 Instead, I'm going to open the talk up to questions now.
312
313
314 12 mins