Setup and Configuration


In order to have a better understanding of setup and capabilities, have a look at the Lab documentation.

Configuration file parameters

Look at the documentation in progress at

Dealing with Virtual Machines and Virtual Environments

Virtual Machines

In order to use a new VM (Virtual Machine) with pb, you have to follow a 4-step approach:

  1. Create an appropriate VM using pb (or not if you prefer to create it outside with your preferred tools)
    pb -p prj -m os-ver-arch -i /path/to/os.ver.arch.iso newver

where you pass to the pb command the ISO image of your distribution media. If you prefer to deploy using PXE e.g. you have to use instead the qemu command directly. At the end of the installation, pb makes recommendations on what minimum packages have to be present (sshd and sudo e.g.) and their minimal setup. Something that has to be done manually, at worst, before being able to launch the second phase.

  1. Set up the VM so it gets all what is needed to run pb in it:
    pb -p prj -m os-ver-arch setupvm

This step will install pb inside your VM, create a dedicated account for building packages, exchange dedicated ssh keys from your own account, and setup sudo rights so the build can be made non-interactively. The first time ou call that command, it will ask you the root passwd of the VM, in order to setup up auhtentication. Each time you want to re-align pb versiosn between your host and the guest, you'll have to re-run that command. The root passwd won't be asked this time, so it can be automated easily. (If you don't precise a specific VM to work on, all the the one declared in your configuration file will be updated).

  1. Prepare the VM for your project
    pb -p prj -m os-ver-arch prepvm

This step will install all the required dependencies for your prj project inside the VM. It will analyze the requirements coming from the spec file, or control file and launch the installation of the required packages.

  1. Finally you're able to use your VM to build your software packages:
    pb -p prj -m os-ver-arch sbx2vm

Note that you can specify multiple VMs separated by ','.

Virtual Environments

Also note that you can do the same with Virtual Environments (VE) replacing the vm suffix by the ve one. This will work for Docker containers as well, and you can use the -T docker option for that.

CentOS container

Here is how to use with a CentOS 7 container

# Pull the upstream official container (optional)
$ docker pull centos:7
# Create a new pb VE from it
$ pb -p pb -T docker -m centos-7-x86_64 newve -i centos:7
Project: pb
Action: newve
Installing dependencies perl perl-Data-Dumper sudo wget tar make gzip in Docker container pb:centos-7-x86_64... OK
$ docker images | grep centos
pb                                 centos-7-x86_64                         86805ae6031a        1 minutes ago        323.2 MB
centos                             7                                       50dae1ee8677        2 days ago           196.7 MB
# Set it up for pb usage
$ pb -p pb -T docker -m centos-7-x86_64 setupve
Project: pb
Action: setupve
Sources handled (VEScript): /users/bruno/pb/pbdelivery/setupv-centos-7-x86_64
Executing pbscript on ////test/src if needed... OK
[centos-7-x86_64] [centos-7-x86_64] Sending build context to Docker daemon   149 kB
[centos-7-x86_64] Step 1 : FROM pb:centos-7-x86_64
[centos-7-x86_64]  ---> 86805ae6031a
[centos-7-x86_64] Step 2 : MAINTAINER aka pb
[centos-7-x86_64]  ---> Running in 36142ca4be24
[centos-7-x86_64]  ---> d80b71153252
[centos-7-x86_64] Removing intermediate container 36142ca4be24
[centos-7-x86_64] Step 3 : USER root
[centos-7-x86_64]  ---> Running in 4561aedb8f0c
[centos-7-x86_64]  ---> 9362de40fbc3
[centos-7-x86_64] Removing intermediate container 4561aedb8f0c
[centos-7-x86_64] Step 4 : RUN mkdir -p ////test/src
[centos-7-x86_64]  ---> Running in 7797901a9ab0
[centos-7-x86_64]  ---> 129e6afe6317
[centos-7-x86_64] Removing intermediate container 7797901a9ab0
[centos-7-x86_64] Step 5 : RUN cd ////test/src ; for i in  setupv-centos-7-x86_64; do if [ -f $i ]; then rm -f $i; fi; done
[centos-7-x86_64] pb -h... OK
[centos-7-x86_64] pb (aka Version 0.14.1-2120
$ docker images | grep centos
pb                                 centos-7-x86_64-pb                      f45370173958        3 minutes ago       374.2 MB
pb                                 centos-7-x86_64                         86805ae6031a        5 minutes ago       323.2 MB
centos                             7                                       50dae1ee8677        2 days ago          196.7 MB
# Now prepare a Docker image for the project you want to use
$ pb -p pb -T docker -m centos-7-x86_64 prepve
pb                                 centos-7-x86_64-pb                      f45370173958        7 minutes ago       374.2 MB
pb                                 centos-7-x86_64-pb-pb                   7bd43365ae5b        8 minutes ago       377.2 MB
pb                                 centos-7-x86_64                         86805ae6031a        10 minutes ago      323.2 MB
centos                             7                                       50dae1ee8677        2 days ago          196.7 MB
# And use it
$ pb -p pb -T docker -m centos-7-x86_64 sbx2setupve
Project: pb
Action: sbx2setupve
Packages: project-builder,rpmbootstrap,pbmkbm,ProjectBuilder

Management of project-builder 0.14.1-0.20160722124307.s2117
Exporting /users/bruno/pb/devel/pb from svn+ssh to /users/bruno/pb/pbdelivery/project-builder- ... OK
Generating fake ChangeLog for test version
Preparing delivery ...

Gentoo Container


$ docker run -ti gentoo/stage3-amd64 /bin/bash
# emerge-webrsync
# exit
$ docker ps -l
CONTAINER ID    IMAGE                 COMMAND      CREATED             STATUS                    PORTS     NAMES
a40e2247b233    gentoo/stage3-amd64   "/bin/bash"  9 minutes ago       Exited (0) 3 seconds ago            sick_hodgkin
$ docker commit a40e2247b233 gentoo:latest
$ pb -p prj -m gentoo-nover-x86_64 -T docker -i gentoo newve

Installation on Linux distributions

deb based distributions

You should add the apt sources list file corresponding to your distribution and use it. E.g. on Ubuntu 18.04:

# apt-get update
# apt-get install apt-transport-https ca-certificates curl software-properties-common
# cd /etc/apt/sources.list.d/
# wget
# wget -O- | apt-key add -
(in case of issue you can try instead: # apt-key adv --keyserver hkp:// --recv-keys 0x6BA8C2D220EBFB0E)
# apt-get update
# apt-get install project-builder

rpm based distributions

You should add the repo file corresponding to your distribution and use it. E.g. on CentOS 7:

# cd /etc/yum.repos.d
# wget
# rpm -Uvh
# yum update
# yum install project-builder

ebuild based distributions

Non upstream usage of

Using patches

If you're not upstream, you may need to apply patches to the software you're packaging. In short, if you create a pbpatch directory (ex: under your package directory, and order your patches in it (00-patch-to-do-a, 01-patch-to-do-b, ...) , and then use the macros PBPATCHSRC and PBPATCHCMD in your spec file (ex: you should be able to produce rpms the way you want.

Last modified 4 years ago Last modified on Apr 11, 2020, 1:31:11 AM
Note: See TracWiki for help on using the wiki.