wiki:NetPerfExample

Version 1 (modified by bruno, 12 years ago) (diff)

Split on a separate page

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 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

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 netperf for Project-Builder (I can choose what I want but need to be consistent everywhere).

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 -p $HOME/netperf/src
$ cd $HOME/netperf/src
$ umask 022
$ tar xvfj /tmp/netperf-2.4.4.tar.bz2
$ rm -f /tmp/netperf-2.4.4.tar.bz2

The netperf project is a nice project using a simple environment to build itself. It uses the GNU autoconf/autmake/litool mechanism, which makes it easy to package with pb.

You will now need to get the latest and greatest project-builder software from our ftp repository. Of course we provide lots of packages for your distribution ;-) Or a tar.gz file if you prefer. Once available, you can use the newproj option of pb to create the infrastructure that is mandatory for pb. It is mandatory that there is a corespondance between the directory mentioned in $HOME/.pbrc and the -r option:

$ pb -p netperf -r `pwd` newproj
Creating /users/bruno/netperf/src/pbconf directory

Do not to forget to commit the pbconf directory in your CMS if needed
After having renamed the pkg1 directory to your package's name

Project: netperf
Action: newproj

Explore then the pbconf directory to familiarize yourself with some of the config file. the next one we want to edit, is the main configuration file which will be used as the central piece of information for pb.

Edit it and adapt it. After edition, here is the resulting file:

$ ls -R pbconf
pbconf:
netperf.pb  pbfilter  pkg1

pbconf/pbfilter:
all.pbf  deb.pbf  md.pbf  novell.pbf  rpm.pbf

pbconf/pkg1:
deb  pbfilter  rpm

pbconf/pkg1/deb:
changelog  compat  control  copyright  pkg1.dirs  pkg1.docs  rules

pbconf/pkg1/pbfilter:

pbconf/pkg1/rpm:
pkg1.spec
$
$ vi pbconf/netperf.pb
[Modifications here]
$ cat pbconf/netperf.pb
#
# Project Builder configuration file
# For project netperf
#
# $Id$
#

#
# Which CMS system is used (Subversion, CVS or tar file content extracted)
#
#cms netperf = svn
#cms netperf = cvs
cms netperf = flat

#
# Packager label
#
packager netperf = "Bruno Cornec <bruno@project-builder.org>"
#

# For delivery to a machine by SSH (potentially the FTP server)
# Needs hostname, account and directory
#
sshhost netperf = www.project-builder.org
sshlogin netperf = bruno
sshdir netperf = /mondo/ftp
sshport netperf = 22

#
# 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 QEMU rhel_3 here means that the VM will be named rhel_3.qemu
#
vmlist netperf = mandrake_10.1,mandrake_10.2,mandriva_2006.0,mandriva_2007.0,mandriva_2007.1,mandriva_2008.0,redhat_7.3,redhat_9,fedora_4,fedora_5,fedora_6,fedora_7,rhel_3,rhel_4,rhel_5,suse_10.0,suse_10.1,suse_10.2,suse_10.3,sles_9,sles_10,gentoo_nover,debian_3.1,debian_4.0,ubuntu_6.06,ubuntu_7.04,ubuntu_7.10

#
# Valid values for vmtype are
# qemu, (vmware, xen, ... TBD)
vmtype netperf = qemu

# Hash for VM stuff on vmtype
vmntp default = pool.ntp.org

# We suppose we can commmunicate with the VM through SSH
vmhost netperf = localhost
vmlogin netperf = pb
vmport netperf = 2225

# Timeout to wait when VM is launched/stopped
vmtmout default = 120

# per VMs needed paramaters
vmopt netperf = -m 384 -daemonize
vmpath netperf = /home/qemu
vmsize netperf = 5G

#
# Global version/tag for the project
#
projver netperf = 2.4.4
projtag netperf = 1

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

# Hash of default package/package directory
defpkgdir netperf = netperf-2.4.4

# Hash of additional package/package directory
#extpkgdir pkg1-doc = pkg1-docdir

# Hash of valid version names
version devel
#version stable

# List of files per pkg on which to apply filters
# Files are mentioned relatively to pbroot/defpkgdir
filteredfiles netperf = configure.ac
#filteredfiles pkg1-doc = configure.in

I skip the parameters begining with vm and ssh for the moment. I inform pb that I will produce packages with a version-tag of 2.4.4-1, that no local package should have a different version than the project version (pkgver/pkgtag), that my default package will be netperf (pb will work on it by default all the time) and that no additional packages will be produced. In addition to standard version with numbers, pb will accept the version devel. And finally, I give to pb the name of all files (per package) that it will have to filter to produce the packages - more on that later on. Once this is done, you may already try to see if pb can make something useful for you. Check the result of:

$ pb -p netperf -r `pwd` cms2build
Project: netperf
Action: cms2build
Packages: netperf

Management of netperf 2.4.4-1 (rev flat)
Exporting /users/bruno/netperf/src/netperf-2.4.4 from DIR to /users/bruno/netperf/delivery/netperf-2.4.4... OK
Build files generated for
No Build files found for mandriva-2006.0,sles-9,mandrake-10.2,mandriva-2007.0,rhel-3,mandriva-2007.1,redhat-9,ubuntu-6.06,suse-10.3,rhel-5,ubuntu-7.10,gentoo-nover,suse-10.2,mandrake-10.1,mandriva-2008.0,sles-10,fedora-6,suse-10.1,fedora-5,fedora-4,ubuntu-7.04,fedora-7,suse-10.0,debian-4.0,rhel-4,debian-3.1,redhat-7.3
filter: no such variable
Can't use an undefined value as a HASH reference at /usr/lib/perl5/vendor_perl/5.8.8/ProjectBuilder/Base.pm line 1077.

Ok we tried to make a build file from ou Configuration Management System (CMS) which didn't work completely as our structure is incomplete. However, pb already recognized the project name, action, package to build, type of CMS (flat), used our -r option to create the intermediate delivery directory where all the final files|packages will be created.

So now, in order to be more useful, we need to create the structure for our package. Luckily, pb did most of the work for us, by creating a template pkg1 directory and files under pbconf. Rename them to netperf (name of our package) and explore and adapt its content:

$ find . -name pkg1'*'
./pbconf/pkg1
./pbconf/pkg1/rpm/pkg1.spec
./pbconf/pkg1/deb/pkg1.dirs
./pbconf/pkg1/deb/pkg1.docs
$ mv ./pbconf/pkg1 ./pbconf/netperf
$ mv ./pbconf/netperf/rpm/pkg1.spec ./pbconf/netperf/rpm/netperf.spec
$ mv ./pbconf/netperf/deb/pkg1.dirs ./pbconf/netperf/deb/netperf.dirs
$ mv ./pbconf/netperf/deb/pkg1.docs ./pbconf/netperf/deb/netperf.docs

Now this is done, it's time to look at those and adapt them. At the begining, we try to make RPM packages.

$ vi pbconf/netperf/rpm/netperf.spec
[Modifications here]
$ cat pbconf/netperf/rpm/netperf.spec
#
# $Id$
#

Summary:        The netperf tool is a benchmarking network tool
Summary(fr):    netperf est un outil de benchmark réseau

Name:           PBPKG
Version:        PBVER
Release:        PBTAGPBSUF
License:        GPL
Group:          PBGRP
Url:            PBURL
Source:         PBSRC
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)

%description
PBDESC

%description -l fr
netperf est un outil de benchmark réseau

%prep
%setup -q

%build
./configure
make %{?_smp_mflags} VERSION=%{version}

%install
%{__rm} -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install

%clean
%{__rm} -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc ChangeLog
%doc INSTALL COPYING README AUTHORS NEWS

%changelog
PBLOG

That spec file looks normal except that it uses a lot of PBSOMETHING keywords. Those are Project-Builder macros that will be instantiate depending on the distribution during the cms2build step.

So now that we have the base for our spec file, we need to look at those filters:

$ vi pbconf/pbfilter/all.pbf
[Modifications here]
$ cat pbconf/pbfilter/all.pbf
#
# $Id$
#
# Filter for all files
#
# PBSRC is replaced by the source package format
filter PBSRC = ftp://ftp.netperf.org/netperf/%{name}-%{version}.tar.gz

# PBVER is replaced by the version ($pbver in code)
filter PBVER = $pbver

# PBDATE is replaced by the date ($pbdate in code)
filter PBDATE = $pbdate

# PBLOG is replaced by the changelog if value is yes
filter PBLOG = yes

# PBTAG is replaced by the tag ($pbtag in code)
filter PBTAG = $pbtag

# PBREV is replaced by the revision ($pbrev in code)
filter PBREV = $pbrev

# PBPKG is replaced by the package name ($pbpkg in code)
filter PBPKG = $pbpkg

# PBPACKAGER is replaced by the packager name ($pbpackager in code)
filter PBPACKAGER = $pbpackager

# PBDESC contains the description of the package
filter PBDESC = "netperf is a network benchmarking tool"

# PBURL contains the URL of the Web site of the project
filter PBURL = http://www.netperf.org

We can now try again to use pb to create our build file:

$ pb -p netperf -r `pwd` cms2build
Project: netperf
Action: cms2build
Packages: netperf

Management of netperf 2.4.4-1 (rev flat)
Exporting /users/bruno/netperf/src/netperf-2.4.4 from DIR to /users/bruno/netperf/delivery/netperf-2.4.4... OK
Build files generated for mandriva-2006.0,sles-9,mandrake-10.2,mandriva-2007.0,rhel-3,mandriva-2007.1,redhat-9,ubuntu-6.06,suse-10.3,rhel-5,ubuntu-7.10,suse-10.2,mandrake-10.1,mandriva-2008.0,sles-10,fedora-6,suse-10.1,fedora-5,fedora-4,ubuntu-7.04,fedora-7,suse-10.0,debian-4.0,rhel-4,debian-3.1,redhat-7.3
No Build files found for gentoo-nover
Files configure.ac have been filtered
Creating netperf tar files compressed... OK
Under /users/bruno/netperf/delivery/netperf-2.4.4.tar.gz

Much better. You have now your first useful result from pb :-) Congrats ! Well wait ! It's not really useful because we started exactly from a tar file. Well it's not exactly the same tar file. This one adds Project-Builder support:

tar tvfz /users/bruno/netperf/delivery/netperf-2.4.4.tar.gz
drwxr-x--- bruno/users       0 2007-11-16 00:57 netperf-2.4.4/
-rw-r----- bruno/users      30 2007-10-16 20:00 netperf-2.4.4/inet_ntop.c
-rwxr-x--- bruno/users   31743 2007-06-02 00:06 netperf-2.4.4/config.sub
drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/
drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/suse-10.0/
-rw-r--r-- bruno/users     880 2007-11-16 00:57 netperf-2.4.4/pbconf/suse-10.0/netperf.spec
drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/rhel-5/
-rw-r--r-- bruno/users     856 2007-11-16 00:57 netperf-2.4.4/pbconf/rhel-5/netperf.spec
drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/fedora-4/
-rw-r--r-- bruno/users     856 2007-11-16 00:57 netperf-2.4.4/pbconf/fedora-4/netperf.spec
drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/suse-10.1/
-rw-r--r-- bruno/users     880 2007-11-16 00:57 netperf-2.4.4/pbconf/suse-10.1/netperf.spec
drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/redhat-7.3/
-rw-r--r-- bruno/users     856 2007-11-16 00:57 netperf-2.4.4/pbconf/redhat-7.3/netperf.spec
drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/sles-9/
-rw-r--r-- bruno/users     880 2007-11-16 00:57 netperf-2.4.4/pbconf/sles-9/netperf.spec
drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/mandriva-2006.0/
-rw-r--r-- bruno/users     867 2007-11-16 00:57 netperf-2.4.4/pbconf/mandriva-2006.0/netperf.spec
drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/fedora-7/
-rw-r--r-- bruno/users     856 2007-11-16 00:57 netperf-2.4.4/pbconf/fedora-7/netperf.spec
drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/mandriva-2007.0/
-rw-r--r-- bruno/users     867 2007-11-16 00:57 netperf-2.4.4/pbconf/mandriva-2007.0/netperf.spec
drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/mandriva-2008.0/
-rw-r--r-- bruno/users     867 2007-11-16 00:57 netperf-2.4.4/pbconf/mandriva-2008.0/netperf.spec
drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/sles-10/
-rw-r--r-- bruno/users     880 2007-11-16 00:57 netperf-2.4.4/pbconf/sles-10/netperf.spec
drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.04/
-rw-r--r-- bruno/users       2 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.04/changelog
-rw-r--r-- bruno/users     431 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.04/control
-rw-r--r-- bruno/users      36 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.04/netperf.docs
-rw-r--r-- bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.04/netperf.dirs
-rw-r--r-- bruno/users       2 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.04/compat
-rw-r--r-- bruno/users    3632 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.04/rules
-rw-r--r-- bruno/users     994 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.04/copyright
drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-6.06/
-rw-r--r-- bruno/users       2 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-6.06/changelog
-rw-r--r-- bruno/users     431 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-6.06/control
-rw-r--r-- bruno/users      36 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-6.06/netperf.docs
-rw-r--r-- bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-6.06/netperf.dirs
-rw-r--r-- bruno/users       2 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-6.06/compat
-rw-r--r-- bruno/users    3632 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-6.06/rules
-rw-r--r-- bruno/users     994 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-6.06/copyright
drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.10/
-rw-r--r-- bruno/users       2 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.10/changelog
-rw-r--r-- bruno/users     431 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.10/control
-rw-r--r-- bruno/users      36 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.10/netperf.docs
-rw-r--r-- bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.10/netperf.dirs
-rw-r--r-- bruno/users       2 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.10/compat
-rw-r--r-- bruno/users    3632 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.10/rules
-rw-r--r-- bruno/users     994 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.10/copyright
drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/suse-10.3/
-rw-r--r-- bruno/users     880 2007-11-16 00:57 netperf-2.4.4/pbconf/suse-10.3/netperf.spec
drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/rhel-3/
-rw-r--r-- bruno/users     856 2007-11-16 00:57 netperf-2.4.4/pbconf/rhel-3/netperf.spec
drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/mandriva-2007.1/
-rw-r--r-- bruno/users     867 2007-11-16 00:57 netperf-2.4.4/pbconf/mandriva-2007.1/netperf.spec
drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-3.1/
-rw-r--r-- bruno/users       2 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-3.1/changelog
-rw-r--r-- bruno/users     431 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-3.1/control
-rw-r--r-- bruno/users      36 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-3.1/netperf.docs
-rw-r--r-- bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-3.1/netperf.dirs
-rw-r--r-- bruno/users       2 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-3.1/compat
-rw-r--r-- bruno/users    3632 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-3.1/rules
-rw-r--r-- bruno/users     994 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-3.1/copyright
drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/fedora-5/
-rw-r--r-- bruno/users     856 2007-11-16 00:57 netperf-2.4.4/pbconf/fedora-5/netperf.spec
drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/fedora-6/
-rw-r--r-- bruno/users     856 2007-11-16 00:57 netperf-2.4.4/pbconf/fedora-6/netperf.spec
drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/mandrake-10.2/
-rw-r--r-- bruno/users     867 2007-11-16 00:57 netperf-2.4.4/pbconf/mandrake-10.2/netperf.spec
drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/suse-10.2/
-rw-r--r-- bruno/users     880 2007-11-16 00:57 netperf-2.4.4/pbconf/suse-10.2/netperf.spec
drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/redhat-9/
-rw-r--r-- bruno/users     856 2007-11-16 00:57 netperf-2.4.4/pbconf/redhat-9/netperf.spec
drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/rhel-4/
-rw-r--r-- bruno/users     856 2007-11-16 00:57 netperf-2.4.4/pbconf/rhel-4/netperf.spec
drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/mandrake-10.1/
-rw-r--r-- bruno/users     867 2007-11-16 00:57 netperf-2.4.4/pbconf/mandrake-10.1/netperf.spec
drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-4.0/
-rw-r--r-- bruno/users       2 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-4.0/changelog
-rw-r--r-- bruno/users     431 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-4.0/control
-rw-r--r-- bruno/users      36 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-4.0/netperf.docs
-rw-r--r-- bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-4.0/netperf.dirs
-rw-r--r-- bruno/users       2 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-4.0/compat
-rw-r--r-- bruno/users    3632 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-4.0/rules
-rw-r--r-- bruno/users     994 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-4.0/copyright
-rw-r----- bruno/users    2382 2007-06-02 00:06 netperf-2.4.4/README.ovms
-rwxr-x--- bruno/users    1988 2007-06-02 00:06 netperf-2.4.4/mkinstalldirs
-rw-r----- bruno/users   14022 2007-06-05 03:08 netperf-2.4.4/acinclude.m4
-rw-r----- bruno/users    4203 2007-06-14 18:51 netperf-2.4.4/README.windows
-rw-r----- bruno/users    2100 2007-06-02 00:06 netperf-2.4.4/README
-rw-r----- bruno/users    1048 2007-06-02 00:06 netperf-2.4.4/README.aix
-rw-r----- bruno/users   45985 2007-10-17 18:55 netperf-2.4.4/aclocal.m4
drwxr-x--- bruno/users       0 2007-10-17 23:42 netperf-2.4.4/doc/
-rw-r----- bruno/users    1163 2007-06-02 00:06 netperf-2.4.4/doc/netserver.man
[...]
-rw-r----- bruno/users      27 2007-06-02 00:06 netperf-2.4.4/ChangeLog
drwxr-x--- bruno/users       0 2007-10-17 23:42 netperf-2.4.4/src/
-rw-r----- bruno/users    7777 2007-06-02 00:06 netperf-2.4.4/src/netperf.c
[...]
-rw-r----- bruno/users    4095 2007-08-08 22:30 netperf-2.4.4/src/netsh.h
-rwxr-x--- bruno/users  290760 2007-10-17 18:55 netperf-2.4.4/configure
-rw-r----- bruno/users     106 2007-06-02 00:06 netperf-2.4.4/Makefile.am
-rw-r----- bruno/users   32819 2007-10-17 23:20 netperf-2.4.4/Release_Notes
-rw-r----- bruno/users    9223 2007-10-17 23:42 netperf-2.4.4/config.h.in
-rw-r----- bruno/users       0 2007-06-02 00:06 netperf-2.4.4/NEWS
-rw-r----- bruno/users     258 2007-06-02 00:06 netperf-2.4.4/README.osx
-rwxr-x--- bruno/users   13866 2007-06-02 00:06 netperf-2.4.4/depcomp
-rw-r----- bruno/users    1260 2007-06-02 00:06 netperf-2.4.4/README.solaris
-rwxr-x--- bruno/users    7122 2007-06-02 00:06 netperf-2.4.4/install-sh
-rw-r----- bruno/users    1204 2007-06-02 00:06 netperf-2.4.4/netperf.spec.in
-rwxr-x--- bruno/users   43499 2007-06-02 00:06 netperf-2.4.4/config.guess
-rw-r----- bruno/users   14031 2007-11-16 00:57 netperf-2.4.4/configure.ac
-rw-r----- bruno/users    2079 2007-06-02 00:06 netperf-2.4.4/COPYING
-rwxr-x--- bruno/users   10266 2007-06-02 00:06 netperf-2.4.4/missing
-rw-r----- bruno/users    6013 2007-10-15 19:41 netperf-2.4.4/AUTHORS
-rw-r----- bruno/users    1772 2007-06-02 00:06 netperf-2.4.4/README.hpux
-rw-r----- bruno/users   17464 2007-10-17 18:55 netperf-2.4.4/Makefile.in
-rw-r----- bruno/users    9240 2007-06-02 00:06 netperf-2.4.4/INSTALL

As you can see a lot of directories and files have been created under pbconf. They correspond to all the required build files for all the distributions supported and will later be used to really create the packages.

So now, we can try to go to the next step and build a package. So issue:

$ pb -p netperf -r `pwd` build2pkg
Project: netperf
Action: build2pkg
Packages: netperf
Source file: /users/bruno/netperf/delivery/netperf-2.4.4.tar.gz
Working directory: /users/bruno/netperf/build
Extracting build files... OK
Building package with /users/bruno/netperf/build/SPECS/netperf.spec under /users/bruno/netperf/build... Executing(%prep): /bin/sh -e /users/bruno/netperf/build/tmp/rpm-tmp.93873
+ umask 022
+ cd /users/bruno/netperf/build/BUILD
+ '[' 1 -eq 1 ']'
+ '[' 1 -eq 1 ']'
[... build execution continues ...]
+ '[' -f ./configure.in -o -f ./configure.ac ']'
+ CONFIGURE_XPATH='--x-includes=/usr/include --x-libraries=/usr/lib64'
+ ./configure x86_64-mandriva-linux-gnu --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/lib64 --localstatedir=/var/lib --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --x-includes=/usr/include --x-libraries=/usr/lib64
[... build execution continues ...]
+ make -j4
cd . && /bin/sh /users/bruno/netperf/build/BUILD/netperf-2.4.4/missing --run aclocal-1.7
/users/bruno/netperf/build/BUILD/netperf-2.4.4/missing: line 46: aclocal-1.7: command not found
WARNING: `aclocal-1.7' is missing on your system.  You should only need it if
         you modified `acinclude.m4' or `configure.ac'.  You might want
         to install the `Automake' and `Perl' packages.  Grab them from
         any GNU archive site.
cd . && \
          /bin/sh /users/bruno/netperf/build/BUILD/netperf-2.4.4/missing --run automake-1.7 --gnu  Makefile
cd . && /bin/sh /users/bruno/netperf/build/BUILD/netperf-2.4.4/missing --run autoconf
/users/bruno/netperf/build/BUILD/netperf-2.4.4/missing: line 46: automake-1.7: command not found
WARNING: `automake-1.7' is missing on your system.  You should only need it if
         you modified `Makefile.am', `acinclude.m4' or `configure.ac'.
         You might want to install the `Automake' and `Perl' packages.
         Grab them from any GNU archive site.
/bin/sh ./config.status --recheck
[... build execution continues ...]
make[2]: Leaving directory `/users/bruno/netperf/build/BUILD/netperf-2.4.4'
make[1]: Leaving directory `/users/bruno/netperf/build/BUILD/netperf-2.4.4'
+ exit 0
Executing(%install): /bin/sh -e /users/bruno/netperf/build/tmp/rpm-tmp.48294
+ umask 022
+ cd /users/bruno/netperf/build/BUILD
+ cd netperf-2.4.4
+ '[' 1 -eq 1 ']'
+ /bin/rm -rf /users/bruno/netperf/build/tmp/netperf-2.4.4-1PBSUF-root-bruno
+ make DESTDIR=/users/bruno/netperf/build/tmp/netperf-2.4.4-1PBSUF-root-bruno install
Making install in src
[... build execution continues ...]
Checking for unpackaged file(s): /usr/lib/rpm/check-files /users/bruno/netperf/build/tmp/netperf-2.4.4-1PBSUF-root-bruno
error: Installed (but unpackaged) file(s) found:
   /usr/bin/netperf
   /usr/bin/netserver
   /usr/share/info/netperf.info.bz2
   /usr/share/man/man1/netperf.1.bz2
   /usr/share/man/man1/netserver.1.bz2


RPM build errors:
    Installed (but unpackaged) file(s) found:
   /usr/bin/netperf
   /usr/bin/netserver
   /usr/share/info/netperf.info.bz2
   /usr/share/man/man1/netperf.1.bz2
   /usr/share/man/man1/netserver.1.bz2
child (rpmbuild --define "packager Bruno Cornec <bruno@project-builder.org>" --define "_topdir /users/bruno/netperf/build" -ba /users/bruno/netperf/build/SPECS/netperf.spec) exited with value 1

So it seems we are not there yet ;-) But it's not too bad for just having renamed a couple of files and parameters in our conf files. Now we need to solve those issues and produce the package.

The first problem we've met, is that the build process seems to need automake and autoconf. However, when build separately with the classical ./configure ; make it doesn't ask for it.

Project-Builder provide a means when exporting the software to build a coherent automake/autoconf setup by the way of the pbinit script.

Create now such a script for your project:

$ cat > pbconf/netperf/pbinit << EOF
#!/bin/bash
aclocal
autoconf
automake
EOF
$ chmod 755 pbconf/netperf/pbinit

Then it seems that the PBSUF macro isn't expanded correctly. Look for it using a Project-Builder tool:

$ pbg PBSUF
./pbconf/pbfilter/rpm.pbf:# PBSUF is replaced by the package name ($pbpkg in code)
./pbconf/pbfilter/rpm.pbf:#filter PBSUF = $pbsuf
./pbconf/netperf/rpm/netperf.spec:Release:        PBTAGPBSUF

So indeed that macro is used in our spec file, but is only declared for rpm types of build in the rpm filter file. However it's currently commented. So edit that file to validate it, as well as the other variables needed:

$ cat ./pbconf/pbfilter/rpm.pbf
#
# $Id$
#
# Filter for rpm build
#

# PBGRP is replaced by the RPM group of apps
# Cf: http://fedoraproject.org/wiki/RPMGroups
filter PBGRP = Applications/Network

# PBDEP is replaced by the list of dependencies
# filter PBDEP =

# PBSUF is replaced by the package name ($pbpkg in code)
filter PBSUF = $pbsuf

# PBOBS is replaced by the Obsolete line
#filter PBOBS =

And our final current problem is the list of files produced by the build process that need to be referenced in our %files session. So modify that section of the spec file to read like this:

%files
%defattr(-,root,root)
%doc ChangeLog
%doc INSTALL COPYING README AUTHORS NEWS
%doc README.* Release_Notes doc/examples
%{_bindir}/*
%{_mandir}/*/*
%{_infodir}/*

Now you're ready for your second run !

$ pb -p netperf -r `pwd` cms2pkg
[... build process ...]
Wrote: /users/bruno/netperf/build/SRPMS/netperf-2.4.4-1.mdv2007.1.src.rpm
Wrote: /users/bruno/netperf/build/RPMS/x86_64/netperf-2.4.4-1.mdv2007.1.x86_64.rpm
Wrote: /users/bruno/netperf/build/RPMS/x86_64/netperf-debug-2.4.4-1.mdv2007.1.x86_64.rpm
[... build process ...]
Checking validity of rpms with rpmlint... E: netperf no-changelogname-tag
E: netperf zero-length /usr/share/doc/netperf-2.4.4/NEWS
E: netperf info-files-without-install-info-postin /usr/share/info/netperf.info.bz2
E: netperf info-files-without-install-info-postun /usr/share/info/netperf.info.bz2
E: netperf no-signature
E: netperf no-changelogname-tag
E: netperf no-signature
$

So this time we have an RPM ! You can try to install it and check if it works:

$ sudo urpmi /users/bruno/netperf/build/RPMS/x86_64/netperf-2.4.4-1.mdv2007.1.x86_64.rpm

installation de netperf-2.4.4-1.mdv2007.1.x86_64.rpm depuis /users/bruno/netperf/build/RPMS/x86_64
Préparation ...                  ##########################################################################
      1/1: netperf               ##########################################################################
$ sudo netserver
Starting netserver at port 12865
Starting netserver at hostname 0.0.0.0 port 12865 and family AF_UNSPEC
$ sudo netperf
TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to victoria2.home.musique-ancienne.org (127.0.0.1) port 0 AF_INET
Recv   Send    Send
Socket Socket  Message  Elapsed
Size   Size    Size     Time     Throughput
bytes  bytes   bytes    secs.    10^6bits/sec

 87380  16384  16384    10.00    3665.59

So it seems to work. Check now the RPM:

$ rpm -ql netperf
/usr/bin/netperf
/usr/bin/netserver
/usr/share/doc/netperf-2.4.4
/usr/share/doc/netperf-2.4.4/AUTHORS
/usr/share/doc/netperf-2.4.4/COPYING
/usr/share/doc/netperf-2.4.4/ChangeLog
/usr/share/doc/netperf-2.4.4/INSTALL
/usr/share/doc/netperf-2.4.4/NEWS
/usr/share/doc/netperf-2.4.4/README
/usr/share/info/netperf.info.bz2
/usr/share/man/man1/netperf.1.bz2
/usr/share/man/man1/netserver.1.bz2
$ rpm -qi netperf
Name        : netperf                      Relocations: (not relocatable)
Version     : 2.4.4                             Vendor: (none)
Release     : 1.mdv2007.1                   Build Date: sam 17 nov 2007 00:40:33 CET
Install Date: sam 17 nov 2007 00:47:29 CET      Build Host: victoria2.home.musique-ancienne.org
Group       : Archiving/Backup              Source RPM: netperf-2.4.4-1.mdv2007.1.src.rpm
Size        : 263698                           License: GPL
Signature   : (none)
Packager    : Bruno Cornec <bruno@project-builder.org>
URL         : http://www.netperf.org
Summary     : netperf est un outil de benchmark réseau
Description :
netperf est un outil de benchmark réseau
$ rpm -q --changelog netperf
$ 

So we still have an issue with the Group used and the changelog which is empty. Also some modes are wrong and our NEWS file is empty. Again Project-Builder can will with those issues. You'll have for that to create a new file under pbconf/netperf called pbcl which will be the changelog file for your project:

$ cp netperf-2.4.4/Release_Notes pbconf/netperf/pbcl
$ vi pbconf/netperf/pbcl
[... format modifications ...]
$ head -20 pbconf/netperf/pbcl
# $Id$

NETPERF CHANGES

2.4.4 (2007-11-16)
-  The LOC_CPU and REM_CPU tests will report their respective beliefs
   as to the number of CPUs present when the verbosity is set to more
   than one.  This can be used when trying to diagnose issues with CPU
   utilization.
-  A kind soul who wishes to remain anonymous provided a patch to
   enable use of sendfile() on OSX.
-  Fix a misplaced \n in a format string of send_tcp_maerts, courtesy
   of Alexander Duyck.
-  There is an experimental global -r option which will allow one to
   include CPU utilization measurements, but make the decision about
   hitting confidence based on the result only.  The test banner will
   reflects this when -r is used.
-  It is no longer necessary to specify a file with the global -F
   option when running a _SENDFILE test.  Netperf will create a
   temporary file and populate it with random data and use that.  If
$
EOF

The format of the pbcl file is strict. It has 4 initital lines that you can use the way you want, the the 5th line should have 'Version (date)' wwith date using ISO format, then the following lines are the changelog content of that version. Then after a blank line, again a 'Version (date)' and the changelog, etc...

I also decide to remove the useless files in the distribution, and replace them with those that Project-Builder will generate from the pbcl file we just created from Release_Notes:

$ rm netperf-2.4.4/ChangeLog netperf-2.4.4/NEWS

Ready to check again:

$ pb -p netperf -r `pwd` cms2pkg
Project: netperf
Action: cms2pkg
Packages: netperf

Management of netperf 2.4.4-1 (rev flat)
Exporting /users/bruno/netperf/src/netperf-2.4.4 from DIR to /users/bruno/netperf/delivery/netperf-2.4.4... OK
Generating NEWS file from /users/bruno/netperf/src/pbconf/netperf/pbcl
[... build continues ...]
Wrote: /users/bruno/netperf/build/SRPMS/netperf-2.4.4-1.mdv2007.1.src.rpm
Wrote: /users/bruno/netperf/build/RPMS/x86_64/netperf-2.4.4-1.mdv2007.1.x86_64.rpm
Wrote: /users/bruno/netperf/build/RPMS/x86_64/netperf-debug-2.4.4-1.mdv2007.1.x86_64.rpm
Executing(%clean): /bin/sh -e /users/bruno/netperf/build/tmp/rpm-tmp.76745
+ umask 022
+ cd /users/bruno/netperf/build/BUILD
+ cd netperf-2.4.4
+ /bin/rm -rf /users/bruno/netperf/build/tmp/netperf-2.4.4-1.mdv2007.1-root-bruno
+ exit 0
OK
Checking validity of rpms with rpmlint... E: netperf script-without-shellbang /usr/share/doc/netperf-2.4.4/examples/arr_script
E: netperf info-files-without-install-info-postin /usr/share/info/netperf.info.bz2
E: netperf info-files-without-install-info-postun /usr/share/info/netperf.info.bz2
W: netperf wrong-file-end-of-line-encoding /usr/share/doc/netperf-2.4.4/README.windows
E: netperf no-signature
E: netperf no-signature
OK

So seems much better. More verifications:

$ sudo rpm -Uvh --force /users/bruno/netperf/build/RPMS/x86_64/netperf-2.4.4-1.mdv2007.1.x86_64.rpm
Préparation...              ########################################### [100%]
   1:netperf                ########################################### [100%]
$ rpm -ql netperf
/usr/bin/netperf
/usr/bin/netserver
/usr/share/doc/netperf-2.4.4
/usr/share/doc/netperf-2.4.4/AUTHORS
/usr/share/doc/netperf-2.4.4/COPYING
/usr/share/doc/netperf-2.4.4/ChangeLog
/usr/share/doc/netperf-2.4.4/INSTALL
/usr/share/doc/netperf-2.4.4/NEWS
/usr/share/doc/netperf-2.4.4/README
/usr/share/doc/netperf-2.4.4/README.aix
/usr/share/doc/netperf-2.4.4/README.hpux
/usr/share/doc/netperf-2.4.4/README.osx
/usr/share/doc/netperf-2.4.4/README.ovms
/usr/share/doc/netperf-2.4.4/README.solaris
/usr/share/doc/netperf-2.4.4/README.windows
/usr/share/doc/netperf-2.4.4/Release_Notes
/usr/share/doc/netperf-2.4.4/examples
/usr/share/doc/netperf-2.4.4/examples/Makefile
/usr/share/doc/netperf-2.4.4/examples/Makefile.am
/usr/share/doc/netperf-2.4.4/examples/Makefile.in
/usr/share/doc/netperf-2.4.4/examples/arr_script
/usr/share/doc/netperf-2.4.4/examples/packet_byte_script
/usr/share/doc/netperf-2.4.4/examples/sctp_stream_script
/usr/share/doc/netperf-2.4.4/examples/snapshot_script
/usr/share/doc/netperf-2.4.4/examples/tcp_range_script
/usr/share/doc/netperf-2.4.4/examples/tcp_rr_script
/usr/share/doc/netperf-2.4.4/examples/tcp_stream_script
/usr/share/doc/netperf-2.4.4/examples/udp_rr_script
/usr/share/doc/netperf-2.4.4/examples/udp_stream_script
/usr/share/info/netperf.info.bz2
/usr/share/man/man1/netperf.1.bz2
/usr/share/man/man1/netserver.1.bz2
$ rpm -q --changelog netperf | head
* ven nov 16 2007 Bruno Cornec <bruno@project-builder.org> 2.4.4-1.mdv2007.1
- Updated to 2.4.4
-  The LOC_CPU and REM_CPU tests will report their respective beliefs
   as to the number of CPUs present when the verbosity is set to more
   than one.  This can be used when trying to diagnose issues with CPU
   utilization.
-  A kind soul who wishes to remain anonymous provided a patch to
   enable use of sendfile() on OSX.
-  Fix a misplaced \n in a format string of send_tcp_maerts, courtesy
   of Alexander Duyck.
$ 

So we now have a much more correct rpm built, even if not everything is solve. The beauty of Project-Builder will now appear, as it's as easy to generate more RPMs for other distributions than it is for your native distribution.

Imagine you want to build the same RPMs for the just issued Fedora 8, instead of your native distribution. First download the ISO image of your distribution and put it where you have space on your disk. Then call pb to help you create a new virtual machine for that distribution:

$ pb -p pb -r `pwd` -m fedora_8 -i ~/Download/Fedora-8-i386-DVD.iso newvm
Project: pb
Action: newvm
Creating the QEMU VM... Formating '/users/qemu/fedora_8.qemu', fmt=qcow2, size=5242880 kB
OK
Launching the VM /users/qemu/fedora_8.qemu... OK
Waiting for VM fedora_8 to come up...

Then the Virtual Machine is launched booting on your CD, and the rest is just a classical installation of a Linux distribution.