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