File: packaging-workflow-with-git.html

package info (click to toggle)
git-stuff 11-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 468 kB
  • sloc: sh: 1,072; perl: 152; makefile: 128
file content (254 lines) | stat: -rw-r--r-- 7,587 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<title>Packaging Workflow with Git</title>

	<style type="text/css">
		a { color: black; }
		a:hover { text-decoration: none; }
		a:visited { color: gray; }
		acronym { cursor: help; }
		body { font-family: "DejaVu Sans", "Bitstream Vera Sans", sans-serif; }
		pre { background-color: #EEEEEE; border: 1px dashed black; padding: 1em; }
		red { color: red; }
		div.right { text-align: right; }
	</style>
<body>

<div>

<hr />

<h1>Packaging Workflow with Git</h1>

<hr />

<h2><a name="toc">Table of Contents</a></h2>

<ol>
	<li><a href="#definitions">Definitions</a></li>
	<li><a href="#prepartations">Preparations</a></li>
	<li><a href="#new-package">Handling new packages</a></li>
	<li><a href="#existing-package">Handling existing package</a></li>
</ol>

<hr />

<h2><a name="definitions">1. Definitions</a></h2>

<ul>
	<li><red><b>changeslist:</b></red> name of the commit mailinglist</li>
	<li><red><b>ciaproject:</b></red> name of the cia project</li>
	<li><red><b>package:</b></red> name of the source package of your program</li>
	<li><red><b>project:</b></red> name of the alioth project</li>
	<li><red><b>revision:</b></red> debian version string</li>
	<li><red><b>username:</b></red> name of the alioth account</li>
	<li><red><b>version:</b></red> upstream version string</li>
</ul>

<div class="right">
	<a href="#toc">^</a>
</div>

<hr />

<h2><a name="preparations">2. Preparations</a></h2>

<ul>
	<li>Install git
	<pre><b># apt-get install git</b></pre>
	</li>

	<li>Install pristine-tar
	<pre><b># apt-get install pristine-tar</b></pre>
	</li>

	<li>Install git-buildpackage
	<pre><b># apt-get install git-buildpackage</b></pre>
	</li>
</ul>

<div class="right">
	<a href="#toc">^</a>
</div>

<hr />

<h2><a name="new-package">3. Handling new packages</a></h2>

<h3><a name="upstream-tarball">3.1 Preparing upstream tarball</a></h3>

<ul>
	<li>Download upstream source tarball</li>

	<li>Rename it to <code><b><red><i>package</i></red>_<red><i>version</i></red>.orig.tar.gz</b></code></li>
</ul>

<h3><a name="git-repository">3.2 Preparing git repository</a></h3>

<ul>
	<li>Create an empty git repository
	<pre><b>$ mkdir <red><i>program</i></red>
$ cd <red><i>program</i></red>
$ git init --shared</b></pre></li>

	<li>Unpack upstream sources into the git repository
	<!-- FIXME: <pre><b>$ tar xfz ../<red><i>program</i></red>_<red><i>version</i></red>.orig.tar.gz</b></pre></li> -->

	<li>Import upstream into git
	<pre><b>$ git add .
$ git commit -a -m "Adding upstream version <code><red><i>version</i></red></code>."
$ git tag -a -m "Tagging upstream version <code><red><i>version</i></red></code>." upstream/<code><red><i>version</i></red></code></b></pre></li>

	<li>Create upstream branch (by renaming master)
	<pre><b>$ git branch -m master upstream</b></pre></li>

	<li>Import pristine-tar delta
	<pre><b>$ pristine-tar commit -m "Adding pristine-tar version <red>version</red>." ../<red><i>program</i></red>_<red><i>version</i></red>.orig.tar.gz</b></pre></li>

	<li>Create and switch to debian branch
	<pre><b>$ git checkout -b debian</b></pre></li>

	<li>Prepare bare git repository
	<pre><b>$ cd ..
$ git clone --bare <red><i>program</i></red> <red><i>program</i></red>.git
$ cd <red><i>program</i></red>.git</b></pre></li>

	<li>Add gitweb description
	<pre><b>$ echo "<red><i>project</i></red>/<red><i>program</i></red>" &gt; description</b></pre></li>

	<li>Add commit notifiers (cia and mailinglist)
	<pre><b>$ cat &gt;&gt; config &lt;&lt; EOF
[hooks]
	cia-project = <red><i>ciaproject</i></red>
	mailinglist = <red><i>changeslist</i></red>@lists.alioth.debian.org
EOF

$ mv hooks/post-receive hooks/post-receive.orig

$ cat &gt; hooks/post-receive &lt;&lt; EOF
#!/bin/sh
exec /usr/local/bin/git-commit-notice
EOF
$ chmod 0755 hooks/post-receive

$ cd ..</b></pre></li>

	<li>Upload git repository to alioth
	<pre><b>$ scp -r <red><i>program</i></red>.git <red><i>username</i></red>@alioth.debian.org:/git/<red><i>project</i></red></b></pre></li>

	<li>Remember to make sure that the files on alioth do have read-write permissions for your alioth group.</li>
</ul>

<div class="right">
	<a href="#toc">^</a>
</div>

<hr />

<h2><a name="existing-package">4. Handling existing package</a></h2>

<h3><a name="checkout">4.1 Checking out</a></h3>

<ul>
	<li>Checkout repository
	<pre><b>$ git clone ssh://<red><i>username</i></red>@git.debian.org/git/<red><i>project</i></red>/<red><i>package</i></red>.git</b></pre></li>

	<li>Checkout branches
	<pre><b>$ cd <red><i>package</i></red>

$ git checkout -b upstream origin/upstream
$ git checkout -b pristine-tar origin/pristine-tar</b></pre></li>

	<li>Switch to debian branch
	<pre><b>$ git checkout debian</b></pre></li>
</ul>

<h3><a name="checkin">4.2 Checking in</a></h3>

<ul>
	<li>Make sure that you are on the debian branch
	<pre><b>$ cd <red><i>package</i></red>

$ git checkout debian</b></pre></li>

	<li>Do your modifications on the package here. Remember to <b><u>not</u></b> touch debian/changelog at all, it will be later automatically generated from the git log.</li>

	<li>Commit changes
	<pre><b>$ git commit -a -m "<red><i>My commit message.</i></red>"</b></pre></li>

	<li>After a bunch of commits, you push changes
	<pre><b>$ git push</b></pre></li>
</ul>

<h3><a name="upstream">4.3 Adding new Upstream version</a></h3>

<ul>
	<li>Make sure that you are on the upstream branch
	<pre><b>$ cd <red><i>package</i></red>

$ git checkout upstream</b></pre></li>

	<li>Removing current files
	<pre><b>$ rm -rf *</b></pre></li>

	<li>Unpacking new upstream sources into the git repository.</li>
	<!-- FIXME: <pre><b>$ tar xfz ../<red><i>program</i></red>_<red><i>version</i></red>.orig.tar.gz</b></pre></li> -->

	<li>Adding files
	<pre><b>$ git add .
$ git commit -a -m "Adding upstream version <red><i>version</i></red>."</b></pre></li>

	<li>Tagging
	<pre><b>$ git tag -a -m "Tagging upstream version <red><i>version</i></red>." upstream/<red><i>version</i></red></b></pre></li>

	<li>Upstream tarball
	<pre><b>$ pristine-tar commit -m "Adding pristine-tar version <red>version</red>." ../<red><i>package</i></red>_<red><i>version</i></red>.orig.tar.gz</b></pre></li>

	<li>Make sure that you are on the debian branch
	<pre><b>$ git checkout debian</b></pre></li>

	<li>Merging
	<pre><b>$ git cherry-pick -n upstream
$ git commit -a -m "Merging upstream version <red><i>version</i></red></b>."</pre></li>

	<li>Pushing
	<pre><b>$ git push

$ git push --tags</b></pre></li>
</ul>

<h3><a name="release">4.4 Releasing new Debian version</a></h3>

<ul>
	<li>Creating changelog
	<pre><b>$ git-dch --debian-branch debian --release --since <red><i>HASH</i></red></b></pre></li>

	<li>Releasing
	<pre><b>$ git commit -a -m "Releasing debian version <red><i>version</i></red>-<red><i>revision</i></red>."</b></pre></li>

	<li>Tagging
	<pre><b>$ git tag -a -m "Tagging debian version <red><i>version</i></red>-<red><i>revision</i></red>." debian/<red><i>version</i></red>-<red><i>revision</i></red></b></pre></li>

	<li>Pushing
	<pre><b>$ git push
$ git push --tags</b></pre></li>

	<li>Upstream tarball
	<pre><b>$ pristine-tar checkout <red><i>package</i></red>_<red><i>version</i></red>.orig.tar.gz</b></pre></li>

	<li>Build in chroot and upload to ftp-master as usual.</li>
</ul>

<div class="right">
	<a href="#toc">^</a>
</div>

<hr />

</body>

</div>

</html>