Projet

Général

Profil

EoleDebianPackaging24 » Historique » Version 24

Gérald Schwartzmann, 13/06/2013 15:23

1 1 Daniel Dehennin
{{toc}}
2 1 Daniel Dehennin
3 1 Daniel Dehennin
h1. Debian packaging pour EOLE 2.4
4 1 Daniel Dehennin
5 1 Daniel Dehennin
h2. Introduction
6 1 Daniel Dehennin
7 1 Daniel Dehennin
Nous ne décrirons pas ici comment créer un paquet debian, mais
8 1 Daniel Dehennin
quelques règles utiles lors de la création d’un paquet debian pour
9 1 Daniel Dehennin
EOLE.
10 1 Daniel Dehennin
11 1 Daniel Dehennin
La principale cible de cette documentation est le packaging pour Ubuntu Precise Pangolin.
12 1 Daniel Dehennin
13 16 Daniel Dehennin
Le nouveau système de build des paquets apporte plus de souplesse :
14 16 Daniel Dehennin
15 16 Daniel Dehennin
* Possibilité de builder des paquets pour des architectures autre que _i386_ et _all_
16 17 Benjamin Bohard
* Utilisation du système de build pour construire des paquets de correctif pour les versions stables (plus besoin de télécharger l’ancien paquet, appliquer un patch, incrémenter le numéro de version et compiler à la main)
17 16 Daniel Dehennin
* Choix de la politique de numérotation des paquets
18 16 Daniel Dehennin
19 12 Daniel Dehennin
h2. debian/changelog
20 12 Daniel Dehennin
21 15 Benjamin Bohard
La grande nouveauté du système de build pour EOLE 2.4 est l’absence de fichier @debian/changelog@ dans la branche de packaging.
22 12 Daniel Dehennin
23 12 Daniel Dehennin
Ce dernier n’est créé et mis à jour que par le système de build lui-même et n’est jamais directement accessible aux développeurs/packageurs.
24 1 Daniel Dehennin
25 16 Daniel Dehennin
h3. Numérotation des paquets
26 1 Daniel Dehennin
27 16 Daniel Dehennin
L’absence du @debian/changelog@ impose une chose pour le premier paquet construit :
28 16 Daniel Dehennin
29 12 Daniel Dehennin
# Le premier paquet généré ne peut pas connaître son numéro de version par @debian/changelog@, il faut donc utiliser les mécanismes de "git-buildpackage":http://honk.sigxcpu.org/projects/git-buildpackage/manual-html/gbp.man.git.dch.html et se reposer sur l’utilisation de "tag":http://gitimmersion.fr/lab_13.html pour déclarer les versions @upstream@
30 12 Daniel Dehennin
31 15 Benjamin Bohard
Le moyen mnémotechnique pour s’en souvenir est de connaître la forme d’un "numéro de paquet Debian":http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version:
32 12 Daniel Dehennin
33 12 Daniel Dehennin
<pre>
34 12 Daniel Dehennin
<UPSTREAM VERSION>-<DEBIAN PACKAGE RELEASE>
35 12 Daniel Dehennin
</pre>
36 12 Daniel Dehennin
37 12 Daniel Dehennin
* Toute modification du code nécessite une modification de la partie *@<UPSTREAM VERSION>@* ;
38 12 Daniel Dehennin
* Toute modification sur la branche de packaging qui n’implique aucun @merge@ de la branche @upstream@ (@master@ chez EOLE), modifie la partie *@<DEBIAN PACKAGE RELEASE>@*.
39 12 Daniel Dehennin
40 1 Daniel Dehennin
En français on pourrait le décrire par: on publie la version *@<DEBIAN PACKAGE RELEASE>@* du paquet debian de la version *@<UPSTREAM VERSION>@* du logiciel.
41 1 Daniel Dehennin
42 16 Daniel Dehennin
h2. debian/source/format
43 16 Daniel Dehennin
44 17 Benjamin Bohard
La valeur de ce paramètre découle des réponses à ces trois questions :
45 16 Daniel Dehennin
46 16 Daniel Dehennin
# Qui a la responsabilité de l’incrémentation du numéro de version ;
47 16 Daniel Dehennin
# Est-il permis que la branche dite @upstream@ (chez EOLE, la branche @master@) soit vide ;
48 16 Daniel Dehennin
# Est-il possible qu’entre deux paquets debian, il y ait des modifications de fichiers en dehors du répertoire @debian/@ sans nouveau tag de version @upstream@.
49 16 Daniel Dehennin
50 16 Daniel Dehennin
h3. Il est interdit de modifier les sources dans le packaging
51 16 Daniel Dehennin
52 16 Daniel Dehennin
Cela s’applique, chez Debian, aux paquets de logiciels « externes ».
53 16 Daniel Dehennin
54 17 Benjamin Bohard
Le paquet Debian ne doit pas contenir de modification du code source (tout ce qui est en dehors du répertoire @debian/@), sans qu’il y ait eu un nouveau numéro de version par les développeurs @upstream@.
55 16 Daniel Dehennin
La seul possibilité pour adapter le code source à la distribution est de faire un patch et de le disposer dans le répertoire @debian/patches/@.
56 16 Daniel Dehennin
57 16 Daniel Dehennin
Cas d’utilisation typique:
58 16 Daniel Dehennin
59 16 Daniel Dehennin
<pre>
60 16 Daniel Dehennin
# Mise à jour upstream
61 16 Daniel Dehennin
user:~/src/paquet (master)$ $EDITOR source_file.txt
62 16 Daniel Dehennin
user:~/src/paquet (master)$ git add source_file.txt
63 16 Daniel Dehennin
user:~/src/paquet (master)$ git commit -m "New source file"
64 16 Daniel Dehennin
user:~/src/paquet (master)$ git tag -s -m "New release 1.6" release/1.6
65 16 Daniel Dehennin
user:~/src/paquet (master)$ git push origin master release/1.6
66 16 Daniel Dehennin
67 16 Daniel Dehennin
# Mise à jour du packaging
68 16 Daniel Dehennin
user:~/src/paquet (master)$ git checkout dist/ubuntu/precise/master
69 16 Daniel Dehennin
user:~/src/paquet (dist/ubuntu/precise/master)$ git merge -m "New upstream release" release/1.6
70 16 Daniel Dehennin
user:~/src/paquet (dist/ubuntu/precise/master)$ $EDITOR debian/control # Par exemple mise à jour des dépendences
71 16 Daniel Dehennin
user:~/src/paquet (dist/ubuntu/precise/master)$ git add debian/conrol
72 16 Daniel Dehennin
user:~/src/paquet (dist/ubuntu/precise/master)$ git commit -m "Update of dependencies"
73 16 Daniel Dehennin
user:~/src/paquet (dist/ubuntu/precise/master)$ git tag -s -m "New build request for experimental" build/eole/eole-2.4-experimental
74 16 Daniel Dehennin
user:~/src/paquet (dist/ubuntu/precise/master)$ git push origin build/eole/eole-2.4-experimental
75 16 Daniel Dehennin
# Produit un paquet numéroté 1.6-1~1.gbpXXXX
76 16 Daniel Dehennin
77 16 Daniel Dehennin
# TOUT EST OK, on sort un nouveau paquet.
78 16 Daniel Dehennin
user:~/src/paquet (dist/ubuntu/precise/master)$ git tag -s -m "New build request for unstable" build/eole/eole-2.4-unstable
79 16 Daniel Dehennin
user:~/src/paquet (dist/ubuntu/precise/master)$ git push origin build/eole/eole-2.4-unstable
80 16 Daniel Dehennin
# Produit un paquet numéroté 1.6-1
81 16 Daniel Dehennin
</pre>
82 16 Daniel Dehennin
83 16 Daniel Dehennin
Les builds successifs de paquet sans merge d’une nouvelle version @upstream@
84 16 Daniel Dehennin
85 16 Daniel Dehennin
* @1.6-2@ pour le second build qui ne doit corriger que des erreurs de packaging ou avoir un patch pour @upstream@ dans @debian/patches@ ;
86 16 Daniel Dehennin
* @1.6-3@ pour le troisième build qui ne doit corriger que des erreurs de packaging ou avoir un patch pour @upstream@ dans @debian/patches@ ;
87 16 Daniel Dehennin
88 16 Daniel Dehennin
Ce comportement est celui part défaut avec la valeur de @debian/source/format@ :
89 16 Daniel Dehennin
90 16 Daniel Dehennin
<pre>
91 16 Daniel Dehennin
3.0 (quilt)
92 16 Daniel Dehennin
</pre>
93 16 Daniel Dehennin
94 16 Daniel Dehennin
h3. Il est possible de modifier les sources dans le packaging ou il n’y a pas de sources upstream
95 16 Daniel Dehennin
96 16 Daniel Dehennin
Les modifications de code source sont autorisées sur la branche de packaging sans nouveau tag upstream.
97 17 Benjamin Bohard
La branche upstream peut être complètement vide (cas des métapaquets de dépendances @*-pkg@)
98 16 Daniel Dehennin
99 16 Daniel Dehennin
Cas d’utilisation typique:
100 16 Daniel Dehennin
101 16 Daniel Dehennin
<pre>
102 16 Daniel Dehennin
# Premier tag upstream pour créer le fichier debian/changelog automatiquement
103 16 Daniel Dehennin
user:~/src/paquet (master)$ git tag -s -m "First release 1.0" release/1.0
104 16 Daniel Dehennin
105 16 Daniel Dehennin
# Premier paquet
106 16 Daniel Dehennin
user:~/src/paquet (master)$ git checkout -b dist/ubuntu/precise/master
107 16 Daniel Dehennin
user:~/src/paquet (dist/ubuntu/precise/master)$  $EDITOR debian/* # Création du packaging
108 16 Daniel Dehennin
user:~/src/paquet (dist/ubuntu/precise/master)$ git add debian/conrol
109 16 Daniel Dehennin
user:~/src/paquet (dist/ubuntu/precise/master)$ git commit -m "First package"
110 16 Daniel Dehennin
user:~/src/paquet (dist/ubuntu/precise/master)$ git tag -s -m "New build request for experimental" build/eole/eole-2.4-experimental
111 16 Daniel Dehennin
# Produit un paquet numéroté 1.6-1~1.gbpXXXX
112 16 Daniel Dehennin
113 16 Daniel Dehennin
# TOUT EST OK, on sort un nouveau paquet.
114 16 Daniel Dehennin
user:~/src/paquet (dist/ubuntu/precise/master)$ git tag -s -m "New build request for unstable" build/eole/eole-2.4-unstable
115 16 Daniel Dehennin
user:~/src/paquet (dist/ubuntu/precise/master)$ git push origin build/eole/eole-2.4-unstable
116 16 Daniel Dehennin
# Produit un paquet numéroté 1.6-1
117 16 Daniel Dehennin
118 16 Daniel Dehennin
# Mise à jour upstream
119 16 Daniel Dehennin
user:~/src/paquet (master)$ $EDITOR source_file.txt
120 16 Daniel Dehennin
user:~/src/paquet (master)$ git add source_file.txt
121 16 Daniel Dehennin
user:~/src/paquet (master)$ git commit -m "New source file"
122 16 Daniel Dehennin
user:~/src/paquet (master)$ git push origin master
123 16 Daniel Dehennin
124 16 Daniel Dehennin
# Mise à jour du packaging
125 16 Daniel Dehennin
user:~/src/paquet (master)$ git checkout dist/ubuntu/precise/master
126 16 Daniel Dehennin
user:~/src/paquet (dist/ubuntu/precise/master)$ git merge -m "New upstream release" master
127 16 Daniel Dehennin
user:~/src/paquet (dist/ubuntu/precise/master)$ $EDITOR debian/control # Par exemple mise à jour des dépendences
128 16 Daniel Dehennin
user:~/src/paquet (dist/ubuntu/precise/master)$ git add debian/conrol
129 16 Daniel Dehennin
user:~/src/paquet (dist/ubuntu/precise/master)$ git commit -m "Update of dependencies"
130 16 Daniel Dehennin
user:~/src/paquet (dist/ubuntu/precise/master)$ git tag -s -m "New build request for experimental" build/eole/eole-2.4-experimental
131 16 Daniel Dehennin
user:~/src/paquet (dist/ubuntu/precise/master)$ git push origin build/eole/eole-2.4-experimental
132 16 Daniel Dehennin
# Produit un paquet numéroté 1.6-2~1.gbpXXXX
133 16 Daniel Dehennin
134 16 Daniel Dehennin
# TOUT EST OK, on sort un nouveau paquet.
135 16 Daniel Dehennin
user:~/src/paquet (dist/ubuntu/precise/master)$ git tag -s -m "New build request for unstable" build/eole/eole-2.4-unstable
136 16 Daniel Dehennin
user:~/src/paquet (dist/ubuntu/precise/master)$ git push origin build/eole/eole-2.4-unstable
137 16 Daniel Dehennin
# Produit un paquet numéroté 1.6-2
138 16 Daniel Dehennin
</pre>
139 16 Daniel Dehennin
140 16 Daniel Dehennin
Ce comportement est possible avec la valeur de @debian/source/format@ :
141 16 Daniel Dehennin
142 16 Daniel Dehennin
<pre>
143 16 Daniel Dehennin
3.0 (native)
144 16 Daniel Dehennin
</pre>
145 16 Daniel Dehennin
146 1 Daniel Dehennin
h2. debian/control
147 4 Benjamin Bohard
148 1 Daniel Dehennin
<pre>
149 1 Daniel Dehennin
Source: <package>
150 1 Daniel Dehennin
Section: <(admin|web|metapackages|...)>
151 1 Daniel Dehennin
Priority: optional
152 1 Daniel Dehennin
Maintainer: Équipe Eole <eole@ac-dijon.fr>
153 1 Daniel Dehennin
Build-Depends: debhelper (>= 9)
154 1 Daniel Dehennin
Standards-Version: 3.9.3
155 1 Daniel Dehennin
Homepage: http://eole.orion.education.fr/diff/
156 1 Daniel Dehennin
Vcs-Git: http://dev-eole.ac-dijon.fr/git/<package>
157 5 Daniel Dehennin
Vcs-Browser: http://dev-eole.ac-dijon.fr/projects/<package>/repository
158 1 Daniel Dehennin
159 1 Daniel Dehennin
Package: <package>
160 1 Daniel Dehennin
Architecture: all
161 1 Daniel Dehennin
Depends: ${misc:Depends}
162 1 Daniel Dehennin
Description: <MAX 72 CHARS>
163 1 Daniel Dehennin
 <DESCRIPTION>
164 1 Daniel Dehennin
 .
165 16 Daniel Dehennin
 <PARAGRAPHE SEPARATED BY DOT>
166 1 Daniel Dehennin
167 19 Daniel Dehennin
Package: <package>-pkg
168 19 Daniel Dehennin
Section: metapackages
169 19 Daniel Dehennin
Architecture: all
170 19 Daniel Dehennin
Depends: <A PACKAGE>,
171 19 Daniel Dehennin
         <ANOTHER PACKAGE>,
172 19 Daniel Dehennin
         ${misc:Depends}
173 19 Daniel Dehennin
Description: <MAX 72 CHARS>
174 19 Daniel Dehennin
 <DESCRIPTION>
175 19 Daniel Dehennin
 .
176 19 Daniel Dehennin
 <PARAGRAPHE SEPARATED BY DOT>
177 19 Daniel Dehennin
178 1 Daniel Dehennin
Package: <package>-doc
179 1 Daniel Dehennin
Architecture: all
180 1 Daniel Dehennin
Description: <MAX 72 CHARS>
181 1 Daniel Dehennin
 <DESCRIPTION>
182 1 Daniel Dehennin
 .
183 1 Daniel Dehennin
 <PARAGRAPHE SEPARATED BY DOT>
184 1 Daniel Dehennin
185 1 Daniel Dehennin
Package: <package>-tests
186 1 Daniel Dehennin
Architecture: all
187 1 Daniel Dehennin
Depends: <package>
188 1 Daniel Dehennin
Description: <MAX 72 CHARS>
189 1 Daniel Dehennin
 <DESCRIPTION>
190 1 Daniel Dehennin
 .
191 1 Daniel Dehennin
 <PARAGRAPHE SEPARATED BY DOT>
192 1 Daniel Dehennin
</pre>
193 19 Daniel Dehennin
194 19 Daniel Dehennin
L’attribut _Section_ défini pour le paquet source est utilisé pour tous les paquets binaires ne définissant pas cet attribut.
195 19 Daniel Dehennin
196 19 Daniel Dehennin
Il est ainsi possible de spécifier qu’un paquet binaire est un méta-paquet (utilisé uniquement pour ces dépendances) en définissant @Section: metapackages@ comme pour @<package>-pkg@ dans l’exemple ci-dessus.
197 1 Daniel Dehennin
198 1 Daniel Dehennin
h3. Paquets sources et binaires python
199 1 Daniel Dehennin
200 16 Daniel Dehennin
Il faut ajouter :
201 1 Daniel Dehennin
202 23 Daniel Dehennin
* @Build-Depends@ du paquet source:
203 23 Daniel Dehennin
** @python-all@ pour les modules pure python
204 23 Daniel Dehennin
** @python-all-dev@ pour les modules nécessitant une compilation C.
205 1 Daniel Dehennin
* @Depends@ du/des paquet(s) binaire(s): @${python:Depends}@
206 1 Daniel Dehennin
207 1 Daniel Dehennin
h2. debian/rules
208 1 Daniel Dehennin
209 1 Daniel Dehennin
h3. Pour tous
210 1 Daniel Dehennin
211 5 Daniel Dehennin
<pre>
212 1 Daniel Dehennin
#!/usr/bin/make -f
213 1 Daniel Dehennin
# -*- makefile -*-
214 1 Daniel Dehennin
# Sample debian/rules that uses debhelper.
215 1 Daniel Dehennin
# This file was originally written by Joey Hess and Craig Small.
216 1 Daniel Dehennin
# As a special exception, when this file is copied by dh-make into a
217 1 Daniel Dehennin
# dh-make output file, you may use that output file without restriction.
218 11 Daniel Dehennin
# This special exception was added by Craig Small in version 0.37 of dh-make.
219 7 Daniel Dehennin
220 8 Daniel Dehennin
# Uncomment this to turn on verbose mode.
221 10 Benjamin Bohard
#export DH_VERBOSE=1
222 15 Benjamin Bohard
223 1 Daniel Dehennin
%:
224 1 Daniel Dehennin
	dh $@
225 1 Daniel Dehennin
</pre>
226 1 Daniel Dehennin
227 1 Daniel Dehennin
h3. Pour paquet python
228 12 Daniel Dehennin
229 1 Daniel Dehennin
<pre>
230 12 Daniel Dehennin
#!/usr/bin/make -f
231 1 Daniel Dehennin
# -*- makefile -*-
232 12 Daniel Dehennin
# Sample debian/rules that uses debhelper.
233 1 Daniel Dehennin
# This file was originally written by Joey Hess and Craig Small.
234 1 Daniel Dehennin
# As a special exception, when this file is copied by dh-make into a
235 14 Daniel Dehennin
# dh-make output file, you may use that output file without restriction.
236 14 Daniel Dehennin
# This special exception was added by Craig Small in version 0.37 of dh-make.
237 1 Daniel Dehennin
238 1 Daniel Dehennin
# Uncomment this to turn on verbose mode.
239 1 Daniel Dehennin
#export DH_VERBOSE=1
240 1 Daniel Dehennin
241 1 Daniel Dehennin
%:
242 15 Benjamin Bohard
	dh $@ --with python2
243 1 Daniel Dehennin
</pre>
244 6 Benjamin Bohard
245 18 Daniel Dehennin
h3. Outrepasser le comportement par défaut des debhelpers
246 18 Daniel Dehennin
247 18 Daniel Dehennin
L’utilisation de la cible implicite @%@ dans le fichier makefile @debian/rules@ ne permet pas de prendre en compte certains cas spécifiques comme passer des options aux commandes @dh_*@.
248 18 Daniel Dehennin
249 18 Daniel Dehennin
Pour outrepasser le comportement par défaut, il faut définir en plus des cibles d’écrasement :
250 18 Daniel Dehennin
251 18 Daniel Dehennin
<pre>
252 18 Daniel Dehennin
override_dh_<COMMAND>:
253 18 Daniel Dehennin
	dh_<COMMAND> --opt1 --opt2
254 18 Daniel Dehennin
255 22 Daniel Dehennin
.PHONY: dh_<COMMAND>
256 18 Daniel Dehennin
</pre>
257 18 Daniel Dehennin
258 18 Daniel Dehennin
Cela permet, par exemple, de nommer un script d’init installé automatiquement différemment du paquet qui le fourni, comme pour project:zephir-client (voir zephir-client:source:debian/rules?rev=dist/ubuntu/lucid/master#L19)
259 18 Daniel Dehennin
260 18 Daniel Dehennin
Plus d’informations sont disponibles dans la "page de manuel de dh":http://manpages.ubuntu.com/manpages/precise/man1/dh.1.html.
261 18 Daniel Dehennin
262 1 Daniel Dehennin
h2. debian/compat
263 1 Daniel Dehennin
264 1 Daniel Dehennin
<pre>
265 1 Daniel Dehennin
9
266 1 Daniel Dehennin
</pre>
267 1 Daniel Dehennin
268 5 Daniel Dehennin
h2. debian/copyright
269 1 Daniel Dehennin
270 1 Daniel Dehennin
<pre>
271 1 Daniel Dehennin
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
272 1 Daniel Dehennin
Upstream-Name: <package
273 1 Daniel Dehennin
Source: <UPSTREAM URL>
274 1 Daniel Dehennin
275 1 Daniel Dehennin
Files: *
276 1 Daniel Dehennin
Copyright: <YEAR1>,<YEAR2>,<YEAR3> <UPSTREAM AUTHOR NAME> <UPSTREAM AUTHOR EMAIL>
277 1 Daniel Dehennin
Copyright: <YEAR1>,<YEAR2>,<YEAR3> <UPSTREAM AUTHOR NAME> <UPSTREAM AUTHOR EMAIL>
278 1 Daniel Dehennin
License: GPL-3+
279 1 Daniel Dehennin
280 1 Daniel Dehennin
Files: debian/*
281 1 Daniel Dehennin
Copyright: <YEAR1>,<YEAR2>,<YEAR3> Équipe EOLE <eole@ac-dijon.fr>
282 21 Daniel Dehennin
License: CeCILL-2
283 1 Daniel Dehennin
284 21 Daniel Dehennin
License: CeCILL-2
285 21 Daniel Dehennin
 This software is governed by the CeCILL-2 license under French law and
286 20 Daniel Dehennin
 abiding by the rules of distribution of free software.  You can  use,
287 21 Daniel Dehennin
 modify and or redistribute the software under the terms of the CeCILL-2
288 20 Daniel Dehennin
 license as circulated by CEA, CNRS and INRIA at the following URL
289 20 Daniel Dehennin
 "http://www.cecill.info";.
290 1 Daniel Dehennin
 .
291 20 Daniel Dehennin
 As a counterpart to the access to the source code and  rights to copy,
292 20 Daniel Dehennin
 modify and redistribute granted by the license, users are provided only
293 20 Daniel Dehennin
 with a limited warranty  and the software's author,  the holder of the
294 20 Daniel Dehennin
 economic rights,  and the successive licensors  have only  limited
295 20 Daniel Dehennin
 liability.
296 1 Daniel Dehennin
 .
297 20 Daniel Dehennin
 In this respect, the user's attention is drawn to the risks associated
298 20 Daniel Dehennin
 with loading,  using,  modifying and/or developing or reproducing the
299 20 Daniel Dehennin
 software by the user in light of its specific status of free software,
300 20 Daniel Dehennin
 that may mean  that it is complicated to manipulate,  and  that  also
301 20 Daniel Dehennin
 therefore means  that it is reserved for developers  and  experienced
302 20 Daniel Dehennin
 professionals having in-depth computer knowledge. Users are therefore
303 20 Daniel Dehennin
 encouraged to load and test the software's suitability as regards their
304 20 Daniel Dehennin
 requirements in conditions enabling the security of their systems and/or
305 20 Daniel Dehennin
 data to be ensured and,  more generally, to use and operate it in the
306 20 Daniel Dehennin
 same conditions as regards security.
307 1 Daniel Dehennin
 .
308 20 Daniel Dehennin
 The fact that you are presently reading this means that you have had
309 21 Daniel Dehennin
 knowledge of the CeCILL-2 license and that you accept its terms.
310 20 Daniel Dehennin
 .
311 24 Gérald Schwartzmann
 On EOLE systems, the complete text of the CeCILL-2 License can be found
312 21 Daniel Dehennin
 in '/usr/share/common-licenses/CeCILL-2-en'.
313 1 Daniel Dehennin
</pre>