PbuilderHowto
Size: 7566
Comment: # Pointer to bug 57284
|
Size: 7430
Comment: update to edgy
|
Deletions are marked like this. | Additions are marked like this. |
Line 7: | Line 7: |
The following assume you want to install ''breezy''. If you need a ''hoary'' or ''dapper'' chroot, then exchange ''breezy'' with the appropriate distribtion. == Installing Pbuilder on dapper == The latest pbuilder package in dapper (0.145ubuntu3) should work out of the box. You only need to install it and debootstrap. Then run: |
The following assume you want to install ''edgy''. If you need a ''dapper'' or ''feisty'' chroot, then exchange ''edgy'' with the appropriate distribution. == Installing Pbuilder on edgy == The latest pbuilder package in Edgy (0.155ubuntu3) should work out of the box. You only need to install it and debootstrap. Then run: |
Line 20: | Line 20: |
{i} Note: If you get following error ''"debootstrap does not exist"'' either install '''debootstrap''' or run pbuilder with --debootstrap cdebootstrap option (you probably have '''cdebootstrap''' installed). == Installing Pbuilder on warty, hoary, breezy == |
{i} Note: If you get the error ''"debootstrap does not exist"'', install '''debootstrap'''. == Installing Pbuilder on Warty, Hoary or Breezy == |
Line 52: | Line 52: |
Save the file and run the command below to build your breezy chroot: {{{ sudo pbuilder create --distribution breezy |
Save the file and run the command below to build your Edgy chroot: {{{ sudo pbuilder create --distribution edgy |
Line 60: | Line 60: |
If you reach this point you now have a Breezy chroot located at /var/cache/pbuilder ready to build a package. We will get a Debian source package from Ubuntu repository to test it. | If you reach this point you now have a Edgy chroot located at /var/cache/pbuilder ready to build a package. We will get a Debian source package from Ubuntu repository to test it. |
Line 66: | Line 66: |
deb-src http://archive.ubuntu.com/ubuntu breezy main restricted | deb-src http://archive.ubuntu.com/ubuntu edgy main restricted |
Line 81: | Line 81: |
You can build the package using your Breezy chroot with the command: | You can build the package using your Edgy chroot with the command: |
Line 92: | Line 92: |
I recommend you update your chroot before each build, to this task use the comand below: | I recommend you update your chroot before each build, to this task use the command below: |
Line 103: | Line 103: |
OTHERMIRROR="deb http://archive.ubuntu.com/ubuntu breezy universe multiverse" | OTHERMIRROR="deb http://archive.ubuntu.com/ubuntu edgy universe multiverse" |
Line 109: | Line 109: |
sudo pbuilder update --distribution breezy --override-config | sudo pbuilder update --distribution edgy --override-config |
Line 114: | Line 114: |
If you want to participate in the current release cycle, you will want to have a EdgyEft chroot. Sometimes, the development version may not be installable directly. In this case, you have to install the latest release first, and upgrade then to development release * change all occurences of {{{dapper}}} in /etc/pbuilderrc and /etc/pbuilder/apt.config/ to {{{edgy}}} |
If you want to participate in the current release cycle, you will want to have a FeistyFawn chroot. Sometimes, the development version may not be installable directly. In this case, you have to install the latest release first, and upgrade then to development release * change all occurences of {{{edgy}}} in /etc/pbuilderrc and /etc/pbuilder/apt.config/ to {{{feisty}}} |
Line 123: | Line 123: |
When you work with packages, you often want to have multple pbuilders on your machine, if for example you want to backport to Breezy while developping on Dapper, or test packages on Sid to track bugs. | When you work with packages, you often want to have multple pbuilders on your machine, if for example you want to backport to Dapper while developing on Edgy, or test packages on Sid to track bugs. |
Line 205: | Line 205: |
Rename it to the distribution you want, e.g. pbuilder-dapper, then put it in /usr/local/bin/ | Rename it to the distribution you want, e.g. pbuilder-feisty, then put it in /usr/local/bin/ |
Line 208: | Line 208: |
sudo chmod +x /usr/local/bin/pbuilder-dapper }}} Then you should create a /var/cache/pbuilder/DISTRIBUTION directory (e.g. /var/cache/pbuilder/dapper/), put the correct configuration files there (see the previous sections) then run {{{pbuilder-dapper create}}} to create the pbuilder in this location. You can then do the same for other distributions (e.g. pbuilder-breezy, pbuilder-sarge, pbuilder-sid, etc.). |
sudo chmod +x /usr/local/bin/pbuilder-feisty }}} Then you should create a /var/cache/pbuilder/DISTRIBUTION directory (e.g. /var/cache/pbuilder/feisty/), put the correct configuration files there (see the previous sections) then run {{{pbuilder-feisty create}}} to create the pbuilder in this location. You can then do the same for other distributions (e.g. pbuilder-edgy, pbuilder-sarge, pbuilder-sid, etc.). |
Introduction
This document describes the steps to setup a chroot jail for building Ubuntu packages using pbuilder. It is recommended for Ubuntu maintainers or anyone interested in building packages using Ubuntu.
You can build packages without pbuilder but you must already have all the build dependencies of the package that you are building installed on your running system.
The following assume you want to install edgy. If you need a dapper or feisty chroot, then exchange edgy with the appropriate distribution.
Installing Pbuilder on edgy
The latest pbuilder package in Edgy (0.155ubuntu3) should work out of the box. You only need to install it and debootstrap. Then run:
sudo pbuilder create
and then
sudo pbuilder build my-package_1.0.dsc
Note: If you get the error "debootstrap does not exist", install debootstrap.
Installing Pbuilder on Warty, Hoary or Breezy
Install pbuilder package and debootstrap.
Edit /etc/pbuilder/pbuilderrc changing the following directives:
MIRRORSITE=http://archive.ubuntu.com/ubuntu DISTRIBUTION=breezy
Since pbuilder will complain about unauthenticated packages, you have to allow unauthenticated packages. You can make it like so:
Edit your /etc/pbuilder/pbuilderrc:
APTCONFDIR="/etc/pbuilder/apt.config/"
Now you'll copy needed files of /etc/apt to it and
sudo -s mkdir /etc/pbuilder/apt.config/ cp -ar /etc/apt/* /etc/pbuilder/apt.config/ echo "APT::Get::AllowUnauthenticated 1;" >> /etc/pbuilder/apt.config/apt.conf.d/allow-unauthenticated exit
NOTE: Make sure to remove 99update-notifier from /etc/pbuilder/apt.config/apt.conf.d/ if you have copied it in the last step. It can potentially break future updates to your pbuilder chroot, as update-notifier won't normally be installed.
Save the file and run the command below to build your Edgy chroot:
sudo pbuilder create --distribution edgy
Rebuilding a package
If you reach this point you now have a Edgy chroot located at /var/cache/pbuilder ready to build a package. We will get a Debian source package from Ubuntu repository to test it.
To check if you can download source packages, you will need an uncommented deb-src line in /etc/apt/sources.list, containing:
deb-src http://archive.ubuntu.com/ubuntu edgy main restricted
If the line above is there but not uncommented, uncomment it. Make sure your package index files are synchronized so that apt-get knows where to find the sources:
sudo apt-get update
We will build bc, a simple calculator, from source, let's download the debian source package from ubuntu repository:
sudo apt-get source bc
You can build the package using your Edgy chroot with the command:
sudo pbuilder build *.dsc
In the end, the binary and source package will be at /var/cache/pbuilder/result/
Updating a chroot
I recommend you update your chroot before each build, to this task use the command below:
sudo pbuilder update
Universe support
If you want to rebuild a package from universe or build a new one that needs a package out of main you will need to edit /etc/pbuilderrc again, changing:
OTHERMIRROR="deb http://archive.ubuntu.com/ubuntu edgy universe multiverse"
Now you need to update your chroot with the new configuration:
sudo pbuilder update --distribution edgy --override-config
Upgrading to Latest Development Release
If you want to participate in the current release cycle, you will want to have a FeistyFawn chroot. Sometimes, the development version may not be installable directly. In this case, you have to install the latest release first, and upgrade then to development release
change all occurences of edgy in /etc/pbuilderrc and /etc/pbuilder/apt.config/ to feisty
sudo pbuilder update --override-config
- use the --override-config option every time you run the update
Multiple pbuilders
When you work with packages, you often want to have multple pbuilders on your machine, if for example you want to backport to Dapper while developing on Edgy, or test packages on Sid to track bugs.
To do that, you can adapt the file in /usr/share/doc/pbuilder/examples/pbuilder-distribution.sh, which by default contains :
# script from Jamin W. Collins BTS: #255165 # name this script 'pbuilder-woody', 'pbuilder-sid', 'pbuilder-sarge', 'pbuilder-experimental' etc. # # The script currently contains a minor, but harmless error # See https://launchpad.net/distros/ubuntu/+source/pbuilder/+bug/57284 OPERATION=$1 DISTRIBUTION=`basename $0 | cut -f2 -d '-'` PROCEED=false BASE_DIR="$HOME/pbuilder" case $OPERATION in create|update|build|clean|login|execute ) PROCEED=true ;; esac if ( $PROCEED == true ) then shift sudo pbuilder $OPERATION \ --basetgz $BASE_DIR/$DISTRIBUTION-base.tgz \ --distribution $DISTRIBUTION \ --buildresult $BASE_DIR/result $@ else echo "Invalid command..." echo "Valid commands are:" echo " create" echo " update" echo " build" echo " clean" echo " login" echo " execute" exit 1 fi
Rename it to the distribution you want, e.g. pbuilder-dapper, then put it in /usr/local/bin/ Since /var/cache/pbuilder is the common directory used for pbuilders, I recommend changing the script to the following :
# script from Jamin W. Collins BTS: #255165 # name this script 'pbuilder-woody', 'pbuilder-sid', 'pbuilder-sarge' etc. # # The script currently contains a minor, but harmless error # See https://launchpad.net/distros/ubuntu/+source/pbuilder/+bug/57284 OPERATION=$1 DISTRIBUTION=`basename $0 | cut -f2 -d '-'` PROCEED=false BASE_DIR="/var/cache/pbuilder" case $OPERATION in create|update|build|clean|login|execute ) PROCEED=true ;; esac if ( $PROCEED == true ) then shift sudo /usr/sbin/pbuilder $OPERATION \ --basetgz $BASE_DIR/$DISTRIBUTION/base.tgz \ --distribution $DISTRIBUTION \ --configfile $BASE_DIR/$DISTRIBUTION/pbuilderrc \ --aptconfdir $BASE_DIR/$DISTRIBUTION/apt.config \ --buildresult $BASE_DIR/$DISTRIBUTION/result $@ else echo "Invalid command..." echo "Valid commands are:" echo " create" echo " update" echo " build" echo " clean" echo " login" echo " execute" exit 1 fi
Rename it to the distribution you want, e.g. pbuilder-feisty, then put it in /usr/local/bin/ To make it executable, type (use whatever name you have given the script):
sudo chmod +x /usr/local/bin/pbuilder-feisty
Then you should create a /var/cache/pbuilder/DISTRIBUTION directory (e.g. /var/cache/pbuilder/feisty/), put the correct configuration files there (see the previous sections) then run pbuilder-feisty create to create the pbuilder in this location. You can then do the same for other distributions (e.g. pbuilder-edgy, pbuilder-sarge, pbuilder-sid, etc.).
See also
pbuilder User's Manual: http://www.netfort.gr.jp/~dancer/software/pbuilder-doc/pbuilder-doc.html
["CategoryMOTU"]
PbuilderHowto (last edited 2020-01-28 13:36:36 by paelzer)