wiki:WikiStart

Version 19 (modified by Bruno Cornec, 16 years ago) ( diff )

Adds a netperf example (I)

Welcome to Project-Builder Wiki

Design Ideas around the project-builder.org project

Since 2005 that I took over the maintenance of the MondoRescue project, I have passed time developing code on the periphery of the project to allow me to easily build packages from Subversion, deliver them, manage them, ...

I met a lot of Open Source project which are suffering from the same barrier for their adoption as mondo suffered in the past: without native packaging for your distribution you have much less people testing your software, trying it, less chance to be integrated in distributions, ...

Then I wanted to also work on another project called dploy.org which uses the great LinuxCOE. However that LinuxCOE project had exactly the same issue as previously mentioned, no packaging, on install from CVS, so smaller community. And in order for me to put something on a prouction server, I want it packaged :-)

So I decided it could be a good idea to reuse the scripts made for mondo to package LinuxCOE. However, they were too specific, even if the ideas could be reused (that was my 3rd generation of build scripts, so ideas were more advanced than the code).

Technical ideas around the project-builder.org (aka pb) project

Example of use on netperf (simple example)

As an example of how easy (or not :-) Project-Builder is to use, I decide to write that tutorial as a gift for another project which deserves it, the [www.netperf.org NetPerf] project .

You first have to create a .pbrc configuration file in your home directory, which will setup things globally:

$ cat > ~/.pbrc << EOF
#
# Root of the temp file used to store info on the project
# Is also used to determine the root directory of the project
# No default option allowed here as they need to be all different
#
pbrc netperf = $ENV{'HOME'}/netperf/src
EOF

Then get the bits of the project you want to package. It could be using a SVN or CVS access if there is such a thing, or by downloading (at worse) the tar file of the project. Then extract that under a newly created directory that you referenced in your project configuration file:

$ cd /tmp
$ wget ftp://ftp.netperf.org/netperf/netperf-2.4.4.tar.bz2
$ mkdir $HOME/netperf/src
$ cd $HOME/netperf/src
$ tar xvfj /tmp/netperf-2.4.4.tar.bz2

Example of use on LinuxCOE (more complex example)

When the project was mature enough to package correctly mondorescue and itself, I then decided it was time to try it on another unrelated project to see how difficult it could be and document that experience so that others could also begin to use pb for their own project.

You first have to edit your .pbrc configuration file in your home directory, which will setup things globally.

Here are my .pbrc LinuxCOE relative entries:

$ grep -E '^#|linuxcoe|default' ~/.pbrc
#
# Root of the temp file used to store info on the project
# Is also used to determine the root directory of the project
# No default option allowed here as they need to be all different
#
pbrc linuxcoe = /users/bruno/LinuxCOE/cvs/pbrc
#
# Which CMS system is used
#
cms linuxcoe = cvs
cms default = svn
#
# Packager label
#
packager linuxcoe = "Bruno Cornec <bruno@project-builder.org>"
#
# For CVS managed projects
# (Optional)
#
cvsroot linuxcoe = ":pserver:anonymous@linuxcoe.cvs.sourceforge.net:/cvsroot/linuxcoe"
#
# For Virtual machines management
# Naming convention to follow: distribution name (as per ProjectBuilder::Distribution)
# followed by '_' and by release number
# a .vmtype extension will be added to the resulting string
# a rhel_3 here means that the VM will be named rhel_3.qemu
#
vmlist linuxcoe = mandriva_2007.1
#
# Valid values for vmtype are
# qemu, (vmware, xen, ... TBD)
vmtype default = qemu

Should be obvious for the content. Note that the format is in general

pb-keyword project = value

which means that here I named my project for pb linuxcoe (I can choose what I want be need to be consistent everywhere).

Then you have to go under the directory you planned to store the project you want to package (/users/bruno/LinuxCOE/cvs) and you have to create there a directory pbconf which will contain everything related to project-builder around your own project. The pbrc file you indicated in the configuation file will be managed automatically by pb and you don't have to care of it. Just to reference where it will be, which will in turn give to project-builder the information of the project's directory.

$ cd /users/bruno/LinuxCOE/cvs
$ mkdir pbconf

The main configuration file under pbconf should be named with the name of the project (the one used above in the .pbrc file) with the pb extension. the one created for LinuxCOE looks like that:

$ cat linuxcoe.pb
#
# Project Builder configuration file
# For project LinuxCOE
#
# $Id$
#

#
# Global version/tag for the project
#
projver linuxcoe = devel
projtag linuxcoe = 1

# Adapt to your needs:
# Optional if you need to overwrite the global values above
#
pkgver nil
pkgtag nil


# Hash of default package/package directory
#
defpkgdir systemdesigner = SystemDesigner

# Hash of additional package/package directory
#
extpkgdir systemdesigner-docs = docs
extpkgdir systemdesigner-fedora = SystemDesigner-Fedora

# Hash of valid version names
#
version devel
version stable

# List of additional files on which to apply filters
# Files are mentioned relatively to pbroot
#
filteredfiles systemdesigner =
filteredfiles systemdesigner-docs = 

I inform pb that I will produce packages with a verion-tag of devel-1, that no local package should have a different version than the project version (pkgver/pkgtag), that my default package will be systemdesigner (pb will work on it by default all the time) and that additional packages it may deal with are systemdesigner-docs and systemdesigner-fedora. In addition to standard version with numbers, pb will accpet the version devel and stable. And finally, I give to the name of all files (per package) that it will have to filter to produce the packages - more on that later on.

With that minimal configuration, you may begin to test project-builder. Try to produce a compressed tar file of your project.

$ export PBPROJ=linuxcoe
$ pb -r `pwd` cms2build

The export order will allow you to avoid precising all the time to pb that you work on the linuxcoe project. If you prefer, you can invoke pb as follows:

pb -p linuxcoe -r `pwd` cms2build

or make a shell alias, or whatever is convenient for you.

The -r option is needed at start to create the pbrc file you mentioned in your .pbrc configuration file initially. After that first invocation, you will only need to call it again, if you change the version you want to generate.

cms2build is generally the first action pb will be asked to execute as it will produce a compressed tar ball from your Confoguration Management System repository. pb is CMS agnostic, and can currently handle friendly SVN and CVS, and can be easily adapted to support others.

As a result of your commands you should see something like that:

$ pb -r `pwd` cms2build
Project linuxcoe
Action: cms2build
Packages: systemdesigner

Management of systemdesigner devel-1 (rev CVS)
Exporting /users/bruno/LinuxCOE/cvs/SystemDesigner from CVS... OK
Extracting log info from CVS... OK
Build files generated for
No Build files found for mandriva-2007.1
Creating systemdesigner tar files compressed... OK
Under /users/bruno/LinuxCOE/cvs/delivery/systemdesigner-devel.tar.gz

So it creates for you the right tar file at the right place. But it warns you that no build file was found for your project. Normal we haven't created one yet ;-) It's our next step.

You'll first need to create the infrastructure needed to host the information for building packages:

$ mkdir -p pbconf/systemdesigner/rpm
$ mkdir -p pbconf/systemdesigner/pbfilter

then thanks to the work done by Louis Bouchard to package LinuxCOE, you can take the spec file he created and adapt it to suit pb.

$ cat pbconf/systemdesigner/rpm/systemdesigner.spec

Concerning trac

For a complete list of local wiki pages, see TitleIndex.

Trac is brought to you by Edgewall Software, providing professional Linux and software development services to clients worldwide. Visit http://www.edgewall.com/ for more information.

Note: See TracWiki for help on using the wiki.