chiark / gitweb /
dgit: Dgit parsing: Move @ourdscfield loop into parse_dsc_field
[dgit.git] / dgit.7
1 .TH dgit 7 "" "Debian Project" "dgit"
2 .SH NAME
3 dgit \- principles of operation
4 .SH SUMMARY
5 .B dgit
6 treats the Debian archive as a version control system, and
7 bidirectionally gateways between the archive and git.  The git view of
8 the package can contain the usual upstream git history, and will be
9 augmented by commits representing uploads done by other developers not
10 using dgit.  This git history is stored in a canonical location known
11 as
12 .B dgit-repos
13 which lives on a dedicated git server.
14
15 git branches suitable for use with dgit
16 can be edited directly in git,
17 and used directly for building binary packages.
18 They can be shared using all conventional means for sharing git
19 branches.
20 It is not necessary to use dgit to work with dgitish git branches.
21 However, dgit is (usually) needed in order to convert to or from
22 Debian-format source packages.
23 .SH SEE ALSO
24 .TP
25 \fBdgit\fP(1)
26 Reference manual and documentation catalogue.
27 .TP
28 \fBdgit-*\fB(7)
29 Tutorials and workflow guides.  See dgit(1) for a list.
30 .SH MODEL
31 You may use any suitable git workflow with dgit, provided you
32 satisfy dgit's requirements:
33
34 dgit maintains a pseudo-remote called
35 .BR dgit ,
36 with one branch per suite.  This remote cannot be used with
37 plain git.
38
39 The
40 .B dgit-repos
41 repository for each package contains one ref per suite named
42 \fBrefs/dgit/\fR\fIsuite\fR.  These should be pushed to only by
43 dgit.  They are fast forwarding.  Each push on this branch
44 corresponds to an upload (or attempted upload).
45
46 However, it is perfectly fine to have other branches in dgit-repos;
47 normally the dgit-repos repo for the package will be accessible via
48 the remote name `origin'.
49
50 dgit push will also make signed tags called
51 .BI archive/debian/ version
52 (with version encoded a la DEP-14)
53 and push them to dgit-repos.  These are used at the
54 server to authenticate pushes.
55
56 Uploads made by dgit contain an additional field
57 .B Dgit
58 in the source package .dsc.  (This is added by dgit push.)
59 This specifies: a commit (an ancestor of the dgit/suite
60 branch) whose tree is identical to the unpacked source upload;
61 and the distro and suite to which the upload was made
62 (and a url,
63 in case the client seeing this .dsc does not know of that distro).
64
65 Uploads not made by dgit are represented in git by commits which are
66 synthesised by dgit.  The tree of each such commit corresponds to the
67 unpacked source; there is a
68 commit with the contents,
69 and a
70 pseudo-merge from last known upload - that is, from the contents of
71 the dgit/suite branch.
72 Depending on the source package format,
73 the contents commit may have a more complex structure,
74 but ultimately it will be a convergence of stubby branches
75 from origin commits representing the components of the source package.
76
77 dgit expects trees that it works with to have a
78 .B dgit
79 (pseudo) remote.  This refers to the dgit-created git view of
80 the corresponding archive.
81
82 The dgit archive tracking view is synthesised locally,
83 on demand,
84 by each copy of dgit.
85 The tracking view is always a descendant of the
86 dgit-repos suite branch (if one exists),
87 but may be ahead of it if uploads have been done without dgit.
88 The archive tracking view is always fast forwarding within
89 each suite.
90
91 dgit push can operate on any commit which is a descendant of
92 the suite tracking branch.
93
94 dgit does not make a systematic record of
95 its imports of orig tarball(s).
96 So it does not work by finding git tags or branches
97 referring to orig tarball(s).
98 The
99 orig tarballs are downloaded (by dgit clone) into the parent
100 directory, as with a traditional (non-gitish) dpkg-source workflow.
101 You need to retain these tarballs in the parent directory for dgit
102 build and dgit push.
103 (They are not needed for purely-git-based workflows.)
104
105 dgit repositories could be cloned with standard (git) methods.
106 However,
107 the dgit repositories do not contain uploads not made with dgit.
108 And
109 for sourceful builds / uploads the orig
110 tarball(s) will need to be present in the parent directory.
111
112 To a user looking at the archive, changes pushed
113 in a simple NMU
114 using dgit look like
115 reasonable
116 changes made in an NMU: in a `3.0 (quilt)' package the delta from the
117 previous upload is recorded in new patch(es) constructed by dpkg-source.
118 .SH COMBINED SUITES
119 dgit can synthesize a combined view of several underlying suites.
120 This is requested by specifying, for
121 .I suite,
122 a comma-separated list:
123 .IP
124 .IR mainsuite \fB,\fR subsuite ...
125 .LP
126 This facility is available with dgit clone, fetch and pull, only.
127
128 dgit will fetch the same package from each specified underlying suite,
129 separately (as if with dgit fetch).
130 dgit will then generate a pseudomerge commit
131 on the tracking branch
132 .BI remotes/dgit/dgit/ suite
133 which has the tip of each of the underlying suites
134 as an ancestor,
135 and which contains the same as the suite which
136 has the highest version of the package.
137
138 The package must exist in mainsuite,
139 but need not exist in the subsuites.
140
141 If a specified subsuite starts with
142 .B -
143 then mainsuite is prepended.
144
145 So, for example,
146 .B stable,-security
147 means to look for the package in stable, and stable-security,
148 taking whichever is newer.
149 If stable is currently jessie,
150 dgit clone would leave you on the branch
151 .BR dgit/jessie,-security .
152
153 Combined suites are not supported by the dgit build operations.
154 This is because those options are intended for building for
155 uploading source packages,
156 and look in the changelog to find the relevant suite.
157 It does not make sense to name a dgit-synthesised combined suite
158 in a changelog,
159 or to try to upload to it.
160
161 When using this facility, it is important to always specify the
162 same suites in the same order:
163 dgit will not be make a coherent fast-forwarding history
164 view otherwise.
165
166 The history generated by this feature is not normally suitable
167 for merging back into upstreams,
168 as it necessarily contains unattractive pseudomerges.
169 .SH LIMITATIONS
170 Because the synthesis
171 of the suite tracking branches
172 is done locally based only on the current archive state,
173 it will not necessarily see every upload
174 not done with dgit.
175 Also, different versions of dgit
176 (or the software it calls)
177 might import the same .dscs differently
178 (although we try to minimise this).
179 As a consequence, the dgit tracking views of the same
180 suite, made by different instances of dgit, may vary.
181 They will have the same contents, but may have different history.
182
183 There is no uniform linkage between the tracking branches for
184 different suites.
185 The Debian infrastructure
186 does not do any automatic import of uploads made without dgit.
187 It would be possible for a distro's infrastructure to do this;
188 in that case,
189 different dgit client instances
190 would see exactly the same history.
191
192 There has been no bulk import of historical uploads into
193 Debian's dgit infrastructure.
194 To do this it would be necessary to decide whether to
195 import existing vcs history
196 (which might not be faithful to dgit's invariants)
197 or previous non-Dgit uploads
198 (which would not provide a very rich history).
199 .SH READ-ONLY DISTROS
200 Distros which do not maintain a set of dgit history git repositories
201 can still be used in a read-only mode with dgit.  Currently Ubuntu
202 is configured this way.
203 .SH PACKAGE SOURCE FORMATS
204 If you are not the maintainer, you do not need to worry about the
205 source format of the package.  You can just make changes as you like
206 in git.  If the package is a `3.0 (quilt)' package, the patch stack
207 will usually not be represented in the git history.
208 .SH FORMAT 3.0 (QUILT)
209 For a format `3.0 (quilt)' source package, dgit may have to make a
210 commit on your current branch to contain metadata used by quilt and
211 dpkg-source.
212
213 This is because `3.0 (quilt)' source format represents the patch stack
214 as files in debian/patches/ actually inside the source tree.  This
215 means that, taking the whole tree (as seen by git or ls) (i)
216 dpkg-source cannot represent certain trees, and (ii) packing up a tree
217 in `3.0 (quilt)' and then unpacking it does not always yield the same
218 tree.
219
220 dgit will automatically work around this for you when building and
221 pushing.  The only thing you need to know is that dgit build, sbuild,
222 etc., may make new commits on your HEAD.  If you're not a quilt user
223 this commit won't contain any changes to files you care about.
224
225 You can explicitly request that dgit do just this fixup, by running
226 dgit quilt-fixup.
227
228 If you are a quilt user you need to know that dgit's git trees are
229 `patches applied packaging branches' and do not contain the .pc
230 directory (which is used by quilt to record which patches are
231 applied).  If you want to manipulate the patch stack you probably want
232 to be looking at tools like git-dpm.
233 .SH SPLIT VIEW QUILT MODE
234 When working with git branches intended
235 for use with the `3.0 (quilt)' source format
236 dgit can automatically convert a suitable
237 maintainer-provided git branch
238 (in one of a variety of formats)
239 into a dgit branch.
240
241 When a split view mode is engaged
242 dgit build commands and
243 dgit push
244 will, on each invocation,
245 convert the user's HEAD into the dgit view,
246 so that it can be built and/or uploaded.
247
248 dgit push in split view mode will push the dgit view to the dgit
249 git server.
250 The dgit view is always a descendant of the maintainer view.
251 dgit push will also make a maintainer view tag
252 according to DEP-14
253 and push that to the dgit git server.
254
255 Split view mode must be enabled explicitly
256 (by the use of the applicable command line options,
257 subcommands, or configuration).
258 This is because it is not possible to reliably tell
259 (for example)
260 whether a git tree for a dpkg-source `3.0 (quilt)' package
261 is a patches-applied or patches-unapplied tree.
262
263 Split view conversions are cached in the ref
264 dgit-intern/quilt-cache.
265 This should not be manipulated directly.
266 .SH FILES IN THE SOURCE PACKAGE BUT NOT IN GIT - AUTOTOOLS ETC.
267 This section is mainly of interest to maintainers who want to use dgit
268 with their existing git history for the Debian package.
269
270 Some developers like to have an extra-clean git tree which lacks files
271 which are normally found in source tarballs and therefore in Debian
272 source packages.  For example, it is conventional to ship ./configure
273 in the source tarball, but some people prefer not to have it present
274 in the git view of their project.
275
276 dgit requires that the source package unpacks to exactly the same
277 files as are in the git commit on which dgit push operates.  So if you
278 just try to dgit push directly from one of these extra-clean git
279 branches, it will fail.
280
281 As the maintainer you therefore have the following options:
282 .TP
283 \(bu
284 Persuade upstream that the source code in their git history and the
285 source they ship as tarballs should be identical.  Of course simply
286 removing the files from the tarball may make the tarball hard for
287 people to use.
288 .IP
289 One answer is to commit the (maybe autogenerated)
290 files, perhaps with some simple automation to deal with conflicts and
291 spurious changes.  This has the advantage that someone who clones
292 the git repository finds the program just as easy to build as someone
293 who uses the tarball.
294 .TP
295 \(bu
296 Have separate git branches which do contain the extra files, and after
297 regenerating the extra files (whenever you would have to anyway),
298 commit the result onto those branches.
299 .TP
300 \(bu
301 Provide source packages which lack the files you don't want
302 in git, and arrange for your package build to create them as needed.
303 This may mean not using upstream source tarballs and makes the Debian
304 source package less useful for people without Debian build
305 infrastructure.
306 .LP
307 Of course it may also be that the differences are due to build system
308 bugs, which cause unintended files to end up in the source package.
309 dgit will notice this and complain.  You may have to fix these bugs
310 before you can unify your existing git history with dgit's.
311 .LP
312 .SH FILES IN THE SOURCE PACKAGE BUT NOT IN GIT - DOCS, BINARIES ETC.
313 Some upstream tarballs contain build artifacts which upstream expects
314 some users not to want to rebuild (or indeed to find hard to rebuild),
315 but which in Debian we always rebuild.
316 .LP
317 Examples sometimes include crossbuild firmware binaries and
318 documentation.
319 To avoid problems when building updated source
320 packages
321 (in particular, to avoid trying to represent as changes in
322 the source package uninteresting or perhaps unrepresentable changes
323 to such files)
324 many maintainers arrange for the package clean target
325 to delete these files.
326 .LP
327 dpkg-source does not
328 (with any of the commonly used source formats)
329 represent deletion of files (outside debian/) present in upstream.
330 Thus deleting such files in a dpkg-source working tree does not
331 actually result in them being deleted from the source package.
332 Thus
333 deleting the files in rules clean sweeps this problem under the rug.
334 .LP
335 However, git does always properly record file deletion.
336 Since dgit's
337 principle is that the dgit git tree is the same of dpkg-source -x,
338 that means that a dgit-compatible git tree always contains these
339 files.
340 .LP
341 For the non-maintainer,
342 this can be observed in the following suboptimal occurrences:
343 .TP
344 \(bu
345 The package clean target often deletes these files, making the git
346 tree dirty trying to build the source package, etc.
347 This can be fixed
348 by using
349 .BR "dgit -wg" " aka " "--clean=git" ,
350 so that the package clean target is never run.
351 .TP
352 \(bu
353 The package build modifies these files, so that builds make the git
354 tree dirty.
355 This can be worked around by using `git reset --hard'
356 after each build
357 (or at least before each commit or push).
358 .LP
359 From the maintainer's point of view,
360 the main consequence is that to make a dgit-compatible git branch
361 it is necessary to commit these files to git.
362 The maintainer has a few additional options for mitigation:
363 for example,
364 it may be possible for the rules file to arrange to do the
365 build in a temporary area, which avoids updating the troublesome
366 files;
367 they can then be left in the git tree without seeing trouble.
368 .SH PROBLEMS WITH PACKAGE CLEAN TARGETS ETC.
369 A related problem is other unexpected behaviour by a package's
370 .B clean
371 target.
372 If a package's rules
373 modify files which are distributed in the package,
374 or simply forget to remove certain files,
375 dgit will complain that the tree is dirty.
376 .LP
377 Again, the solution is to use
378 .BR "dgit -wg" " aka " "--clean=git" ,
379 which instructs dgit to use git clean instead of the package's
380 build target,
381 along with perhaps
382 .B git reset --hard
383 before each build.
384 .LP
385 This is 100% reliable, but has the downside
386 that if you forget to git add or to commit, and then use
387 .BR "dgit -wg" " or " "git reset --hard" ,
388 your changes may be lost.