GitPackagingSbuildPostInstall » Historique » Version 2
Daniel Dehennin, 22/11/2012 18:54
Gestion des alias + installer des paquets dans les schroots + accélérer les build
1 | 2 | Daniel Dehennin | h4. Gestion des alias |
---|---|---|---|
2 | 2 | Daniel Dehennin | |
3 | 1 | Daniel Dehennin | Nous venons de créer des schroots Ubuntu Lucid Lynx dans lesquels les builds seront effectués. |
4 | 1 | Daniel Dehennin | |
5 | 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@. |
6 | 1 | Daniel Dehennin | |
7 | 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. |
8 | 1 | Daniel Dehennin | |
9 | 1 | Daniel Dehennin | La commande suivante créé un fichier @.changes@ contenant la distribution @eole-2.3-dev@, ce fichier étant utilisé pour le triage : |
10 | 1 | Daniel Dehennin | <pre> |
11 | 1 | Daniel Dehennin | buildd@build:~$ sbuild -d eole-2.3-dev $package_$version.dsc |
12 | 1 | Daniel Dehennin | </pre> |
13 | 1 | Daniel Dehennin | |
14 | 1 | Daniel Dehennin | Nous configurons les alias en ajoutant une ligne: |
15 | 1 | Daniel Dehennin | |
16 | 1 | Daniel Dehennin | <pre> |
17 | 1 | Daniel Dehennin | system@build:~$ sudo sed -i \ |
18 | 1 | Daniel Dehennin | -e "/type=/ialiases=eole-2.3,eole-2.3-dev,eole-2.3-proposed,eole-2.3-security" \ |
19 | 1 | Daniel Dehennin | /etc/schroot/chroot.d/$dist-$arch-sbuild* |
20 | 1 | Daniel Dehennin | </pre> |
21 | 1 | Daniel Dehennin | |
22 | 1 | Daniel Dehennin | Les alias ci-dessus font que l’appel à @sbuild -d eole-2.3-dev@ utilisera l’architecture @AMD64@ par défaut. |
23 | 1 | Daniel Dehennin | |
24 | 1 | Daniel Dehennin | La création d’un schroot @i386@ devrait ajouter des alias contenant l’architecture afin de ne pas entrer en conflit : |
25 | 1 | Daniel Dehennin | <pre> |
26 | 1 | Daniel Dehennin | system@build:~$ sudo sed -i \ |
27 | 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" \ |
28 | 1 | Daniel Dehennin | /etc/schroot/chroot.d/$dist-$arch-sbuild* |
29 | 1 | Daniel Dehennin | </pre> |
30 | 1 | Daniel Dehennin | |
31 | 1 | Daniel Dehennin | Ainsi, la commande @sbuild -d eole-2.3-dev --arch=i386@ utilisera le schroot @i386@ et non le @AMD64@. |
32 | 2 | Daniel Dehennin | |
33 | 2 | Daniel Dehennin | h4. Autoriser l’utilisateur system à installer des paquets dans les schroots |
34 | 2 | Daniel Dehennin | |
35 | 2 | Daniel Dehennin | Il faut en premier lieu configurer @sudo@ : |
36 | 2 | Daniel Dehennin | |
37 | 2 | Daniel Dehennin | <pre> |
38 | 2 | Daniel Dehennin | system@build:~$ sudo /bin/sh -c "cat >> `expr /etc/sudoers.d/apt` <<EOT |
39 | 2 | Daniel Dehennin | Cmnd_Alias APT_INSTALL = /usr/bin/apt-get install *, /usr/bin/dpkg -i *.deb |
40 | 2 | Daniel Dehennin | Cmnd_Alias APT_REMOVE = /usr/bin/apt-get remove *, /usr/bin/apt-get purge * |
41 | 2 | Daniel Dehennin | Cmnd_Alias APT_CLEAN = /usr/bin/apt-get clean, /usr/bin/apt-get --purge autoremove, /usr/bin/orphaner --purge |
42 | 2 | Daniel Dehennin | Cmnd_Alias APT_UPGRADE = /usr/bin/apt-get update, /usr/bin/apt-get upgrade, /usr/bin/apt-get dist-upgrade |
43 | 2 | Daniel Dehennin | |
44 | 2 | Daniel Dehennin | system ALL=NOPASSWD : APT_INSTALL, APT_REMOVE, APT_CLEAN, APT_UPGRADE |
45 | 2 | Daniel Dehennin | </pre> |
46 | 2 | Daniel Dehennin | |
47 | 2 | Daniel Dehennin | Il faut ensuite ajouter ce fichier à la liste des fichiers à copier dans les @schroot@ : |
48 | 2 | Daniel Dehennin | <pre> |
49 | 2 | Daniel Dehennin | system@build:~$ sudo /bin/sh -c "cat >> `expr /etc/schroot/sbuild/copyfile` <<EOT |
50 | 2 | Daniel Dehennin | /etc/sudoers.d/apt |
51 | 2 | Daniel Dehennin | EOT |
52 | 2 | Daniel Dehennin | " |
53 | 2 | Daniel Dehennin | </pre> |
54 | 2 | Daniel Dehennin | |
55 | 2 | Daniel Dehennin | h4. Accélération de la création de paquet |
56 | 2 | Daniel Dehennin | |
57 | 2 | 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. |
58 | 2 | Daniel Dehennin | |
59 | 2 | 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. |
60 | 2 | Daniel Dehennin | |
61 | 2 | 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@: |
62 | 2 | Daniel Dehennin | |
63 | 2 | Daniel Dehennin | * Pour i386 : <pre>EAT_URL='http://launchpadlibrarian.net/68861936/eatmydata_26-2~lucid1_i386.deb'</pre> |
64 | 2 | Daniel Dehennin | * Pour amd64 : <pre>EAT_URL='http://launchpadlibrarian.net/68861934/eatmydata_26-2~lucid1_amd64.deb'</pre> |
65 | 2 | Daniel Dehennin | |
66 | 2 | Daniel Dehennin | <pre> |
67 | 2 | Daniel Dehennin | buildd@build:~$ schroot -c source:$dist-$arch-sbuild -- \ |
68 | 2 | Daniel Dehennin | /bin/bash -c \ |
69 | 2 | Daniel Dehennin | "sudo apt-get install wget \ |
70 | 2 | Daniel Dehennin | && wget ${EAT_URL} \ |
71 | 2 | Daniel Dehennin | && sudo dpkg -i eatmydata_26-2~lucid1_$arch.deb" |
72 | 2 | Daniel Dehennin | </pre> |
73 | 2 | Daniel Dehennin | |
74 | 2 | Daniel Dehennin | Il faut ensuite ajouter une configuration au @schroot@ : |
75 | 2 | Daniel Dehennin | |
76 | 2 | Daniel Dehennin | <pre> |
77 | 2 | Daniel Dehennin | system@build:~$ sudo /bin/sh -c "cat >> `expr /etc/schroot/chroot.d/$dist-$arch-sbuild*` <<EOT |
78 | 2 | Daniel Dehennin | command-prefix=eatmydata |
79 | 2 | Daniel Dehennin | EOT |
80 | 2 | Daniel Dehennin | " |
81 | 2 | Daniel Dehennin | </pre> |