chiark / gitweb /
dgit(1): Remove obsolete workflow information.
[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
62 Uploads not made by dgit are represented in git by commits which are
63 synthesised by dgit.  The tree of each such commit corresponds to the
64 unpacked source; there is a
65 commit with the contents,
66 and a
67 pseudo-merge from last known upload - that is, from the contents of
68 the dgit/suite branch.
69 Depending on the source package format,
70 the contents commit may have a more complex structure,
71 but ultimately it will be a convergence of stubby branches
72 from origin commits representing the components of the source package.
73
74 dgit expects trees that it works with to have a
75 .B dgit
76 (pseudo) remote.  This refers to the dgit-created git view of
77 the corresponding archive.
78
79 The dgit archive tracking view is synthesised locally,
80 on demand,
81 by each copy of dgit.
82 The tracking view is always a descendant of the
83 dgit-repos suite branch (if one exists),
84 but may be ahead of it if uploads have been done without dgit.
85 The archive tracking view is always fast forwarding within
86 each suite.
87
88 dgit push can operate on any commit which is a descendant of
89 the suite tracking branch.
90
91 dgit does not make a systematic record of
92 its imports of orig tarball(s).
93 So it does not work by finding git tags or branches
94 referring to orig tarball(s).
95 The
96 orig tarballs are downloaded (by dgit clone) into the parent
97 directory, as with a traditional (non-gitish) dpkg-source workflow.
98 You need to retain these tarballs in the parent directory for dgit
99 build and dgit push.
100 (They are not needed for purely-git-based workflows.)
101
102 dgit repositories could be cloned with standard (git) methods.
103 However,
104 the dgit repositories do not contain uploads not made with dgit.
105 And
106 for sourceful builds / uploads the orig
107 tarball(s) will need to be present in the parent directory.
108
109 To a user looking at the archive, changes pushed
110 in a simple NMU
111 using dgit look like
112 reasonable
113 changes made in an NMU: in a `3.0 (quilt)' package the delta from the
114 previous upload is recorded in new patch(es) constructed by dpkg-source.
115 .SH LIMITATIONS
116 Because the synthesis
117 of the suite tracking branches
118 is done locally based only on the current archive state,
119 it will not necessarily see every upload
120 not done with dgit.
121 Also, different versions of dgit
122 (or the software it calls)
123 might import the same .dscs differently
124 (although we try to minimise this).
125 As a consequence, the dgit tracking views of the same
126 suite, made by different instances of dgit, may vary.
127 They will have the same contents, but may have different history.
128
129 There is no uniform linkage between the tracking branches for
130 different suites.
131 The Debian infrastructure
132 does not do any automatic import of uploads made without dgit.
133 It would be possible for a distro's infrastructure to do this;
134 in that case,
135 different dgit client instances
136 would see exactly the same history.
137
138 There has been no bulk import of historical uploads into
139 Debian's dgit infrastructure.
140 To do this it would be necessary to decide whether to
141 import existing vcs history
142 (which might not be faithful to dgit's invariants)
143 or previous non-Dgit uploads
144 (which would not provide a very rich history).
145 .SH READ-ONLY DISTROS
146 Distros which do not maintain a set of dgit history git repositories
147 can still be used in a read-only mode with dgit.  Currently Ubuntu
148 is configured this way.
149 .SH PACKAGE SOURCE FORMATS
150 If you are not the maintainer, you do not need to worry about the
151 source format of the package.  You can just make changes as you like
152 in git.  If the package is a `3.0 (quilt)' package, the patch stack
153 will usually not be represented in the git history.
154 .SH FORMAT 3.0 (QUILT)
155 For a format `3.0 (quilt)' source package, dgit may have to make a
156 commit on your current branch to contain metadata used by quilt and
157 dpkg-source.
158
159 This is because `3.0 (quilt)' source format represents the patch stack
160 as files in debian/patches/ actually inside the source tree.  This
161 means that, taking the whole tree (as seen by git or ls) (i)
162 dpkg-source cannot represent certain trees, and (ii) packing up a tree
163 in `3.0 (quilt)' and then unpacking it does not always yield the same
164 tree.
165
166 dgit will automatically work around this for you when building and
167 pushing.  The only thing you need to know is that dgit build, sbuild,
168 etc., may make new commits on your HEAD.  If you're not a quilt user
169 this commit won't contain any changes to files you care about.
170
171 You can explicitly request that dgit do just this fixup, by running
172 dgit quilt-fixup.
173
174 If you are a quilt user you need to know that dgit's git trees are
175 `patches applied packaging branches' and do not contain the .pc
176 directory (which is used by quilt to record which patches are
177 applied).  If you want to manipulate the patch stack you probably want
178 to be looking at tools like git-dpm.
179 .SH SPLIT VIEW QUILT MODE
180 When working with git branches intended
181 for use with the `3.0 (quilt)' source format
182 dgit can automatically convert a suitable
183 maintainer-provided git branch
184 (in one of a variety of formats)
185 into a dgit branch.
186
187 When a split view mode is engaged
188 dgit build commands and
189 dgit push
190 will, on each invocation,
191 convert the user's HEAD into the dgit view,
192 so that it can be built and/or uploaded.
193
194 dgit push in split view mode will push the dgit view to the dgit
195 git server.
196 The dgit view is always a descendant of the maintainer view.
197 dgit push will also make a maintainer view tag
198 according to DEP-14
199 and push that to the dgit git server.
200
201 Split view mode must be enabled explicitly
202 (by the use of the applicable command line options,
203 subcommands, or configuration).
204 This is because it is not possible to reliably tell
205 (for example)
206 whether a git tree for a dpkg-source `3.0 (quilt)' package
207 is a patches-applied or patches-unapplied tree.
208
209 Split view conversions are cached in the ref
210 dgit-intern/quilt-cache.
211 This should not be manipulated directly.
212 .SH FILES IN THE SOURCE PACKAGE BUT NOT IN GIT - AUTOTOOLS ETC.
213 This section is mainly of interest to maintainers who want to use dgit
214 with their existing git history for the Debian package.
215
216 Some developers like to have an extra-clean git tree which lacks files
217 which are normally found in source tarballs and therefore in Debian
218 source packages.  For example, it is conventional to ship ./configure
219 in the source tarball, but some people prefer not to have it present
220 in the git view of their project.
221
222 dgit requires that the source package unpacks to exactly the same
223 files as are in the git commit on which dgit push operates.  So if you
224 just try to dgit push directly from one of these extra-clean git
225 branches, it will fail.
226
227 As the maintainer you therefore have the following options:
228 .TP
229 \(bu
230 Persuade upstream that the source code in their git history and the
231 source they ship as tarballs should be identical.  Of course simply
232 removing the files from the tarball may make the tarball hard for
233 people to use.
234 .IP
235 One answer is to commit the (maybe autogenerated)
236 files, perhaps with some simple automation to deal with conflicts and
237 spurious changes.  This has the advantage that someone who clones
238 the git repository finds the program just as easy to build as someone
239 who uses the tarball.
240 .TP
241 \(bu
242 Have separate git branches which do contain the extra files, and after
243 regenerating the extra files (whenever you would have to anyway),
244 commit the result onto those branches.
245 .TP
246 \(bu
247 Provide source packages which lack the files you don't want
248 in git, and arrange for your package build to create them as needed.
249 This may mean not using upstream source tarballs and makes the Debian
250 source package less useful for people without Debian build
251 infrastructure.
252 .LP
253 Of course it may also be that the differences are due to build system
254 bugs, which cause unintended files to end up in the source package.
255 dgit will notice this and complain.  You may have to fix these bugs
256 before you can unify your existing git history with dgit's.
257 .LP
258 .SH FILES IN THE SOURCE PACKAGE BUT NOT IN GIT - DOCS, BINARIES ETC.
259 Some upstream tarballs contain build artifacts which upstream expects
260 some users not to want to rebuild (or indeed to find hard to rebuild),
261 but which in Debian we always rebuild.
262 .LP
263 Examples sometimes include crossbuild firmware binaries and
264 documentation.
265 To avoid problems when building updated source
266 packages
267 (in particular, to avoid trying to represent as changes in
268 the source package uninteresting or perhaps unrepresentable changes
269 to such files)
270 many maintainers arrange for the package clean target
271 to delete these files.
272 .LP
273 dpkg-source does not
274 (with any of the commonly used source formats)
275 represent deletion of files (outside debian/) present in upstream.
276 Thus deleting such files in a dpkg-source working tree does not
277 actually result in them being deleted from the source package.
278 Thus
279 deleting the files in rules clean sweeps this problem under the rug.
280 .LP
281 However, git does always properly record file deletion.
282 Since dgit's
283 principle is that the dgit git tree is the same of dpkg-source -x,
284 that means that a dgit-compatible git tree always contains these
285 files.
286 .LP
287 For the non-maintainer,
288 this can be observed in the following suboptimal occurrences:
289 .TP
290 \(bu
291 The package clean target often deletes these files, making the git
292 tree dirty trying to build the source package, etc.
293 This can be fixed
294 by using
295 .BR "dgit -wg" " aka " "--clean=git" ,
296 so that the package clean target is never run.
297 .TP
298 \(bu
299 The package build modifies these files, so that builds make the git
300 tree dirty.
301 This can be worked around by using `git reset --hard'
302 after each build
303 (or at least before each commit or push).
304 .LP
305 From the maintainer's point of view,
306 the main consequence is that to make a dgit-compatible git branch
307 it is necessary to commit these files to git.
308 The maintainer has a few additional options for mitigation:
309 for example,
310 it may be possible for the rules file to arrange to do the
311 build in a temporary area, which avoids updating the troublesome
312 files;
313 they can then be left in the git tree without seeing trouble.
314 .SH PROBLEMS WITH PACKAGE CLEAN TARGETS ETC.
315 A related problem is other unexpected behaviour by a package's
316 .B clean
317 target.
318 If a package's rules
319 modify files which are distributed in the package,
320 or simply forget to remove certain files,
321 dgit will complain that the tree is dirty.
322 .LP
323 Again, the solution is to use
324 .BR "dgit -wg" " aka " "--clean=git" ,
325 which instructs dgit to use git clean instead of the package's
326 build target,
327 along with perhaps
328 .B git reset --hard
329 before each build.
330 .LP
331 This is 100% reliable, but has the downside
332 that if you forget to git add or to commit, and then use
333 .BR "dgit -wg" " or " "git reset --hard" ,
334 your changes may be lost.