GitPackaging » Historique » Version 38
Daniel Dehennin, 28/02/2012 11:13
Ajout des liens dans la webographie
| 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 | 37 | Daniel Dehennin | |
| 86 | 31 | Daniel Dehennin | h3. Mise à jour du packaging |
| 87 | 31 | Daniel Dehennin | |
| 88 | 31 | Daniel Dehennin | La mise à jour du packaging ne requiert pas grand chose par rapport à la création d’un nouveau paquet: |
| 89 | 26 | Daniel Dehennin | # On se place dans la branche de packaging voulu |
| 90 | 26 | Daniel Dehennin | # On modifie les fichiers dans le répertoire @debian/@ en fonction des besoins |
| 91 | 26 | Daniel Dehennin | # On publie ces modifications |
| 92 | 26 | Daniel Dehennin | # On compile un paquet, ou pas |
| 93 | 26 | Daniel Dehennin | |
| 94 | 26 | Daniel Dehennin | h3. Nouveau paquet, sans modification du packaging |
| 95 | 26 | Daniel Dehennin | |
| 96 | 20 | Daniel Dehennin | Afin de faire un paquet, il faut intégrer la branche de développement souhaitée, par exemple: |
| 97 | 20 | Daniel Dehennin | |
| 98 | 20 | Daniel Dehennin | # On passe sur la branche de packaging : |
| 99 | 20 | Daniel Dehennin | <pre>buildd@build:~/src/eole-debsums(master)$ git checkout dist/ubuntu/lucid/master</pre> |
| 100 | 1 | Daniel Dehennin | # On intègre les modifications faites par les autres (et eolepack) : |
| 101 | 1 | Daniel Dehennin | <pre>buildd@build:~/src/eole-debsums(dist/ubuntu/lucid/master)$ git pull</pre> |
| 102 | 20 | Daniel Dehennin | # On intègre nos modifications : |
| 103 | 21 | Daniel Dehennin | <pre>buildd@build:~/src/eole-debsums(dist/ubuntu/lucid/master)$ git merge master</pre> |
| 104 | 20 | Daniel Dehennin | # On envoi sur le dépôt central pour eolepack : |
| 105 | 20 | Daniel Dehennin | <pre>buildd@build:~/src/eole-debsums(dist/ubuntu/lucid/master)$ git push</pre> |
| 106 | 20 | Daniel Dehennin | # On se replace sur la branche de développement pour nos futures modifications |
| 107 | 18 | Daniel Dehennin | <pre>buildd@build:~/src/eole-debsums(dist/ubuntu/lucid/master)$ git checkout master</pre> |
| 108 | 26 | Daniel Dehennin | # On compile un nouveau paquet, ou pas |
| 109 | 17 | Daniel Dehennin | |
| 110 | 26 | Daniel Dehennin | NB: La branche par défaut dans eolepack est modifiée pour être @dist/ubuntu/lucid/master@. |
| 111 | 24 | Daniel Dehennin | |
| 112 | 23 | Daniel Dehennin | h4. Aide à la console (aka helper bash) |
| 113 | 23 | Daniel Dehennin | |
| 114 | 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: |
| 115 | 22 | Daniel Dehennin | |
| 116 | 1 | Daniel Dehennin | <pre> |
| 117 | 22 | Daniel Dehennin | buildd@build:~/src/eole-debsums(master)$ git package lucid |
| 118 | 1 | Daniel Dehennin | Do you want to merge 'master' into 'dist/ubuntu/lucid/master'?: y |
| 119 | 25 | Daniel Dehennin | Checkout 'lucid' master distribution branch 'dist/ubuntu/lucid/master': Switched to branch 'dist/ubuntu/lucid/master' |
| 120 | 25 | Daniel Dehennin | Pull from default remote: Already up-to-date. |
| 121 | 25 | Daniel Dehennin | Merge developpement from 'master': Already up-to-date. |
| 122 | 25 | Daniel Dehennin | Switch back to your developpement branch 'master'... Switched to branch 'master' |
| 123 | 22 | Daniel Dehennin | Push is not automatically done to avoid publishing possible errors. |
| 124 | 22 | Daniel Dehennin | buildd@build:~/src/eole-debsums(master)$ |
| 125 | 22 | Daniel Dehennin | </pre> |
| 126 | 22 | Daniel Dehennin | |
| 127 | 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): |
| 128 | 27 | Daniel Dehennin | <pre> |
| 129 | 28 | Daniel Dehennin | buildd@build:~/src/eole-debsums(master)$ git config --global alias.lucid 'package lucid' |
| 130 | 27 | Daniel Dehennin | </pre> |
| 131 | 27 | Daniel Dehennin | |
| 132 | 27 | Daniel Dehennin | Ensuite, il n’y a plus qu’a l’utiliser: |
| 133 | 27 | Daniel Dehennin | <pre> |
| 134 | 27 | Daniel Dehennin | buildd@build:~/src/eole-debsums(master)$ git lucid |
| 135 | 27 | Daniel Dehennin | Do you want to merge 'master' into 'dist/ubuntu/lucid/master'?: y |
| 136 | 27 | Daniel Dehennin | Checkout 'lucid' master distribution branch 'dist/ubuntu/lucid/master': Switched to branch 'dist/ubuntu/lucid/master' |
| 137 | 27 | Daniel Dehennin | Pull from default remote: Already up-to-date. |
| 138 | 27 | Daniel Dehennin | Merge developpement from 'master': Already up-to-date. |
| 139 | 27 | Daniel Dehennin | Switch back to your developpement branch 'master'... Switched to branch 'master' |
| 140 | 27 | Daniel Dehennin | Push is not automatically done to avoid publishing possible errors. |
| 141 | 27 | Daniel Dehennin | buildd@build:~/src/eole-debsums(master)$ |
| 142 | 27 | Daniel Dehennin | </pre> |
| 143 | 27 | Daniel Dehennin | |
| 144 | 36 | Daniel Dehennin | Si plus d’une branche contiennent le nom @lucid@, alors vous devez spécifier un nom plus long, par exemple: |
| 145 | 36 | Daniel Dehennin | <pre> |
| 146 | 36 | Daniel Dehennin | buildd@build:~/src/eole-debsums(master)$ git lucid |
| 147 | 36 | Daniel Dehennin | Error: More than one branch match 'lucid': |
| 148 | 36 | Daniel Dehennin | dist/ubuntu/lucid/master |
| 149 | 36 | Daniel Dehennin | dist/ubuntu/lucid/test |
| 150 | 36 | Daniel Dehennin | |
| 151 | 36 | Daniel Dehennin | You should try adding a discriminent part. |
| 152 | 36 | Daniel Dehennin | For example: git package lucid/master |
| 153 | 36 | Daniel Dehennin | </pre> |
| 154 | 36 | Daniel Dehennin | |
| 155 | 36 | Daniel Dehennin | Vous devez spécifier le discriminant que vous souhaitez: |
| 156 | 36 | Daniel Dehennin | <pre> |
| 157 | 36 | Daniel Dehennin | buildd@build:~/src/eole-debsums(master)$ git lucid/test |
| 158 | 36 | Daniel Dehennin | Do you want to merge 'master' into 'dist/ubuntu/lucid/test'?: y |
| 159 | 36 | Daniel Dehennin | Checkout 'lucid/test' master distribution branch 'dist/ubuntu/lucid/test': Switched to branch 'dist/ubuntu/lucid/test' |
| 160 | 36 | Daniel Dehennin | Pull from default remote: Already up-to-date. |
| 161 | 36 | Daniel Dehennin | Merge developpement from 'master': Already up-to-date. |
| 162 | 36 | Daniel Dehennin | Switch back to your developpement branch 'master'... Switched to branch 'master' |
| 163 | 36 | Daniel Dehennin | Push is not automatically done to avoid publishing possible errors. |
| 164 | 36 | Daniel Dehennin | </pre> |
| 165 | 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: |
| 166 | 36 | Daniel Dehennin | <pre> |
| 167 | 36 | Daniel Dehennin | buildd@build:~/$ git config --global color.interactive auto |
| 168 | 36 | Daniel Dehennin | </pre> |
| 169 | 36 | Daniel Dehennin | |
| 170 | 26 | Daniel Dehennin | h1. Environnement de compilation personnel |
| 171 | 2 | Daniel Dehennin | |
| 172 | 2 | Daniel Dehennin | Il existe plusieurs outils afin de mettre en place des environnements de compilation personnels. |
| 173 | 15 | Daniel Dehennin | |
| 174 | 2 | Daniel Dehennin | L’outil utilisé dans le projet "Debian":http://www.debian.org se nomme "sbuild":http://wiki.debian.org/sbuild. |
| 175 | 1 | Daniel Dehennin | |
| 176 | 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. |
| 177 | 2 | Daniel Dehennin | |
| 178 | 1 | Daniel Dehennin | Cela permet de lancer des compilations en parallèles au besoin. |
| 179 | 2 | Daniel Dehennin | |
| 180 | 35 | Daniel Dehennin | Deux méthodes sont utilisables pour la mise en place des schroots avec snapshots : |
| 181 | 14 | Daniel Dehennin | |
| 182 | 14 | Daniel Dehennin | * [[eole:GitPackagingSbuildLVM|avec LVM]] |
| 183 | 1 | Daniel Dehennin | * [[eole:GitPackagingSbuildBtrfs|avec le système de fichier btrfs]] |
| 184 | 14 | Daniel Dehennin | |
| 185 | 14 | Daniel Dehennin | |
| 186 | 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 : |
| 187 | 14 | Daniel Dehennin | |
| 188 | 14 | Daniel Dehennin | <pre> |
| 189 | 3 | Daniel Dehennin | buildd@build:~/src$ sudo apt-get install git-core git-buildpackage fakeroot build-essential debhelper cdbs |
| 190 | 16 | Daniel Dehennin | buildd@build:~/src$ git clone http://dev-eole.ac-dijon.fr/git/eole-debsums |
| 191 | 16 | Daniel Dehennin | buildd@build:~/src$ cd eole-debsums |
| 192 | 16 | Daniel Dehennin | buildd@build:~/src/eole-debsums$ git checkout -b dist/ubuntu/lucid/build origin/dist/ubuntu/lucid/master |
| 193 | 16 | Daniel Dehennin | buildd@build:~/src/eole-debsums$ git buildpackage --git-builder="sbuild -A -d eole-2.3-dev" --git-cleaner=/bin/true |
| 194 | 16 | Daniel Dehennin | </pre> |
| 195 | 16 | Daniel Dehennin | |
| 196 | 16 | Daniel Dehennin | Ou si on souhaite minimiser les paquets à installer: |
| 197 | 16 | Daniel Dehennin | |
| 198 | 16 | Daniel Dehennin | <pre> |
| 199 | 16 | Daniel Dehennin | buildd@build:~/src$ sudo apt-get install git-core git-buildpackage dpkg-dev |
| 200 | 16 | Daniel Dehennin | buildd@build:~/src$ git clone http://dev-eole.ac-dijon.fr/git/eole-debsums |
| 201 | 16 | Daniel Dehennin | buildd@build:~/src$ cd eole-debsums |
| 202 | 16 | Daniel Dehennin | buildd@build:~/src/eole-debsums$ git checkout -b dist/ubuntu/lucid/build origin/dist/ubuntu/lucid/master |
| 203 | 16 | Daniel Dehennin | buildd@build:~/src/eole-debsums$ git buildpackage --git-builder="dpkg-buildpackage -nc -d -S" --git-cleaner=/bin/true |
| 204 | 16 | Daniel Dehennin | buildd@build:~/src/eole-debsums$ sbuild -A -d eole-2.3-dev ../eole-debsums_20111207-eole1.dsc |
| 205 | 16 | Daniel Dehennin | </pre> |
| 206 | 16 | Daniel Dehennin | |
| 207 | 13 | Daniel Dehennin | h1. Webographie |
| 208 | 7 | Daniel Dehennin | |
| 209 | 38 | Daniel Dehennin | * La "politique Debian":http://www.debian.org/doc/devel-manuals#policy |
| 210 | 38 | Daniel Dehennin | * Une "introduction au packaging":http://www.debian.org/doc/devel-manuals#packaging-tutorial |
| 211 | 38 | Daniel Dehennin | * Les "meilleurs pratiques de packaging":http://www.debian.org/doc/manuals/developers-reference/best-pkging-practices.fr.html |
| 212 | 38 | Daniel Dehennin | * La "Référence du développeur Debian":http://www.debian.org/doc/manuals/developers-reference/index.fr.html |
| 213 | 38 | Daniel Dehennin | * La "documentation développeur Debian":http://www.debian.org/doc/devel-manuals |
| 214 | 11 | Daniel Dehennin | * "PackagingGuide/Python":https://wiki.ubuntu.com/PackagingGuide/Python |