专注虚拟化性能优化,硬件显卡网卡虚拟加速,面向容器的轻量虚拟化开发 永远的Linux Geeker!
分类: LINUX
2019-01-25 02:14:04
One of main duty of Debian mainter is build package, there are so many ways to doing so. I am here just introduce pbuilder, a simple and straightforwad package tool in Debian.
Use apt to install pbuilder and the hlinux-archive-keyring so we can verify the GPG signature on the archive
The first step is to create a chroot image that will be used by pbuilder to perform clean builds:
Create a $HOME/.pbuilderrc file with a couple of useful arguments:
Building the initial chroot takes a while, but does not need to be performed very many times. Run pbduiler create to create the initial chroot:
$ sudo -E pbuilder create --distribution sid \ --debootstrapopts \ --keyring=/usr/share/keyrings/debian-archive-keyring.gpg \ --debootstrapopts --include=debian-archive-keyring
We use "sudo -E" to preserve the environment variables of the invoking shell, mainly so that the user's local .pbuilderrc is read and not root's .pbuilderrc. We also install the debian-archive-keyring package inside the chroot so that we can verify debian packages installing inside the chroot.
Some packages have not made it to the repo yet but are needed to build Go packages properly. Download the debs and copy them to the pbuilder cache:
This step will not be necessary once these packages are imported into debian top-of-tree.
We will be building packages that have dependencies on previous things we have built. To make this work, we need to tell pbuilder to configure an apt repository for all the packages found in the pbuilder results directory in /var/cache/pbuilder/result. Add the following lines to $HOME/.pbuilderrc:
Create a hook to create the apt repository files:
We can also create a hook to run lintian over the build results. This will help the upload process by displaying lintian errors earlier in the development process
The last command checks out the source code for the package from the pristine-tar branch, and then calls pdebuild to build the package.