GitPackaging » Historique » Version 31
Daniel Dehennin, 10/02/2012 16:29
Et un nouveau paquet, un !
| 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 | 26 | Daniel Dehennin | h2. Le packaging dans @dist/<VENDOR>/<DISTRIBUTION>/master@ |
| 24 | 26 | Daniel Dehennin | |
| 25 | 30 | Daniel Dehennin | Le packaging se compose de deux parties : |
| 26 | 26 | Daniel Dehennin | # Le code dit « upstream » |
| 27 | 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. |
| 28 | 26 | Daniel Dehennin | |
| 29 | 29 | Daniel Dehennin | h3. La première fois, c’est toujours la plus difficile |
| 30 | 26 | Daniel Dehennin | |
| 31 | 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. |
| 32 | 1 | Daniel Dehennin | |
| 33 | 31 | Daniel Dehennin | # On récupère un projet : |
| 34 | 31 | Daniel Dehennin | <pre> |
| 35 | 31 | Daniel Dehennin | buildd@build:~/src/$ git clone http://dev-eole.ac-dijon.fr/git/eole-debsums && cd eole-debsums |
| 36 | 31 | Daniel Dehennin | </pre> |
| 37 | 31 | Daniel Dehennin | # On créé une branche de packaging : |
| 38 | 31 | Daniel Dehennin | <pre> |
| 39 | 31 | Daniel Dehennin | buildd@build:~/src/eole-debsums(master)$ git checkout -b dist/ubuntu/lucid/master |
| 40 | 31 | Daniel Dehennin | </pre> |
| 41 | 31 | Daniel Dehennin | # On créer un packaging de base : |
| 42 | 31 | Daniel Dehennin | <pre> |
| 43 | 31 | Daniel Dehennin | buildd@build:~/src/eole-debsums(dist/ubuntu/lucid/master)$ dh_make -c <LICENCE> -p eole-debsums_<VERSION> --createorig |
| 44 | 31 | Daniel Dehennin | [...] # Répondre aux questions |
| 45 | 31 | Daniel Dehennin | </pre> |
| 46 | 31 | Daniel Dehennin | # On ajoute ce packaging au "stagging area":http://progit.org/book/fr/ch2-2.html |
| 47 | 31 | Daniel Dehennin | <pre> |
| 48 | 31 | Daniel Dehennin | buildd@build:~/src/eole-debsums(dist/ubuntu/lucid/master)$ git add debian |
| 49 | 31 | Daniel Dehennin | </pre> |
| 50 | 31 | Daniel Dehennin | # On commit ce premier packaging, cela fait un point de départ même s’il n’est pas utilisable |
| 51 | 31 | Daniel Dehennin | <pre> |
| 52 | 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 |
| 53 | 31 | Daniel Dehennin | </pre> |
| 54 | 1 | Daniel Dehennin | |
| 55 | 31 | Daniel Dehennin | À partir de là il faut éditer les fichiers présents dans le répertoire @debian/@, principalement : |
| 56 | 31 | Daniel Dehennin | * @debian/control@ : |
| 57 | 31 | Daniel Dehennin | ** Faire attention au mainteneur ; |
| 58 | 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, …) |
| 59 | 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 ; |
| 60 | 31 | Daniel Dehennin | ** Faire attention à la version de debhelper, @>= 7.4@ sur Lucid ; |
| 61 | 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 |
| 62 | 31 | Daniel Dehennin | * @debian/compat@ : utiliser 7 pour Lucid |
| 63 | 31 | Daniel Dehennin | * @debian/copyright@. |
| 64 | 31 | Daniel Dehennin | |
| 65 | 31 | Daniel Dehennin | Supprimer l’extention @.ex@ ou @.EX@ des fichiers qui seront utiles et les modifier. |
| 66 | 31 | Daniel Dehennin | |
| 67 | 31 | Daniel Dehennin | h3. Mise à jour du packaging |
| 68 | 31 | Daniel Dehennin | |
| 69 | 31 | Daniel Dehennin | La mise à jour du packaging ne requiert pas grand chose par rapport à la création d’un nouveau paquet: |
| 70 | 26 | Daniel Dehennin | # On se place dans la branche de packaging voulu |
| 71 | 26 | Daniel Dehennin | # On modifie les fichiers dans le répertoire @debian/@ en fonction des besoins |
| 72 | 26 | Daniel Dehennin | # On publie ces modifications |
| 73 | 26 | Daniel Dehennin | # On compile un paquet, ou pas |
| 74 | 26 | Daniel Dehennin | |
| 75 | 26 | Daniel Dehennin | h3. Nouveau paquet, sans modification du packaging |
| 76 | 26 | Daniel Dehennin | |
| 77 | 20 | Daniel Dehennin | Afin de faire un paquet, il faut intégrer la branche de développement souhaitée, par exemple: |
| 78 | 20 | Daniel Dehennin | |
| 79 | 20 | Daniel Dehennin | # On passe sur la branche de packaging : |
| 80 | 20 | Daniel Dehennin | <pre>buildd@build:~/src/eole-debsums(master)$ git checkout dist/ubuntu/lucid/master</pre> |
| 81 | 1 | Daniel Dehennin | # On intègre les modifications faites par les autres (et eolepack) : |
| 82 | 1 | Daniel Dehennin | <pre>buildd@build:~/src/eole-debsums(dist/ubuntu/lucid/master)$ git pull</pre> |
| 83 | 20 | Daniel Dehennin | # On intègre nos modifications : |
| 84 | 21 | Daniel Dehennin | <pre>buildd@build:~/src/eole-debsums(dist/ubuntu/lucid/master)$ git merge master</pre> |
| 85 | 20 | Daniel Dehennin | # On envoi sur le dépôt central pour eolepack : |
| 86 | 20 | Daniel Dehennin | <pre>buildd@build:~/src/eole-debsums(dist/ubuntu/lucid/master)$ git push</pre> |
| 87 | 20 | Daniel Dehennin | # On se replace sur la branche de développement pour nos futures modifications |
| 88 | 18 | Daniel Dehennin | <pre>buildd@build:~/src/eole-debsums(dist/ubuntu/lucid/master)$ git checkout master</pre> |
| 89 | 26 | Daniel Dehennin | # On compile un nouveau paquet, ou pas |
| 90 | 17 | Daniel Dehennin | |
| 91 | 26 | Daniel Dehennin | NB: La branche par défaut dans eolepack est modifiée pour être @dist/ubuntu/lucid/master@. |
| 92 | 24 | Daniel Dehennin | |
| 93 | 23 | Daniel Dehennin | h4. Aide à la console (aka helper bash) |
| 94 | 23 | Daniel Dehennin | |
| 95 | 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: |
| 96 | 22 | Daniel Dehennin | |
| 97 | 1 | Daniel Dehennin | <pre> |
| 98 | 22 | Daniel Dehennin | buildd@build:~/src/eole-debsums(master)$ git package lucid |
| 99 | 1 | Daniel Dehennin | Do you want to merge 'master' into 'dist/ubuntu/lucid/master'?: y |
| 100 | 25 | Daniel Dehennin | Checkout 'lucid' master distribution branch 'dist/ubuntu/lucid/master': Switched to branch 'dist/ubuntu/lucid/master' |
| 101 | 25 | Daniel Dehennin | Pull from default remote: Already up-to-date. |
| 102 | 25 | Daniel Dehennin | Merge developpement from 'master': Already up-to-date. |
| 103 | 25 | Daniel Dehennin | Switch back to your developpement branch 'master'... Switched to branch 'master' |
| 104 | 22 | Daniel Dehennin | Push is not automatically done to avoid publishing possible errors. |
| 105 | 22 | Daniel Dehennin | buildd@build:~/src/eole-debsums(master)$ |
| 106 | 22 | Daniel Dehennin | </pre> |
| 107 | 22 | Daniel Dehennin | |
| 108 | 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): |
| 109 | 27 | Daniel Dehennin | <pre> |
| 110 | 28 | Daniel Dehennin | buildd@build:~/src/eole-debsums(master)$ git config --global alias.lucid 'package lucid' |
| 111 | 27 | Daniel Dehennin | </pre> |
| 112 | 27 | Daniel Dehennin | |
| 113 | 27 | Daniel Dehennin | Ensuite, il n’y a plus qu’a l’utiliser: |
| 114 | 27 | Daniel Dehennin | <pre> |
| 115 | 27 | Daniel Dehennin | buildd@build:~/src/eole-debsums(master)$ git lucid |
| 116 | 27 | Daniel Dehennin | Do you want to merge 'master' into 'dist/ubuntu/lucid/master'?: y |
| 117 | 27 | Daniel Dehennin | Checkout 'lucid' master distribution branch 'dist/ubuntu/lucid/master': Switched to branch 'dist/ubuntu/lucid/master' |
| 118 | 27 | Daniel Dehennin | Pull from default remote: Already up-to-date. |
| 119 | 27 | Daniel Dehennin | Merge developpement from 'master': Already up-to-date. |
| 120 | 27 | Daniel Dehennin | Switch back to your developpement branch 'master'... Switched to branch 'master' |
| 121 | 27 | Daniel Dehennin | Push is not automatically done to avoid publishing possible errors. |
| 122 | 27 | Daniel Dehennin | buildd@build:~/src/eole-debsums(master)$ |
| 123 | 27 | Daniel Dehennin | </pre> |
| 124 | 27 | Daniel Dehennin | |
| 125 | 26 | Daniel Dehennin | h1. Environnement de compilation personnel |
| 126 | 2 | Daniel Dehennin | |
| 127 | 2 | Daniel Dehennin | Il existe plusieurs outils afin de mettre en place des environnements de compilation personnels. |
| 128 | 15 | Daniel Dehennin | |
| 129 | 2 | Daniel Dehennin | L’outil utilisé dans le projet "Debian":http://www.debian.org se nomme "sbuild":http://wiki.debian.org/sbuild. |
| 130 | 1 | Daniel Dehennin | |
| 131 | 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. |
| 132 | 2 | Daniel Dehennin | |
| 133 | 1 | Daniel Dehennin | Cela permet de lancer des compilations en parallèles au besoin. |
| 134 | 2 | Daniel Dehennin | |
| 135 | 17 | Daniel Dehennin | Deux méthodes sont utilisables pour la mise en place des snapshots : |
| 136 | 14 | Daniel Dehennin | |
| 137 | 14 | Daniel Dehennin | * [[eole:GitPackagingSbuildLVM|avec LVM]] |
| 138 | 1 | Daniel Dehennin | * [[eole:GitPackagingSbuildBtrfs|avec le système de fichier btrfs]] |
| 139 | 14 | Daniel Dehennin | |
| 140 | 14 | Daniel Dehennin | |
| 141 | 17 | Daniel Dehennin | Lorsque les schroots sont en place et sbuild configuré, la compilation d’un paquet peut se dérouler comme suit : |
| 142 | 14 | Daniel Dehennin | |
| 143 | 14 | Daniel Dehennin | <pre> |
| 144 | 3 | Daniel Dehennin | buildd@build:~/src$ sudo apt-get install git-core git-buildpackage fakeroot build-essential debhelper cdbs |
| 145 | 16 | Daniel Dehennin | buildd@build:~/src$ git clone http://dev-eole.ac-dijon.fr/git/eole-debsums |
| 146 | 16 | Daniel Dehennin | buildd@build:~/src$ cd eole-debsums |
| 147 | 16 | Daniel Dehennin | buildd@build:~/src/eole-debsums$ git checkout -b dist/ubuntu/lucid/build origin/dist/ubuntu/lucid/master |
| 148 | 16 | Daniel Dehennin | buildd@build:~/src/eole-debsums$ git buildpackage --git-builder="sbuild -A -d eole-2.3-dev" --git-cleaner=/bin/true |
| 149 | 16 | Daniel Dehennin | </pre> |
| 150 | 16 | Daniel Dehennin | |
| 151 | 16 | Daniel Dehennin | Ou si on souhaite minimiser les paquets à installer: |
| 152 | 16 | Daniel Dehennin | |
| 153 | 16 | Daniel Dehennin | <pre> |
| 154 | 16 | Daniel Dehennin | buildd@build:~/src$ sudo apt-get install git-core git-buildpackage dpkg-dev |
| 155 | 16 | Daniel Dehennin | buildd@build:~/src$ git clone http://dev-eole.ac-dijon.fr/git/eole-debsums |
| 156 | 16 | Daniel Dehennin | buildd@build:~/src$ cd eole-debsums |
| 157 | 16 | Daniel Dehennin | buildd@build:~/src/eole-debsums$ git checkout -b dist/ubuntu/lucid/build origin/dist/ubuntu/lucid/master |
| 158 | 16 | Daniel Dehennin | buildd@build:~/src/eole-debsums$ git buildpackage --git-builder="dpkg-buildpackage -nc -d -S" --git-cleaner=/bin/true |
| 159 | 16 | Daniel Dehennin | buildd@build:~/src/eole-debsums$ sbuild -A -d eole-2.3-dev ../eole-debsums_20111207-eole1.dsc |
| 160 | 16 | Daniel Dehennin | </pre> |
| 161 | 16 | Daniel Dehennin | |
| 162 | 13 | Daniel Dehennin | h1. Webographie |
| 163 | 7 | Daniel Dehennin | |
| 164 | 11 | Daniel Dehennin | * "PackagingGuide/Python":https://wiki.ubuntu.com/PackagingGuide/Python |