GitPackagingSbuildPostInstall » Historique » Version 16
Daniel Dehennin, 19/01/2015 15:21
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 | 13 | Daniel Dehennin | /bin/bash -c 'cat > /etc/apt/apt.conf.d/90no-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 | 14 | Daniel Dehennin | /bin/bash -c 'cat > /etc/apt/apt.conf.d/80no-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 | EOF' |
52 | 6 | Daniel Dehennin | </pre> |
53 | 6 | Daniel Dehennin | |
54 | 2 | Daniel Dehennin | h4. Gestion des alias |
55 | 2 | Daniel Dehennin | |
56 | 1 | Daniel Dehennin | Nous venons de créer des schroots Ubuntu Lucid Lynx dans lesquels les builds seront effectués. |
57 | 1 | Daniel Dehennin | |
58 | 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@. |
59 | 1 | Daniel Dehennin | |
60 | 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. |
61 | 1 | Daniel Dehennin | |
62 | 1 | Daniel Dehennin | La commande suivante créé un fichier @.changes@ contenant la distribution @eole-2.3-dev@, ce fichier étant utilisé pour le triage : |
63 | 1 | Daniel Dehennin | <pre> |
64 | 1 | Daniel Dehennin | buildd@build:~$ sbuild -d eole-2.3-dev $package_$version.dsc |
65 | 1 | Daniel Dehennin | </pre> |
66 | 1 | Daniel Dehennin | |
67 | 1 | Daniel Dehennin | Nous configurons les alias en ajoutant une ligne: |
68 | 1 | Daniel Dehennin | |
69 | 1 | Daniel Dehennin | <pre> |
70 | 1 | Daniel Dehennin | system@build:~$ sudo sed -i \ |
71 | 15 | Daniel Dehennin | -e "/type=/ialiases=eole-2.3-${arch}-sbuild,eole-2.3-dev-${arch}-sbuild,eole-2.3-proposed-${arch}-sbuild,eole-2.3-security-${arch}-sbuild" \ |
72 | 1 | Daniel Dehennin | /etc/schroot/chroot.d/$dist-$arch-sbuild* |
73 | 1 | Daniel Dehennin | </pre> |
74 | 2 | Daniel Dehennin | |
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 | 8 | Daniel Dehennin | EOT |
89 | 8 | Daniel Dehennin | " |
90 | 2 | Daniel Dehennin | </pre> |
91 | 2 | Daniel Dehennin | |
92 | 2 | Daniel Dehennin | Il faut ensuite ajouter ce fichier à la liste des fichiers à copier dans les @schroot@ : |
93 | 2 | Daniel Dehennin | <pre> |
94 | 2 | Daniel Dehennin | system@build:~$ sudo /bin/sh -c "cat >> `expr /etc/schroot/sbuild/copyfile` <<EOT |
95 | 2 | Daniel Dehennin | /etc/sudoers.d/apt |
96 | 2 | Daniel Dehennin | EOT |
97 | 2 | Daniel Dehennin | " |
98 | 2 | Daniel Dehennin | </pre> |
99 | 2 | Daniel Dehennin | |
100 | 2 | Daniel Dehennin | h4. Accélération de la création de paquet |
101 | 2 | Daniel Dehennin | |
102 | 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. |
103 | 3 | Daniel Dehennin | |
104 | 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. |
105 | 3 | Daniel Dehennin | |
106 | 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@: |
107 | 2 | Daniel Dehennin | |
108 | 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. |
109 | 1 | Daniel Dehennin | |
110 | 1 | Daniel Dehennin | <pre> |
111 | 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') |
112 | 6 | Daniel Dehennin | system@build:~$ schroot -u root -c source:$dist-$arch-sbuild -d /tmp -- \ |
113 | 2 | Daniel Dehennin | /bin/bash -c \ |
114 | 6 | Daniel Dehennin | "apt-get install wget \ |
115 | 1 | Daniel Dehennin | && wget ${EAT_URL} \ |
116 | 6 | Daniel Dehennin | && dpkg -i eatmydata_26-2~lucid1_$arch.deb" |
117 | 1 | Daniel Dehennin | </pre> |
118 | 1 | Daniel Dehennin | |
119 | 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@. |
120 | 3 | Daniel Dehennin | |
121 | 3 | Daniel Dehennin | <pre> |
122 | 6 | Daniel Dehennin | system@build:~$ schroot -u root -c source:$dist-$arch-sbuild -d /tmp -- \ |
123 | 3 | Daniel Dehennin | /bin/bash -c \ |
124 | 6 | Daniel Dehennin | "apt-get install eatmydata" |
125 | 3 | Daniel Dehennin | </pre> |
126 | 3 | Daniel Dehennin | |
127 | 2 | Daniel Dehennin | |
128 | 2 | Daniel Dehennin | Il faut ensuite ajouter une configuration au @schroot@ : |
129 | 1 | Daniel Dehennin | |
130 | 1 | Daniel Dehennin | <pre> |
131 | 1 | Daniel Dehennin | system@build:~$ sudo /bin/sh -c "cat >> `expr /etc/schroot/chroot.d/$dist-$arch-sbuild*` <<EOT |
132 | 1 | Daniel Dehennin | command-prefix=eatmydata |
133 | 1 | Daniel Dehennin | EOT |
134 | 1 | Daniel Dehennin | " |
135 | 6 | Daniel Dehennin | </pre> |
136 | 6 | Daniel Dehennin | |
137 | 6 | Daniel Dehennin | h4. Mettre à jour et nettoyer le schroot |
138 | 6 | Daniel Dehennin | |
139 | 6 | Daniel Dehennin | Nous pouvons maintenant mettre à jour le schroot et supprimer les paquets inutiles : |
140 | 6 | Daniel Dehennin | |
141 | 6 | Daniel Dehennin | <pre> |
142 | 6 | Daniel Dehennin | system@build:~$ sbuild-update -udcar source:$dist-$arch-sbuild |
143 | 6 | Daniel Dehennin | system@build:~$ schroot -u root -c source:$dist-$arch-sbuild -d /tmp -- debfoster -f |
144 | 2 | Daniel Dehennin | </pre> |