GitPackagingSbuildPostInstall » Historique » Version 11
Fabrice Barconnière, 20/05/2014 14:46
| 1 | 6 | Daniel Dehennin | h4. Configuration des outils Debian |
|---|---|---|---|
| 2 | 6 | Daniel Dehennin | |
| 3 | 6 | Daniel Dehennin | Des optimisations de configuration permettent aux outils Debian "debconf":http://wiki.debian.org/debconf et "Apt":http://wiki.debian.org/Apt de fonctionner de façon optimale dans les schroots de compilation. |
| 4 | 6 | Daniel Dehennin | |
| 5 | 6 | Daniel Dehennin | h5. Mode non interactif lors de l’installation des paquets |
| 6 | 6 | Daniel Dehennin | |
| 7 | 6 | Daniel Dehennin | <pre> |
| 8 | 6 | Daniel Dehennin | system@build:~$ schroot -u root -c source:$dist-$arch-sbuild -d /tmp -- \ |
| 9 | 6 | Daniel Dehennin | /bin/bash -c 'echo "debconf debconf/priority select critical" | debconf-set-selections |
| 10 | 6 | Daniel Dehennin | echo "debconf debconf/frontend string noninteractive" | debconf-set-selections' |
| 11 | 6 | Daniel Dehennin | </pre> |
| 12 | 6 | Daniel Dehennin | |
| 13 | 6 | Daniel Dehennin | h5. Ne pas installer les paquets recommandés et suggérés |
| 14 | 6 | Daniel Dehennin | |
| 15 | 6 | Daniel Dehennin | <pre> |
| 16 | 6 | Daniel Dehennin | system@build:~$ schroot -u root -c source:$dist-$arch-sbuild -d /tmp -- \ |
| 17 | 11 | Fabrice Barconnière | /bin/bash -c 'cat > /etc/apt/apt.conf.d/99no-install-recommends <<EOF |
| 18 | 6 | Daniel Dehennin | APT::Install-Recommends "False"; |
| 19 | 6 | Daniel Dehennin | APT::Install-Suggests "False"; |
| 20 | 6 | Daniel Dehennin | EOF' |
| 21 | 6 | Daniel Dehennin | </pre> |
| 22 | 6 | Daniel Dehennin | |
| 23 | 7 | Daniel Dehennin | h5. Ne pas utiliser les diff des indexes de paquets |
| 24 | 7 | Daniel Dehennin | |
| 25 | 7 | Daniel Dehennin | Ces fichiers permettent de diminuer la quantité de données téléchargées lors des @apt-get update@ mais peuvent faire planter l’outil @apt-get@ de temps en temps : |
| 26 | 7 | Daniel Dehennin | |
| 27 | 7 | Daniel Dehennin | <pre> |
| 28 | 7 | Daniel Dehennin | system@build:~$ schroot -u root -c source:$dist-$arch-sbuild -d /tmp -- \ |
| 29 | 11 | Fabrice Barconnière | /bin/bash -c 'cat > /etc/apt/apt.conf.d/90no-pdiff <<EOF |
| 30 | 7 | Daniel Dehennin | Acquire::PDiffs "False"; |
| 31 | 7 | Daniel Dehennin | EOF' |
| 32 | 7 | Daniel Dehennin | </pre> |
| 33 | 7 | Daniel Dehennin | |
| 34 | 6 | Daniel Dehennin | h5. Forcer la mise à jour des fichiers de configuration |
| 35 | 6 | Daniel Dehennin | |
| 36 | 6 | Daniel Dehennin | <pre> |
| 37 | 6 | Daniel Dehennin | system@build:~$ schroot -u root -c source:$dist-$arch-sbuild -d /tmp -- \ |
| 38 | 6 | Daniel Dehennin | /bin/bash -c 'echo "force-confnew" > /etc/dpkg/dpkg.cfg.d/force-confnew' |
| 39 | 6 | Daniel Dehennin | </pre> |
| 40 | 6 | Daniel Dehennin | |
| 41 | 6 | Daniel Dehennin | h5. Configurer debfoster |
| 42 | 6 | Daniel Dehennin | |
| 43 | 6 | Daniel Dehennin | L’outil "debfoster":http://packages.qa.debian.org/d/debfoster.html permet de garder un système propre. |
| 44 | 6 | Daniel Dehennin | |
| 45 | 6 | Daniel Dehennin | <pre> |
| 46 | 6 | Daniel Dehennin | system@build:~$ schroot -u root -c source:$dist-$arch-sbuild -d /tmp -- \ |
| 47 | 6 | Daniel Dehennin | /bin/bash -c 'cat > /var/lib/debfoster/keepers <<EOF |
| 48 | 6 | Daniel Dehennin | build-essential |
| 49 | 6 | Daniel Dehennin | debfoster |
| 50 | 6 | Daniel Dehennin | eatmydata |
| 51 | 6 | Daniel Dehennin | sudo |
| 52 | 6 | Daniel Dehennin | EOF' |
| 53 | 6 | Daniel Dehennin | </pre> |
| 54 | 6 | Daniel Dehennin | |
| 55 | 2 | Daniel Dehennin | h4. Gestion des alias |
| 56 | 2 | Daniel Dehennin | |
| 57 | 1 | Daniel Dehennin | Nous venons de créer des schroots Ubuntu Lucid Lynx dans lesquels les builds seront effectués. |
| 58 | 1 | Daniel Dehennin | |
| 59 | 1 | Daniel Dehennin | Il nous reste à déclarer que ces schroots seront utilisés pour compiler des paquets pour notre distribution, nos distributions en prenant en compte les variantes @-security@, @-updates@, @-proposed@ et @-dev@. |
| 60 | 1 | Daniel Dehennin | |
| 61 | 1 | Daniel Dehennin | Cette étape est importante afin que les paquets compilés pour une distribution soient répartis dans la bonne distribution sur le dépôt de paquets "deb":https://fr.wikipedia.org/wiki/Deb. |
| 62 | 1 | Daniel Dehennin | |
| 63 | 1 | Daniel Dehennin | La commande suivante créé un fichier @.changes@ contenant la distribution @eole-2.3-dev@, ce fichier étant utilisé pour le triage : |
| 64 | 1 | Daniel Dehennin | <pre> |
| 65 | 1 | Daniel Dehennin | buildd@build:~$ sbuild -d eole-2.3-dev $package_$version.dsc |
| 66 | 1 | Daniel Dehennin | </pre> |
| 67 | 1 | Daniel Dehennin | |
| 68 | 1 | Daniel Dehennin | Nous configurons les alias en ajoutant une ligne: |
| 69 | 1 | Daniel Dehennin | |
| 70 | 1 | Daniel Dehennin | <pre> |
| 71 | 1 | Daniel Dehennin | system@build:~$ sudo sed -i \ |
| 72 | 1 | Daniel Dehennin | -e "/type=/ialiases=eole-2.3,eole-2.3-dev,eole-2.3-proposed,eole-2.3-security" \ |
| 73 | 1 | Daniel Dehennin | /etc/schroot/chroot.d/$dist-$arch-sbuild* |
| 74 | 1 | Daniel Dehennin | </pre> |
| 75 | 1 | Daniel Dehennin | |
| 76 | 1 | Daniel Dehennin | Les alias ci-dessus font que l’appel à @sbuild -d eole-2.3-dev@ utilisera l’architecture @AMD64@ par défaut. |
| 77 | 1 | Daniel Dehennin | |
| 78 | 1 | Daniel Dehennin | La création d’un schroot @i386@ devrait ajouter des alias contenant l’architecture afin de ne pas entrer en conflit : |
| 79 | 1 | Daniel Dehennin | <pre> |
| 80 | 1 | Daniel Dehennin | system@build:~$ sudo sed -i \ |
| 81 | 1 | Daniel Dehennin | -e "/type=/ialiases=eole-2.3-i386,eole-2.3-dev-i386,eole-2.3-proposed-i386,eole-2.3-security-i386" \ |
| 82 | 2 | Daniel Dehennin | /etc/schroot/chroot.d/$dist-$arch-sbuild* |
| 83 | 2 | Daniel Dehennin | </pre> |
| 84 | 2 | Daniel Dehennin | |
| 85 | 2 | Daniel Dehennin | Ainsi, la commande @sbuild -d eole-2.3-dev --arch=i386@ utilisera le schroot @i386@ et non le @AMD64@. |
| 86 | 2 | Daniel Dehennin | |
| 87 | 2 | Daniel Dehennin | h4. Autoriser l’utilisateur system à installer des paquets dans les schroots |
| 88 | 2 | Daniel Dehennin | |
| 89 | 2 | Daniel Dehennin | Il faut en premier lieu configurer @sudo@ : |
| 90 | 2 | Daniel Dehennin | |
| 91 | 2 | Daniel Dehennin | <pre> |
| 92 | 2 | Daniel Dehennin | system@build:~$ sudo /bin/sh -c "cat >> `expr /etc/sudoers.d/apt` <<EOT |
| 93 | 2 | Daniel Dehennin | Cmnd_Alias APT_INSTALL = /usr/bin/apt-get install *, /usr/bin/dpkg -i *.deb |
| 94 | 2 | Daniel Dehennin | Cmnd_Alias APT_REMOVE = /usr/bin/apt-get remove *, /usr/bin/apt-get purge * |
| 95 | 2 | Daniel Dehennin | Cmnd_Alias APT_CLEAN = /usr/bin/apt-get clean, /usr/bin/apt-get --purge autoremove, /usr/bin/orphaner --purge |
| 96 | 2 | Daniel Dehennin | Cmnd_Alias APT_UPGRADE = /usr/bin/apt-get update, /usr/bin/apt-get upgrade, /usr/bin/apt-get dist-upgrade |
| 97 | 2 | Daniel Dehennin | |
| 98 | 2 | Daniel Dehennin | system ALL=NOPASSWD : APT_INSTALL, APT_REMOVE, APT_CLEAN, APT_UPGRADE |
| 99 | 8 | Daniel Dehennin | EOT |
| 100 | 8 | Daniel Dehennin | " |
| 101 | 2 | Daniel Dehennin | </pre> |
| 102 | 2 | Daniel Dehennin | |
| 103 | 2 | Daniel Dehennin | Il faut ensuite ajouter ce fichier à la liste des fichiers à copier dans les @schroot@ : |
| 104 | 2 | Daniel Dehennin | <pre> |
| 105 | 2 | Daniel Dehennin | system@build:~$ sudo /bin/sh -c "cat >> `expr /etc/schroot/sbuild/copyfile` <<EOT |
| 106 | 2 | Daniel Dehennin | /etc/sudoers.d/apt |
| 107 | 2 | Daniel Dehennin | EOT |
| 108 | 2 | Daniel Dehennin | " |
| 109 | 2 | Daniel Dehennin | </pre> |
| 110 | 2 | Daniel Dehennin | |
| 111 | 2 | Daniel Dehennin | h4. Accélération de la création de paquet |
| 112 | 2 | Daniel Dehennin | |
| 113 | 3 | Daniel Dehennin | Le système de packaging @dpkg@ utilise intensément l’appel systeme "fsync":http://manpages.ubuntu.com/manpages/precise/man2/fsync.2.html afin d’assurer au maximum la cohérence des systèmes de fichiers. |
| 114 | 3 | Daniel Dehennin | |
| 115 | 1 | Daniel Dehennin | Cette frénésie de @fsync@ ralenti considérablement les accès disques et n’est pas primordiale lors de la compilation d’un paquet. |
| 116 | 3 | Daniel Dehennin | |
| 117 | 4 | Daniel Dehennin | On peut donc installer le paquet "eatmydata":https://launchpad.net/ubuntu/+source/libeatmydata à l’intérieur des @schroot@ et les configurer pour inhiber les appels à @fsync@: |
| 118 | 2 | Daniel Dehennin | |
| 119 | 2 | Daniel Dehennin | Pour "Lucid Lynx":https://launchpad.net/ubuntu/lucid/+source/libeatmydata, le paquet est disponible et supporté dans les @backports@ qui ne sont pas activé par défaut, on peut télécharger et installer le paquet manuellement. |
| 120 | 1 | Daniel Dehennin | |
| 121 | 1 | Daniel Dehennin | <pre> |
| 122 | 6 | Daniel Dehennin | system@build:~$ EAT_URL=$([ "$arch" = "amd64" ] && echo 'http://launchpadlibrarian.net/68861934/eatmydata_26-2~lucid1_amd64.deb' || echo 'http://launchpadlibrarian.net/68861936/eatmydata_26-2~lucid1_i386.deb') |
| 123 | 6 | Daniel Dehennin | system@build:~$ schroot -u root -c source:$dist-$arch-sbuild -d /tmp -- \ |
| 124 | 2 | Daniel Dehennin | /bin/bash -c \ |
| 125 | 6 | Daniel Dehennin | "apt-get install wget \ |
| 126 | 1 | Daniel Dehennin | && wget ${EAT_URL} \ |
| 127 | 6 | Daniel Dehennin | && dpkg -i eatmydata_26-2~lucid1_$arch.deb" |
| 128 | 1 | Daniel Dehennin | </pre> |
| 129 | 1 | Daniel Dehennin | |
| 130 | 3 | Daniel Dehennin | Pour "Precise Pangolin":https://launchpad.net/ubuntu/precise/+source/libeatmydata le paquet est disponible dans les composants @universe@ qui a été activé lors de la création du @schroot@. |
| 131 | 3 | Daniel Dehennin | |
| 132 | 3 | Daniel Dehennin | <pre> |
| 133 | 6 | Daniel Dehennin | system@build:~$ schroot -u root -c source:$dist-$arch-sbuild -d /tmp -- \ |
| 134 | 3 | Daniel Dehennin | /bin/bash -c \ |
| 135 | 6 | Daniel Dehennin | "apt-get install eatmydata" |
| 136 | 3 | Daniel Dehennin | </pre> |
| 137 | 3 | Daniel Dehennin | |
| 138 | 2 | Daniel Dehennin | |
| 139 | 2 | Daniel Dehennin | Il faut ensuite ajouter une configuration au @schroot@ : |
| 140 | 1 | Daniel Dehennin | |
| 141 | 1 | Daniel Dehennin | <pre> |
| 142 | 1 | Daniel Dehennin | system@build:~$ sudo /bin/sh -c "cat >> `expr /etc/schroot/chroot.d/$dist-$arch-sbuild*` <<EOT |
| 143 | 1 | Daniel Dehennin | command-prefix=eatmydata |
| 144 | 1 | Daniel Dehennin | EOT |
| 145 | 1 | Daniel Dehennin | " |
| 146 | 6 | Daniel Dehennin | </pre> |
| 147 | 6 | Daniel Dehennin | |
| 148 | 6 | Daniel Dehennin | h4. Mettre à jour et nettoyer le schroot |
| 149 | 6 | Daniel Dehennin | |
| 150 | 6 | Daniel Dehennin | Nous pouvons maintenant mettre à jour le schroot et supprimer les paquets inutiles : |
| 151 | 6 | Daniel Dehennin | |
| 152 | 6 | Daniel Dehennin | <pre> |
| 153 | 6 | Daniel Dehennin | system@build:~$ sbuild-update -udcar source:$dist-$arch-sbuild |
| 154 | 6 | Daniel Dehennin | system@build:~$ schroot -u root -c source:$dist-$arch-sbuild -d /tmp -- debfoster -f |
| 155 | 2 | Daniel Dehennin | </pre> |