GitPackagingSbuildCommon » Historique » Version 12
Daniel Dehennin, 22/02/2012 17:00
Les variables d’environnements doivent exister avant de créer le volume de build
| 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 | 2 | Daniel Dehennin | * sbuild: l’utilitaire de gestion des chroot |
| 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 | 4 | Daniel Dehennin | system@build:~$ sudo adduser buildd sudo |
| 39 | 2 | Daniel Dehennin | </pre> |
| 40 | 2 | Daniel Dehennin | |
| 41 | 2 | Daniel Dehennin | h2. Ajoute de l’utilisateur au groupe sbuild |
| 42 | 2 | Daniel Dehennin | |
| 43 | 5 | Fabrice Barconnière | L’accès aux outils de gestion de schroot est restreint aux membres du |
| 44 | 2 | Daniel Dehennin | groupe sbuild. |
| 45 | 2 | Daniel Dehennin | |
| 46 | 2 | Daniel Dehennin | Exécuter la commande suivante et copier le fichier comme indiqué : |
| 47 | 2 | Daniel Dehennin | |
| 48 | 2 | Daniel Dehennin | <pre> |
| 49 | 4 | Daniel Dehennin | system@build:~$ sudo sbuild-adduser buildd |
| 50 | 2 | Daniel Dehennin | </pre> |
| 51 | 2 | Daniel Dehennin | |
| 52 | 2 | Daniel Dehennin | h2. Création d’une paire de clef GPG |
| 53 | 2 | Daniel Dehennin | |
| 54 | 2 | Daniel Dehennin | L’outil sbuild créé des pseudos paquets pour la gestion des |
| 55 | 2 | Daniel Dehennin | Build-Depends lors de la construction des paquets. |
| 56 | 2 | Daniel Dehennin | |
| 57 | 2 | Daniel Dehennin | Cette paire de clef est locale à la machine |
| 58 | 2 | Daniel Dehennin | (@/var/lib/sbuild/apt-keys@) et spécifique à la procédure de build, il |
| 59 | 2 | Daniel Dehennin | n’y a nullement lieu de la publier. |
| 60 | 2 | Daniel Dehennin | |
| 61 | 2 | Daniel Dehennin | <pre> |
| 62 | 4 | Daniel Dehennin | buildd@build:~$ sbuild-update --keygen |
| 63 | 2 | Daniel Dehennin | </pre> |
| 64 | 2 | Daniel Dehennin | |
| 65 | 2 | Daniel Dehennin | Afin de générer de l’entropie, j’exécute dans un autre terminal la |
| 66 | 2 | Daniel Dehennin | commande suivante : |
| 67 | 2 | Daniel Dehennin | |
| 68 | 2 | Daniel Dehennin | <pre> |
| 69 | 4 | Daniel Dehennin | buildd@build:~$ find / -type f -exec sha512sum {} \; > /dev/null 2>&1 |
| 70 | 2 | Daniel Dehennin | </pre> |
| 71 | 2 | Daniel Dehennin | |
| 72 | 2 | Daniel Dehennin | Si vous êtes en SSH sur une machine (virtuelle ou physique), la frappe |
| 73 | 2 | Daniel Dehennin | de touche au clavier doit consommer autant d’entropie qu’elle n’en |
| 74 | 2 | Daniel Dehennin | fournie. |
| 75 | 2 | Daniel Dehennin | |
| 76 | 2 | Daniel Dehennin | h2. Mutualisation du cache apt |
| 77 | 2 | Daniel Dehennin | |
| 78 | 2 | Daniel Dehennin | <pre> |
| 79 | 4 | Daniel Dehennin | buildd@build:~$ sudo /bin/sh -c "echo /var/cache/apt/archives /var/cache/apt/archives none rw,bind 0 0 >>/etc/schroot/sbuild/fstab" |
| 80 | 2 | Daniel Dehennin | </pre> |
| 81 | 2 | Daniel Dehennin | |
| 82 | 2 | Daniel Dehennin | h2. Récupération des clefs publiques des dépôts |
| 83 | 2 | Daniel Dehennin | |
| 84 | 11 | Daniel Dehennin | La machine de build étant une debian, il faut ajouter les clefs GPG publique du projet ubuntu et de EOLE. |
| 85 | 2 | Daniel Dehennin | |
| 86 | 2 | Daniel Dehennin | <pre> |
| 87 | 9 | Daniel Dehennin | buildd@build:~$ wget http://eoleng.ac-dijon.fr/eoleng/eole-repository.key |
| 88 | 10 | Daniel Dehennin | buildd@build:~$ wget http://fr.archive.ubuntu.com/ubuntu/project/ubuntu-archive-keyring.gpg |
| 89 | 9 | Daniel Dehennin | buildd@build:~$ sudo apt-key add eole-repository.key |
| 90 | 10 | Daniel Dehennin | buildd@build:~$ sudo apt-key add ubuntu-archive-keyring.gpg |
| 91 | 2 | Daniel Dehennin | </pre> |
| 92 | 2 | Daniel Dehennin | |
| 93 | 12 | Daniel Dehennin | h2. Préparation de l’environnement |
| 94 | 12 | Daniel Dehennin | |
| 95 | 12 | Daniel Dehennin | Afin d’avoir des commandes réutilisables facilement, nous partirons du principe que : |
| 96 | 12 | Daniel Dehennin | |
| 97 | 12 | Daniel Dehennin | * la variable d’environnement @${YOUR_VG}@ contient le nom de votre groupe de volume ; |
| 98 | 12 | Daniel Dehennin | |
| 99 | 12 | Daniel Dehennin | * La variable d’environnement @${dist}@ contient le nom de la distribution ; |
| 100 | 12 | Daniel Dehennin | |
| 101 | 12 | Daniel Dehennin | * La variable d’environnement @${arch}@ contient le nom de l’architecture ; |
| 102 | 12 | Daniel Dehennin | |
| 103 | 12 | Daniel Dehennin | <pre> |
| 104 | 12 | Daniel Dehennin | buildd@buildd:~$ export YOUR_VG=build dist=lucid arch=amd64 |
| 105 | 12 | Daniel Dehennin | </pre> |
| 106 | 12 | Daniel Dehennin | |
| 107 | 12 | Daniel Dehennin | |
| 108 | 2 | Daniel Dehennin | h2. Création d’un volume logique dédié aux builds |
| 109 | 2 | Daniel Dehennin | |
| 110 | 2 | Daniel Dehennin | Ce volume sera monté dans chaque snapshot lors d’un build afin de ne |
| 111 | 2 | Daniel Dehennin | pas surcharger les snapshots de construction. |
| 112 | 2 | Daniel Dehennin | |
| 113 | 2 | Daniel Dehennin | <pre> |
| 114 | 2 | Daniel Dehennin | buildd@build:~$ sudo lvcreate -L20g -n var+lib+sbuild+build ${YOUR_VG} |
| 115 | 2 | Daniel Dehennin | buildd@build:~$ sudo mkfs.ext4 -L /var/lib/sbuild/build -m0 /dev/${YOUR_VG}/var+lib+sbuild+build |
| 116 | 2 | Daniel Dehennin | buildd@build:~$ sudo /bin/sh -c "echo /dev/${YOUR_VG}/var+lib+sbuild+build /var/lib/sbuild/build ext4 rw,noatime 0 2 >> /etc/fstab" |
| 117 | 2 | Daniel Dehennin | buildd@build:~$ sudo mount /var/lib/sbuild/build |
| 118 | 2 | Daniel Dehennin | </pre> |
| 119 | 1 | Daniel Dehennin | |
| 120 | 2 | Daniel Dehennin | h2. Création des environnements de build |
| 121 | 2 | Daniel Dehennin | |
| 122 | 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 : |
| 123 | 2 | Daniel Dehennin | |
| 124 | 8 | Daniel Dehennin | * Les volumes logiques ; |
| 125 | 2 | Daniel Dehennin | * Le système de fichier @btrfs@. |