GitPackagingSbuildCommon » Historique » Version 18
Daniel Dehennin, 15/11/2012 10:19
Ajout de la version de sbuild utilisé
1 | 1 | Daniel Dehennin | {{toc}} |
---|---|---|---|
2 | 1 | Daniel Dehennin | |
3 | 1 | Daniel Dehennin | |
4 | 2 | Daniel Dehennin | h1. Mise en place d’un environnement de compilation personnel |
5 | 1 | Daniel Dehennin | |
6 | 2 | Daniel Dehennin | Sur une machine dédiée au build, nous avons besoin : |
7 | 1 | Daniel Dehennin | |
8 | 2 | Daniel Dehennin | * D’un utilisateur dédié au build ; |
9 | 1 | Daniel Dehennin | |
10 | 2 | Daniel Dehennin | * D’un groupe de volume logique d’une taille suffisante pour les |
11 | 2 | Daniel Dehennin | chroot ; |
12 | 1 | Daniel Dehennin | |
13 | 2 | Daniel Dehennin | * De suffisamment d’espace libre sur le groupe de volume pour les |
14 | 2 | Daniel Dehennin | snapshots. |
15 | 2 | Daniel Dehennin | |
16 | 2 | Daniel Dehennin | h2. Installation des paquets nécessaires |
17 | 2 | Daniel Dehennin | |
18 | 2 | Daniel Dehennin | Les deux paquets nécessaire à la création et la gestion des |
19 | 2 | Daniel Dehennin | environnements sont les suivants : |
20 | 2 | Daniel Dehennin | |
21 | 18 | Daniel Dehennin | * sbuild: l’utilitaire de gestion des chroot en version @0.63.2-1@ ou supérieure disponible sur Wheezy |
22 | 2 | Daniel Dehennin | * debootstrap: l’utilitaire d’installation |
23 | 2 | Daniel Dehennin | |
24 | 2 | Daniel Dehennin | <pre> |
25 | 4 | Daniel Dehennin | system@build:~$ sudo apt-get install sbuild debootstrap |
26 | 2 | Daniel Dehennin | </pre> |
27 | 2 | Daniel Dehennin | |
28 | 2 | Daniel Dehennin | h2. Création d’un utilisateur pour le build |
29 | 2 | Daniel Dehennin | |
30 | 2 | Daniel Dehennin | Ce dernier recevra les logs dans son répertoire personnel. |
31 | 2 | Daniel Dehennin | |
32 | 2 | Daniel Dehennin | Il est cependant possible d’utiliser votre compte utilisateur, mais |
33 | 2 | Daniel Dehennin | sera indispensable lors de la mise en place d’un système de build |
34 | 2 | Daniel Dehennin | automatique. |
35 | 2 | Daniel Dehennin | |
36 | 2 | Daniel Dehennin | <pre> |
37 | 4 | Daniel Dehennin | system@build:~$ sudo adduser buildd |
38 | 2 | Daniel Dehennin | </pre> |
39 | 2 | Daniel Dehennin | |
40 | 2 | Daniel Dehennin | h2. Ajoute de l’utilisateur au groupe sbuild |
41 | 2 | Daniel Dehennin | |
42 | 5 | Fabrice Barconnière | L’accès aux outils de gestion de schroot est restreint aux membres du |
43 | 2 | Daniel Dehennin | groupe sbuild. |
44 | 2 | Daniel Dehennin | |
45 | 2 | Daniel Dehennin | Exécuter la commande suivante et copier le fichier comme indiqué : |
46 | 2 | Daniel Dehennin | |
47 | 2 | Daniel Dehennin | <pre> |
48 | 4 | Daniel Dehennin | system@build:~$ sudo sbuild-adduser buildd |
49 | 2 | Daniel Dehennin | </pre> |
50 | 2 | Daniel Dehennin | |
51 | 2 | Daniel Dehennin | h2. Création d’une paire de clef GPG |
52 | 2 | Daniel Dehennin | |
53 | 2 | Daniel Dehennin | L’outil sbuild créé des pseudos paquets pour la gestion des |
54 | 2 | Daniel Dehennin | Build-Depends lors de la construction des paquets. |
55 | 2 | Daniel Dehennin | |
56 | 2 | Daniel Dehennin | Cette paire de clef est locale à la machine |
57 | 2 | Daniel Dehennin | (@/var/lib/sbuild/apt-keys@) et spécifique à la procédure de build, il |
58 | 2 | Daniel Dehennin | n’y a nullement lieu de la publier. |
59 | 2 | Daniel Dehennin | |
60 | 2 | Daniel Dehennin | <pre> |
61 | 4 | Daniel Dehennin | buildd@build:~$ sbuild-update --keygen |
62 | 2 | Daniel Dehennin | </pre> |
63 | 2 | Daniel Dehennin | |
64 | 2 | Daniel Dehennin | Afin de générer de l’entropie, j’exécute dans un autre terminal la |
65 | 2 | Daniel Dehennin | commande suivante : |
66 | 2 | Daniel Dehennin | |
67 | 2 | Daniel Dehennin | <pre> |
68 | 4 | Daniel Dehennin | buildd@build:~$ find / -type f -exec sha512sum {} \; > /dev/null 2>&1 |
69 | 2 | Daniel Dehennin | </pre> |
70 | 2 | Daniel Dehennin | |
71 | 2 | Daniel Dehennin | Si vous êtes en SSH sur une machine (virtuelle ou physique), la frappe |
72 | 2 | Daniel Dehennin | de touche au clavier doit consommer autant d’entropie qu’elle n’en |
73 | 2 | Daniel Dehennin | fournie. |
74 | 2 | Daniel Dehennin | |
75 | 2 | Daniel Dehennin | h2. Mutualisation du cache apt |
76 | 2 | Daniel Dehennin | |
77 | 1 | Daniel Dehennin | <pre> |
78 | 13 | Daniel Dehennin | system@build:~$ sudo /bin/sh -c "echo /var/cache/apt/archives /var/cache/apt/archives none rw,bind 0 0 >>/etc/schroot/sbuild/fstab" |
79 | 2 | Daniel Dehennin | </pre> |
80 | 2 | Daniel Dehennin | |
81 | 2 | Daniel Dehennin | h2. Récupération des clefs publiques des dépôts |
82 | 2 | Daniel Dehennin | |
83 | 11 | Daniel Dehennin | La machine de build étant une debian, il faut ajouter les clefs GPG publique du projet ubuntu et de EOLE. |
84 | 1 | Daniel Dehennin | |
85 | 2 | Daniel Dehennin | <pre> |
86 | 13 | Daniel Dehennin | system@build:~$ wget http://eoleng.ac-dijon.fr/eoleng/eole-repository.key |
87 | 13 | Daniel Dehennin | system@build:~$ wget http://fr.archive.ubuntu.com/ubuntu/project/ubuntu-archive-keyring.gpg |
88 | 13 | Daniel Dehennin | system@build:~$ sudo apt-key add eole-repository.key |
89 | 13 | Daniel Dehennin | system@build:~$ sudo apt-key add ubuntu-archive-keyring.gpg |
90 | 2 | Daniel Dehennin | </pre> |
91 | 2 | Daniel Dehennin | |
92 | 12 | Daniel Dehennin | h2. Préparation de l’environnement |
93 | 12 | Daniel Dehennin | |
94 | 12 | Daniel Dehennin | Afin d’avoir des commandes réutilisables facilement, nous partirons du principe que : |
95 | 12 | Daniel Dehennin | |
96 | 12 | Daniel Dehennin | * la variable d’environnement @${YOUR_VG}@ contient le nom de votre groupe de volume ; |
97 | 1 | Daniel Dehennin | |
98 | 12 | Daniel Dehennin | * La variable d’environnement @${dist}@ contient le nom de la distribution ; |
99 | 12 | Daniel Dehennin | |
100 | 12 | Daniel Dehennin | * La variable d’environnement @${arch}@ contient le nom de l’architecture ; |
101 | 12 | Daniel Dehennin | |
102 | 12 | Daniel Dehennin | <pre> |
103 | 13 | Daniel Dehennin | system@buildd:~$ export YOUR_VG=build dist=lucid arch=amd64 |
104 | 12 | Daniel Dehennin | </pre> |
105 | 12 | Daniel Dehennin | |
106 | 17 | Benjamin Bohard | En partant d'une installation utilisant @partman-auto@, le groupe de volume est déjà complet. Si la recette est bien faite, un volume logique a été créé avec l'option @method{ keep }@. Ce volume (nommé par défaut keep_1) peut-être supprimé et l’espace libéré ainsi peut-être réutilisé. |
107 | 1 | Daniel Dehennin | |
108 | 15 | Daniel Dehennin | <pre> |
109 | 15 | Daniel Dehennin | system@build:~$ sudo lvchange -a n /dev/${YOUR_VG}/keep_1 |
110 | 15 | Daniel Dehennin | system@build:~$ sudo lvremove /dev/${YOUR_VG}/keep_1 |
111 | 15 | Daniel Dehennin | </pre> |
112 | 15 | Daniel Dehennin | |
113 | 15 | Daniel Dehennin | |
114 | 13 | Daniel Dehennin | h2. Création d’un volume logique dédié aux builds |
115 | 2 | Daniel Dehennin | |
116 | 1 | Daniel Dehennin | Ce volume sera monté dans chaque snapshot lors d’un build afin de ne |
117 | 14 | Benjamin Bohard | pas surcharger les snapshots de construction. |
118 | 14 | Benjamin Bohard | |
119 | 14 | Benjamin Bohard | <pre> |
120 | 14 | Benjamin Bohard | system@build:~$ sudo lvcreate -L20g -n var+lib+sbuild+build ${YOUR_VG} |
121 | 14 | Benjamin Bohard | system@build:~$ sudo mkfs.ext4 -L /var/lib/sbuild/build -m0 /dev/${YOUR_VG}/var+lib+sbuild+build |
122 | 14 | Benjamin Bohard | system@build:~$ sudo /bin/sh -c "echo /dev/${YOUR_VG}/var+lib+sbuild+build /var/lib/sbuild/build ext4 rw,noatime 0 2 >> /etc/fstab" |
123 | 14 | Benjamin Bohard | system@build:~$ sudo mount /var/lib/sbuild/build |
124 | 16 | Daniel Dehennin | system@build:~$ sudo chown sbuild:sbuild /var/lib/sbuild/build |
125 | 16 | Daniel Dehennin | system@build:~$ sudo chmod 2770 /var/lib/sbuild/build |
126 | 14 | Benjamin Bohard | </pre> |
127 | 14 | Benjamin Bohard | |
128 | 2 | Daniel Dehennin | h2. Création des environnements de build |
129 | 2 | Daniel Dehennin | |
130 | 12 | Daniel Dehennin | La gestion des environnements de build est faite par schroot et peut utiliser plusieurs systèmes afin de partager une image de base et ainsi gagner du temps lors des compilation : |
131 | 2 | Daniel Dehennin | |
132 | 8 | Daniel Dehennin | * Les volumes logiques ; |
133 | 2 | Daniel Dehennin | * Le système de fichier @btrfs@. |