GitPackagingSbuildPostInstall » Historique » Version 6
Daniel Dehennin, 27/03/2013 10:26
Configuration des outils Debian
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 | 6 | Daniel Dehennin | /bin/bash -c 'cat > /etc/apt/apt.conf.d/no-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 | 6 | Daniel Dehennin | h5. Forcer la mise à jour des fichiers de configuration |
24 | 6 | Daniel Dehennin | |
25 | 6 | Daniel Dehennin | <pre> |
26 | 6 | Daniel Dehennin | system@build:~$ schroot -u root -c source:$dist-$arch-sbuild -d /tmp -- \ |
27 | 6 | Daniel Dehennin | /bin/bash -c 'echo "force-confnew" > /etc/dpkg/dpkg.cfg.d/force-confnew' |
28 | 6 | Daniel Dehennin | </pre> |
29 | 6 | Daniel Dehennin | |
30 | 6 | Daniel Dehennin | h5. Configurer debfoster |
31 | 6 | Daniel Dehennin | |
32 | 6 | Daniel Dehennin | L’outil "debfoster":http://packages.qa.debian.org/d/debfoster.html permet de garder un système propre. |
33 | 6 | Daniel Dehennin | |
34 | 6 | Daniel Dehennin | <pre> |
35 | 6 | Daniel Dehennin | system@build:~$ schroot -u root -c source:$dist-$arch-sbuild -d /tmp -- \ |
36 | 6 | Daniel Dehennin | /bin/bash -c 'cat > /var/lib/debfoster/keepers <<EOF |
37 | 6 | Daniel Dehennin | build-essential |
38 | 6 | Daniel Dehennin | debfoster |
39 | 6 | Daniel Dehennin | eatmydata |
40 | 6 | Daniel Dehennin | sudo |
41 | 6 | Daniel Dehennin | EOF' |
42 | 6 | Daniel Dehennin | </pre> |
43 | 6 | Daniel Dehennin | |
44 | 2 | Daniel Dehennin | h4. Gestion des alias |
45 | 2 | Daniel Dehennin | |
46 | 1 | Daniel Dehennin | Nous venons de créer des schroots Ubuntu Lucid Lynx dans lesquels les builds seront effectués. |
47 | 1 | Daniel Dehennin | |
48 | 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@. |
49 | 1 | Daniel Dehennin | |
50 | 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. |
51 | 1 | Daniel Dehennin | |
52 | 1 | Daniel Dehennin | La commande suivante créé un fichier @.changes@ contenant la distribution @eole-2.3-dev@, ce fichier étant utilisé pour le triage : |
53 | 1 | Daniel Dehennin | <pre> |
54 | 1 | Daniel Dehennin | buildd@build:~$ sbuild -d eole-2.3-dev $package_$version.dsc |
55 | 1 | Daniel Dehennin | </pre> |
56 | 1 | Daniel Dehennin | |
57 | 1 | Daniel Dehennin | Nous configurons les alias en ajoutant une ligne: |
58 | 1 | Daniel Dehennin | |
59 | 1 | Daniel Dehennin | <pre> |
60 | 1 | Daniel Dehennin | system@build:~$ sudo sed -i \ |
61 | 1 | Daniel Dehennin | -e "/type=/ialiases=eole-2.3,eole-2.3-dev,eole-2.3-proposed,eole-2.3-security" \ |
62 | 1 | Daniel Dehennin | /etc/schroot/chroot.d/$dist-$arch-sbuild* |
63 | 1 | Daniel Dehennin | </pre> |
64 | 1 | Daniel Dehennin | |
65 | 1 | Daniel Dehennin | Les alias ci-dessus font que l’appel à @sbuild -d eole-2.3-dev@ utilisera l’architecture @AMD64@ par défaut. |
66 | 1 | Daniel Dehennin | |
67 | 1 | Daniel Dehennin | La création d’un schroot @i386@ devrait ajouter des alias contenant l’architecture afin de ne pas entrer en conflit : |
68 | 1 | Daniel Dehennin | <pre> |
69 | 1 | Daniel Dehennin | system@build:~$ sudo sed -i \ |
70 | 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" \ |
71 | 2 | Daniel Dehennin | /etc/schroot/chroot.d/$dist-$arch-sbuild* |
72 | 2 | Daniel Dehennin | </pre> |
73 | 2 | Daniel Dehennin | |
74 | 2 | Daniel Dehennin | Ainsi, la commande @sbuild -d eole-2.3-dev --arch=i386@ utilisera le schroot @i386@ et non le @AMD64@. |
75 | 2 | Daniel Dehennin | |
76 | 2 | Daniel Dehennin | h4. Autoriser l’utilisateur system à installer des paquets dans les schroots |
77 | 2 | Daniel Dehennin | |
78 | 2 | Daniel Dehennin | Il faut en premier lieu configurer @sudo@ : |
79 | 2 | Daniel Dehennin | |
80 | 2 | Daniel Dehennin | <pre> |
81 | 2 | Daniel Dehennin | system@build:~$ sudo /bin/sh -c "cat >> `expr /etc/sudoers.d/apt` <<EOT |
82 | 2 | Daniel Dehennin | Cmnd_Alias APT_INSTALL = /usr/bin/apt-get install *, /usr/bin/dpkg -i *.deb |
83 | 2 | Daniel Dehennin | Cmnd_Alias APT_REMOVE = /usr/bin/apt-get remove *, /usr/bin/apt-get purge * |
84 | 2 | Daniel Dehennin | Cmnd_Alias APT_CLEAN = /usr/bin/apt-get clean, /usr/bin/apt-get --purge autoremove, /usr/bin/orphaner --purge |
85 | 2 | Daniel Dehennin | Cmnd_Alias APT_UPGRADE = /usr/bin/apt-get update, /usr/bin/apt-get upgrade, /usr/bin/apt-get dist-upgrade |
86 | 2 | Daniel Dehennin | |
87 | 2 | Daniel Dehennin | system ALL=NOPASSWD : APT_INSTALL, APT_REMOVE, APT_CLEAN, APT_UPGRADE |
88 | 2 | Daniel Dehennin | </pre> |
89 | 2 | Daniel Dehennin | |
90 | 2 | Daniel Dehennin | Il faut ensuite ajouter ce fichier à la liste des fichiers à copier dans les @schroot@ : |
91 | 2 | Daniel Dehennin | <pre> |
92 | 2 | Daniel Dehennin | system@build:~$ sudo /bin/sh -c "cat >> `expr /etc/schroot/sbuild/copyfile` <<EOT |
93 | 2 | Daniel Dehennin | /etc/sudoers.d/apt |
94 | 2 | Daniel Dehennin | EOT |
95 | 2 | Daniel Dehennin | " |
96 | 2 | Daniel Dehennin | </pre> |
97 | 2 | Daniel Dehennin | |
98 | 2 | Daniel Dehennin | h4. Accélération de la création de paquet |
99 | 2 | Daniel Dehennin | |
100 | 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. |
101 | 3 | Daniel Dehennin | |
102 | 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. |
103 | 3 | Daniel Dehennin | |
104 | 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@: |
105 | 2 | Daniel Dehennin | |
106 | 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. |
107 | 1 | Daniel Dehennin | |
108 | 1 | Daniel Dehennin | <pre> |
109 | 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') |
110 | 6 | Daniel Dehennin | system@build:~$ schroot -u root -c source:$dist-$arch-sbuild -d /tmp -- \ |
111 | 2 | Daniel Dehennin | /bin/bash -c \ |
112 | 6 | Daniel Dehennin | "apt-get install wget \ |
113 | 1 | Daniel Dehennin | && wget ${EAT_URL} \ |
114 | 6 | Daniel Dehennin | && dpkg -i eatmydata_26-2~lucid1_$arch.deb" |
115 | 1 | Daniel Dehennin | </pre> |
116 | 1 | Daniel Dehennin | |
117 | 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@. |
118 | 3 | Daniel Dehennin | |
119 | 3 | Daniel Dehennin | <pre> |
120 | 6 | Daniel Dehennin | system@build:~$ schroot -u root -c source:$dist-$arch-sbuild -d /tmp -- \ |
121 | 3 | Daniel Dehennin | /bin/bash -c \ |
122 | 6 | Daniel Dehennin | "apt-get install eatmydata" |
123 | 3 | Daniel Dehennin | </pre> |
124 | 3 | Daniel Dehennin | |
125 | 2 | Daniel Dehennin | |
126 | 2 | Daniel Dehennin | Il faut ensuite ajouter une configuration au @schroot@ : |
127 | 1 | Daniel Dehennin | |
128 | 1 | Daniel Dehennin | <pre> |
129 | 1 | Daniel Dehennin | system@build:~$ sudo /bin/sh -c "cat >> `expr /etc/schroot/chroot.d/$dist-$arch-sbuild*` <<EOT |
130 | 1 | Daniel Dehennin | command-prefix=eatmydata |
131 | 1 | Daniel Dehennin | EOT |
132 | 1 | Daniel Dehennin | " |
133 | 6 | Daniel Dehennin | </pre> |
134 | 6 | Daniel Dehennin | |
135 | 6 | Daniel Dehennin | h4. Mettre à jour et nettoyer le schroot |
136 | 6 | Daniel Dehennin | |
137 | 6 | Daniel Dehennin | Nous pouvons maintenant mettre à jour le schroot et supprimer les paquets inutiles : |
138 | 6 | Daniel Dehennin | |
139 | 6 | Daniel Dehennin | <pre> |
140 | 6 | Daniel Dehennin | system@build:~$ sbuild-update -udcar source:$dist-$arch-sbuild |
141 | 6 | Daniel Dehennin | system@build:~$ schroot -u root -c source:$dist-$arch-sbuild -d /tmp -- debfoster -f |
142 | 2 | Daniel Dehennin | </pre> |