GitPackaging » Historique » Version 39
Daniel Dehennin, 12/04/2012 10:48
Lien vers le packaging debian pour EOLE
1 | 6 | Daniel Dehennin | {{toc}} |
---|---|---|---|
2 | 6 | Daniel Dehennin | |
3 | 26 | Daniel Dehennin | h1. Séparation du code et du packaging |
4 | 17 | Daniel Dehennin | |
5 | 17 | Daniel Dehennin | Cela facilite le travail de tout le monde, aussi bien des développeurs que des packageurs. |
6 | 1 | Daniel Dehennin | |
7 | 1 | Daniel Dehennin | De plus, il est ainsi plus facile de fournir le même code pour plusieurs distributions différentes, cela sera utile notamment lors du portage des applications sur "Precise Pangolin":http://fr.wikipedia.org/wiki/Liste_des_versions_d%27Ubuntu#Ubuntu_12.04_LTS_.28Precise_Pangolin.29 |
8 | 17 | Daniel Dehennin | |
9 | 26 | Daniel Dehennin | Le principe de base est le suivant : |
10 | 26 | Daniel Dehennin | * Tout ce qui est du ressort du packaging, c’est à dire tous les fichiers présents dans le répertoire @debian/@ pour les "paquets deb":http://fr.wikipedia.org/wiki/Deb, sont et doivent être modifiés dans la branche @dist/<VENDOR>/<DISTRIBUTION>/master@ |
11 | 26 | Daniel Dehennin | * Tout le reste, c’est à dire le code, par exemple les dictionnaires, templates, scripts, agents zéphir, sont dans la branche publique adéquat, c’est a dire @master@ pour le code en développement, @2.2@ pour le code spécifique à la version @2.2@ d’EOLE. |
12 | 1 | Daniel Dehennin | |
13 | 26 | Daniel Dehennin | Le workflow de base est le suivant: |
14 | 26 | Daniel Dehennin | # Je code dans une branche personnelle, par exemple @dad/mise-au-propre-du-makefile@ |
15 | 26 | Daniel Dehennin | # Je teste, cela va de soi ;-) |
16 | 26 | Daniel Dehennin | # Je [[GitBonnesPratiques#Publication-du-développement|publie dans la branche publique]] |
17 | 26 | Daniel Dehennin | # J’intègre ces modifications à la branche de packaging afin de compiler un nouveau paquet |
18 | 1 | Daniel Dehennin | |
19 | 26 | Daniel Dehennin | h2. Le développement dans @master@ |
20 | 1 | Daniel Dehennin | |
21 | 26 | Daniel Dehennin | Les développeurs gèrent cette branche [[GitBonnesPratiques|comme bon leur semble]], ils ne seront pas gênés par le packaging, en particulier les changements sur @debian/changelog@ à chaque compilation de paquet. |
22 | 1 | Daniel Dehennin | |
23 | 32 | Daniel Dehennin | Les règles habituellement admises dans le monde du logiciel libre sur l’installation sont conseillées, par exemple : |
24 | 32 | Daniel Dehennin | |
25 | 32 | Daniel Dehennin | * Écrire un "Makefile":http://fr.wikipedia.org/wiki/Makefile utilisant la variable @$(DEST)@ pour désigner la racine d’installation |
26 | 32 | Daniel Dehennin | * Utiliser les "autotools":http://fr.wikipedia.org/wiki/Autotools pour permettre la configuration des différents répertoires d’installation |
27 | 32 | Daniel Dehennin | |
28 | 32 | Daniel Dehennin | L’idéal, en tant que développeur, peut être de pouvoir cloner la branche master sur une machine de test et de lancer les commandes : |
29 | 32 | Daniel Dehennin | # @make@ : pour compiler ce qui est compilable |
30 | 32 | Daniel Dehennin | # @make install@ : pour installer les fichiers et faire les tests |
31 | 32 | Daniel Dehennin | # @make uninstall@ : pour nettoyer ce qui a été installé |
32 | 32 | Daniel Dehennin | |
33 | 32 | Daniel Dehennin | La branche @master@ étant la branche publique des derniers développements, il est utile d’[[GitTagging|étiqueter]] des états techniques utilisables et/ou à tester. |
34 | 32 | Daniel Dehennin | |
35 | 26 | Daniel Dehennin | h2. Le packaging dans @dist/<VENDOR>/<DISTRIBUTION>/master@ |
36 | 26 | Daniel Dehennin | |
37 | 30 | Daniel Dehennin | Le packaging se compose de deux parties : |
38 | 26 | Daniel Dehennin | # Le code dit « upstream » |
39 | 26 | Daniel Dehennin | # Le code permettant de « faire le paquet », c’est à dire le contenu du répertoire @debian/@ pour les "paquets deb":http://fr.wikipedia.org/wiki/Deb. |
40 | 26 | Daniel Dehennin | |
41 | 29 | Daniel Dehennin | h3. La première fois, c’est toujours la plus difficile |
42 | 26 | Daniel Dehennin | |
43 | 31 | Daniel Dehennin | Un outil est disponible pour préparer le packaging d’un logiciel: "dh-make":http://packages.qa.debian.org/d/dh-make.html, son utilisation est plutôt simple. |
44 | 1 | Daniel Dehennin | |
45 | 31 | Daniel Dehennin | # On récupère un projet : |
46 | 31 | Daniel Dehennin | <pre> |
47 | 31 | Daniel Dehennin | buildd@build:~/src/$ git clone http://dev-eole.ac-dijon.fr/git/eole-debsums && cd eole-debsums |
48 | 31 | Daniel Dehennin | </pre> |
49 | 31 | Daniel Dehennin | # On créé une branche de packaging : |
50 | 31 | Daniel Dehennin | <pre> |
51 | 31 | Daniel Dehennin | buildd@build:~/src/eole-debsums(master)$ git checkout -b dist/ubuntu/lucid/master |
52 | 31 | Daniel Dehennin | </pre> |
53 | 31 | Daniel Dehennin | # On créer un packaging de base : |
54 | 31 | Daniel Dehennin | <pre> |
55 | 31 | Daniel Dehennin | buildd@build:~/src/eole-debsums(dist/ubuntu/lucid/master)$ dh_make -c <LICENCE> -p eole-debsums_<VERSION> --createorig |
56 | 31 | Daniel Dehennin | [...] # Répondre aux questions |
57 | 31 | Daniel Dehennin | </pre> |
58 | 31 | Daniel Dehennin | # On ajoute ce packaging au "stagging area":http://progit.org/book/fr/ch2-2.html |
59 | 31 | Daniel Dehennin | <pre> |
60 | 31 | Daniel Dehennin | buildd@build:~/src/eole-debsums(dist/ubuntu/lucid/master)$ git add debian |
61 | 31 | Daniel Dehennin | </pre> |
62 | 31 | Daniel Dehennin | # On commit ce premier packaging, cela fait un point de départ même s’il n’est pas utilisable |
63 | 31 | Daniel Dehennin | <pre> |
64 | 31 | Daniel Dehennin | buildd@build:~/src/eole-debsums(dist/ubuntu/lucid/master)$ git commit -m "Debianisation du projet par dh_make" # Ne pas utiliser -m et faire un vrai message de log |
65 | 31 | Daniel Dehennin | </pre> |
66 | 1 | Daniel Dehennin | |
67 | 31 | Daniel Dehennin | À partir de là il faut éditer les fichiers présents dans le répertoire @debian/@, principalement : |
68 | 31 | Daniel Dehennin | * @debian/control@ : |
69 | 31 | Daniel Dehennin | ** Faire attention au mainteneur ; |
70 | 31 | Daniel Dehennin | ** Faire attention à l’architecture cible : "any" pour des binaires (i386/amd64), "all" pour les paquets indépendant de l’architecture matérielle (documentation, scripts perl, …) |
71 | 31 | Daniel Dehennin | ** Faire attention à la version de la "Debian policy":http://www.debian.org/doc/debian-policy utilisée, 3.8.2 sur Lucid ; |
72 | 31 | Daniel Dehennin | ** Faire attention à la version de debhelper, @>= 7.4@ sur Lucid ; |
73 | 31 | Daniel Dehennin | ** Mettre une description, courte et longe, les métas paquets "doivent":http://lintian.debian.org/tags/empty-binary-package.html utiliser une des expressions "metapackage," "dummy," "dependency package," "empty package," ou "virtual package" dans la description longue |
74 | 31 | Daniel Dehennin | * @debian/compat@ : utiliser 7 pour Lucid |
75 | 31 | Daniel Dehennin | * @debian/copyright@. |
76 | 31 | Daniel Dehennin | |
77 | 31 | Daniel Dehennin | Supprimer l’extention @.ex@ ou @.EX@ des fichiers qui seront utiles et les modifier. |
78 | 31 | Daniel Dehennin | |
79 | 37 | Daniel Dehennin | Des informations sur le packaging sont disponible dans la "documentation Debian":http://www.debian.org/doc/devel-manuals |
80 | 37 | Daniel Dehennin | |
81 | 37 | Daniel Dehennin | # On commence par une "introduction au packaging":http://www.debian.org/doc/devel-manuals#packaging-tutorial |
82 | 37 | Daniel Dehennin | # La "politique Debian":http://www.debian.org/doc/devel-manuals#policy est la référence sur les obligations que doivent suivre les paquets Debian |
83 | 37 | Daniel Dehennin | # Un chapitre sur les "meilleurs pratiques de packaging":http://www.debian.org/doc/manuals/developers-reference/best-pkging-practices.fr.html est disponible dans la "Référence du développeur Debian":http://www.debian.org/doc/manuals/developers-reference/index.fr.html |
84 | 37 | Daniel Dehennin | |
85 | 39 | Daniel Dehennin | Nous fournissons aussi un petit [[EoleDebianPackaging|recueil de packaging EOLE]] |
86 | 37 | Daniel Dehennin | |
87 | 31 | Daniel Dehennin | h3. Mise à jour du packaging |
88 | 31 | Daniel Dehennin | |
89 | 31 | Daniel Dehennin | La mise à jour du packaging ne requiert pas grand chose par rapport à la création d’un nouveau paquet: |
90 | 26 | Daniel Dehennin | # On se place dans la branche de packaging voulu |
91 | 26 | Daniel Dehennin | # On modifie les fichiers dans le répertoire @debian/@ en fonction des besoins |
92 | 26 | Daniel Dehennin | # On publie ces modifications |
93 | 26 | Daniel Dehennin | # On compile un paquet, ou pas |
94 | 26 | Daniel Dehennin | |
95 | 26 | Daniel Dehennin | h3. Nouveau paquet, sans modification du packaging |
96 | 26 | Daniel Dehennin | |
97 | 20 | Daniel Dehennin | Afin de faire un paquet, il faut intégrer la branche de développement souhaitée, par exemple: |
98 | 20 | Daniel Dehennin | |
99 | 20 | Daniel Dehennin | # On passe sur la branche de packaging : |
100 | 20 | Daniel Dehennin | <pre>buildd@build:~/src/eole-debsums(master)$ git checkout dist/ubuntu/lucid/master</pre> |
101 | 1 | Daniel Dehennin | # On intègre les modifications faites par les autres (et eolepack) : |
102 | 1 | Daniel Dehennin | <pre>buildd@build:~/src/eole-debsums(dist/ubuntu/lucid/master)$ git pull</pre> |
103 | 20 | Daniel Dehennin | # On intègre nos modifications : |
104 | 21 | Daniel Dehennin | <pre>buildd@build:~/src/eole-debsums(dist/ubuntu/lucid/master)$ git merge master</pre> |
105 | 20 | Daniel Dehennin | # On envoi sur le dépôt central pour eolepack : |
106 | 20 | Daniel Dehennin | <pre>buildd@build:~/src/eole-debsums(dist/ubuntu/lucid/master)$ git push</pre> |
107 | 20 | Daniel Dehennin | # On se replace sur la branche de développement pour nos futures modifications |
108 | 18 | Daniel Dehennin | <pre>buildd@build:~/src/eole-debsums(dist/ubuntu/lucid/master)$ git checkout master</pre> |
109 | 26 | Daniel Dehennin | # On compile un nouveau paquet, ou pas |
110 | 17 | Daniel Dehennin | |
111 | 26 | Daniel Dehennin | NB: La branche par défaut dans eolepack est modifiée pour être @dist/ubuntu/lucid/master@. |
112 | 24 | Daniel Dehennin | |
113 | 23 | Daniel Dehennin | h4. Aide à la console (aka helper bash) |
114 | 23 | Daniel Dehennin | |
115 | 22 | Daniel Dehennin | Un petit script @bash@ (attachment:git-package) peut-être utilisé afin d’automatiser la procédure, il suffit de le mettre dans un répertoire du @PATH@, comme @/usr/local/bin@ et il sera pris automatiquement en compte par git: |
116 | 22 | Daniel Dehennin | |
117 | 1 | Daniel Dehennin | <pre> |
118 | 22 | Daniel Dehennin | buildd@build:~/src/eole-debsums(master)$ git package lucid |
119 | 1 | Daniel Dehennin | Do you want to merge 'master' into 'dist/ubuntu/lucid/master'?: y |
120 | 25 | Daniel Dehennin | Checkout 'lucid' master distribution branch 'dist/ubuntu/lucid/master': Switched to branch 'dist/ubuntu/lucid/master' |
121 | 25 | Daniel Dehennin | Pull from default remote: Already up-to-date. |
122 | 25 | Daniel Dehennin | Merge developpement from 'master': Already up-to-date. |
123 | 25 | Daniel Dehennin | Switch back to your developpement branch 'master'... Switched to branch 'master' |
124 | 22 | Daniel Dehennin | Push is not automatically done to avoid publishing possible errors. |
125 | 22 | Daniel Dehennin | buildd@build:~/src/eole-debsums(master)$ |
126 | 22 | Daniel Dehennin | </pre> |
127 | 22 | Daniel Dehennin | |
128 | 27 | Daniel Dehennin | Et comme c’est connu que les informaticiens sont fainéants (enfin seulement les bons ;-)), il est possible de saisir encore moins de caractères en se faisant un alias dans git (pas nécessaire de le faire dans le shell): |
129 | 27 | Daniel Dehennin | <pre> |
130 | 28 | Daniel Dehennin | buildd@build:~/src/eole-debsums(master)$ git config --global alias.lucid 'package lucid' |
131 | 27 | Daniel Dehennin | </pre> |
132 | 27 | Daniel Dehennin | |
133 | 27 | Daniel Dehennin | Ensuite, il n’y a plus qu’a l’utiliser: |
134 | 27 | Daniel Dehennin | <pre> |
135 | 27 | Daniel Dehennin | buildd@build:~/src/eole-debsums(master)$ git lucid |
136 | 27 | Daniel Dehennin | Do you want to merge 'master' into 'dist/ubuntu/lucid/master'?: y |
137 | 27 | Daniel Dehennin | Checkout 'lucid' master distribution branch 'dist/ubuntu/lucid/master': Switched to branch 'dist/ubuntu/lucid/master' |
138 | 27 | Daniel Dehennin | Pull from default remote: Already up-to-date. |
139 | 27 | Daniel Dehennin | Merge developpement from 'master': Already up-to-date. |
140 | 27 | Daniel Dehennin | Switch back to your developpement branch 'master'... Switched to branch 'master' |
141 | 27 | Daniel Dehennin | Push is not automatically done to avoid publishing possible errors. |
142 | 27 | Daniel Dehennin | buildd@build:~/src/eole-debsums(master)$ |
143 | 27 | Daniel Dehennin | </pre> |
144 | 27 | Daniel Dehennin | |
145 | 36 | Daniel Dehennin | Si plus d’une branche contiennent le nom @lucid@, alors vous devez spécifier un nom plus long, par exemple: |
146 | 36 | Daniel Dehennin | <pre> |
147 | 36 | Daniel Dehennin | buildd@build:~/src/eole-debsums(master)$ git lucid |
148 | 36 | Daniel Dehennin | Error: More than one branch match 'lucid': |
149 | 36 | Daniel Dehennin | dist/ubuntu/lucid/master |
150 | 36 | Daniel Dehennin | dist/ubuntu/lucid/test |
151 | 36 | Daniel Dehennin | |
152 | 36 | Daniel Dehennin | You should try adding a discriminent part. |
153 | 36 | Daniel Dehennin | For example: git package lucid/master |
154 | 36 | Daniel Dehennin | </pre> |
155 | 36 | Daniel Dehennin | |
156 | 36 | Daniel Dehennin | Vous devez spécifier le discriminant que vous souhaitez: |
157 | 36 | Daniel Dehennin | <pre> |
158 | 36 | Daniel Dehennin | buildd@build:~/src/eole-debsums(master)$ git lucid/test |
159 | 36 | Daniel Dehennin | Do you want to merge 'master' into 'dist/ubuntu/lucid/test'?: y |
160 | 36 | Daniel Dehennin | Checkout 'lucid/test' master distribution branch 'dist/ubuntu/lucid/test': Switched to branch 'dist/ubuntu/lucid/test' |
161 | 36 | Daniel Dehennin | Pull from default remote: Already up-to-date. |
162 | 36 | Daniel Dehennin | Merge developpement from 'master': Already up-to-date. |
163 | 36 | Daniel Dehennin | Switch back to your developpement branch 'master'... Switched to branch 'master' |
164 | 36 | Daniel Dehennin | Push is not automatically done to avoid publishing possible errors. |
165 | 36 | Daniel Dehennin | </pre> |
166 | 36 | Daniel Dehennin | Vous pouvez spécifier à @git@ que vous souhaitez avoir des couleurs à l’affichage lorsque cela est possible en le configurant de la sorte: |
167 | 36 | Daniel Dehennin | <pre> |
168 | 36 | Daniel Dehennin | buildd@build:~/$ git config --global color.interactive auto |
169 | 36 | Daniel Dehennin | </pre> |
170 | 36 | Daniel Dehennin | |
171 | 26 | Daniel Dehennin | h1. Environnement de compilation personnel |
172 | 2 | Daniel Dehennin | |
173 | 2 | Daniel Dehennin | Il existe plusieurs outils afin de mettre en place des environnements de compilation personnels. |
174 | 15 | Daniel Dehennin | |
175 | 2 | Daniel Dehennin | L’outil utilisé dans le projet "Debian":http://www.debian.org se nomme "sbuild":http://wiki.debian.org/sbuild. |
176 | 1 | Daniel Dehennin | |
177 | 17 | Daniel Dehennin | Ce système peut se reposer sur un système de snapshot : on installe un système de base, propre, et la compilation se fait dans un snapshot temporaire de ce système. |
178 | 2 | Daniel Dehennin | |
179 | 1 | Daniel Dehennin | Cela permet de lancer des compilations en parallèles au besoin. |
180 | 2 | Daniel Dehennin | |
181 | 35 | Daniel Dehennin | Deux méthodes sont utilisables pour la mise en place des schroots avec snapshots : |
182 | 14 | Daniel Dehennin | |
183 | 14 | Daniel Dehennin | * [[eole:GitPackagingSbuildLVM|avec LVM]] |
184 | 1 | Daniel Dehennin | * [[eole:GitPackagingSbuildBtrfs|avec le système de fichier btrfs]] |
185 | 14 | Daniel Dehennin | |
186 | 14 | Daniel Dehennin | |
187 | 33 | Daniel Dehennin | Lorsque les schroots sont en place et sbuild configuré par l’une des méthodes ci-dessus, la compilation d’un paquet peut se dérouler comme suit : |
188 | 14 | Daniel Dehennin | |
189 | 14 | Daniel Dehennin | <pre> |
190 | 3 | Daniel Dehennin | buildd@build:~/src$ sudo apt-get install git-core git-buildpackage fakeroot build-essential debhelper cdbs |
191 | 16 | Daniel Dehennin | buildd@build:~/src$ git clone http://dev-eole.ac-dijon.fr/git/eole-debsums |
192 | 16 | Daniel Dehennin | buildd@build:~/src$ cd eole-debsums |
193 | 16 | Daniel Dehennin | buildd@build:~/src/eole-debsums$ git checkout -b dist/ubuntu/lucid/build origin/dist/ubuntu/lucid/master |
194 | 16 | Daniel Dehennin | buildd@build:~/src/eole-debsums$ git buildpackage --git-builder="sbuild -A -d eole-2.3-dev" --git-cleaner=/bin/true |
195 | 16 | Daniel Dehennin | </pre> |
196 | 16 | Daniel Dehennin | |
197 | 16 | Daniel Dehennin | Ou si on souhaite minimiser les paquets à installer: |
198 | 16 | Daniel Dehennin | |
199 | 16 | Daniel Dehennin | <pre> |
200 | 16 | Daniel Dehennin | buildd@build:~/src$ sudo apt-get install git-core git-buildpackage dpkg-dev |
201 | 16 | Daniel Dehennin | buildd@build:~/src$ git clone http://dev-eole.ac-dijon.fr/git/eole-debsums |
202 | 16 | Daniel Dehennin | buildd@build:~/src$ cd eole-debsums |
203 | 16 | Daniel Dehennin | buildd@build:~/src/eole-debsums$ git checkout -b dist/ubuntu/lucid/build origin/dist/ubuntu/lucid/master |
204 | 16 | Daniel Dehennin | buildd@build:~/src/eole-debsums$ git buildpackage --git-builder="dpkg-buildpackage -nc -d -S" --git-cleaner=/bin/true |
205 | 16 | Daniel Dehennin | buildd@build:~/src/eole-debsums$ sbuild -A -d eole-2.3-dev ../eole-debsums_20111207-eole1.dsc |
206 | 16 | Daniel Dehennin | </pre> |
207 | 16 | Daniel Dehennin | |
208 | 13 | Daniel Dehennin | h1. Webographie |
209 | 7 | Daniel Dehennin | |
210 | 38 | Daniel Dehennin | * La "politique Debian":http://www.debian.org/doc/devel-manuals#policy |
211 | 38 | Daniel Dehennin | * Une "introduction au packaging":http://www.debian.org/doc/devel-manuals#packaging-tutorial |
212 | 38 | Daniel Dehennin | * Les "meilleurs pratiques de packaging":http://www.debian.org/doc/manuals/developers-reference/best-pkging-practices.fr.html |
213 | 38 | Daniel Dehennin | * La "Référence du développeur Debian":http://www.debian.org/doc/manuals/developers-reference/index.fr.html |
214 | 38 | Daniel Dehennin | * La "documentation développeur Debian":http://www.debian.org/doc/devel-manuals |
215 | 11 | Daniel Dehennin | * "PackagingGuide/Python":https://wiki.ubuntu.com/PackagingGuide/Python |