Changes between Initial Version and Version 1 of NetPerfExample


Ignore:
Timestamp:
Nov 19, 2007, 1:19:35 PM (16 years ago)
Author:
Bruno Cornec
Comment:

Split on a separate page

Legend:

Unmodified
Added
Removed
Modified
  • NetPerfExample

    v1 v1  
     1= Example of use on netperf (simple example) =
     2
     3As 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 [http://www.netperf.org NetPerf] project .
     4
     5You first have to create a .pbrc configuration file in your home directory, which will setup things globally:
     6
     7{{{
     8$ cat > ~/.pbrc << EOF
     9#
     10# Root of the temp file used to store info on the project
     11# Is also used to determine the root directory of the project
     12# No default option allowed here as they need to be all different
     13#
     14pbrc netperf = $ENV{'HOME'}/netperf/src
     15EOF
     16}}}
     17
     18Should be obvious for the content. Note that the format is in general
     19{{{
     20pb-keyword project = value
     21}}}
     22which means that here I named my project for netperf for Project-Builder (I can choose what I want but need to be consistent everywhere).
     23
     24Then 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:
     25
     26{{{
     27$ cd /tmp
     28$ wget ftp://ftp.netperf.org/netperf/netperf-2.4.4.tar.bz2
     29$ mkdir -p $HOME/netperf/src
     30$ cd $HOME/netperf/src
     31$ umask 022
     32$ tar xvfj /tmp/netperf-2.4.4.tar.bz2
     33$ rm -f /tmp/netperf-2.4.4.tar.bz2
     34}}}
     35
     36The 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.
     37
     38You will now need to get the latest and greatest project-builder software from our [ftp://ftp.project-builder.org 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:
     39
     40{{{
     41$ pb -p netperf -r `pwd` newproj
     42Creating /users/bruno/netperf/src/pbconf directory
     43
     44Do not to forget to commit the pbconf directory in your CMS if needed
     45After having renamed the pkg1 directory to your package's name
     46
     47Project: netperf
     48Action: newproj
     49}}}
     50
     51Explore 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.
     52
     53Edit it and adapt it. After edition, here is the resulting file:
     54{{{
     55$ ls -R pbconf
     56pbconf:
     57netperf.pb  pbfilter  pkg1
     58
     59pbconf/pbfilter:
     60all.pbf  deb.pbf  md.pbf  novell.pbf  rpm.pbf
     61
     62pbconf/pkg1:
     63deb  pbfilter  rpm
     64
     65pbconf/pkg1/deb:
     66changelog  compat  control  copyright  pkg1.dirs  pkg1.docs  rules
     67
     68pbconf/pkg1/pbfilter:
     69
     70pbconf/pkg1/rpm:
     71pkg1.spec
     72$
     73$ vi pbconf/netperf.pb
     74[Modifications here]
     75$ cat pbconf/netperf.pb
     76#
     77# Project Builder configuration file
     78# For project netperf
     79#
     80# $Id$
     81#
     82
     83#
     84# Which CMS system is used (Subversion, CVS or tar file content extracted)
     85#
     86#cms netperf = svn
     87#cms netperf = cvs
     88cms netperf = flat
     89
     90#
     91# Packager label
     92#
     93packager netperf = "Bruno Cornec <bruno@project-builder.org>"
     94#
     95
     96# For delivery to a machine by SSH (potentially the FTP server)
     97# Needs hostname, account and directory
     98#
     99sshhost netperf = www.project-builder.org
     100sshlogin netperf = bruno
     101sshdir netperf = /mondo/ftp
     102sshport netperf = 22
     103
     104#
     105# For Virtual machines management
     106# Naming convention to follow: distribution name (as per ProjectBuilder::Distribution)
     107# followed by '_' and by release number
     108# a .vmtype extension will be added to the resulting string
     109# a QEMU rhel_3 here means that the VM will be named rhel_3.qemu
     110#
     111vmlist 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
     112
     113#
     114# Valid values for vmtype are
     115# qemu, (vmware, xen, ... TBD)
     116vmtype netperf = qemu
     117
     118# Hash for VM stuff on vmtype
     119vmntp default = pool.ntp.org
     120
     121# We suppose we can commmunicate with the VM through SSH
     122vmhost netperf = localhost
     123vmlogin netperf = pb
     124vmport netperf = 2225
     125
     126# Timeout to wait when VM is launched/stopped
     127vmtmout default = 120
     128
     129# per VMs needed paramaters
     130vmopt netperf = -m 384 -daemonize
     131vmpath netperf = /home/qemu
     132vmsize netperf = 5G
     133
     134#
     135# Global version/tag for the project
     136#
     137projver netperf = 2.4.4
     138projtag netperf = 1
     139
     140# Adapt to your needs:
     141# Optional if you need to overwrite the global values above
     142#
     143#pkgver pkg1 = stable
     144#pkgtag pkg1 = 3
     145#pkgver nil
     146#pkgtag nil
     147
     148# Hash of default package/package directory
     149defpkgdir netperf = netperf-2.4.4
     150
     151# Hash of additional package/package directory
     152#extpkgdir pkg1-doc = pkg1-docdir
     153
     154# Hash of valid version names
     155version devel
     156#version stable
     157
     158# List of files per pkg on which to apply filters
     159# Files are mentioned relatively to pbroot/defpkgdir
     160filteredfiles netperf = configure.ac
     161#filteredfiles pkg1-doc = configure.in
     162}}}
     163I 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.
     164Once this is done, you may already try to see if pb can make something useful for you. Check the result of:
     165
     166{{{
     167$ pb -p netperf -r `pwd` cms2build
     168Project: netperf
     169Action: cms2build
     170Packages: netperf
     171
     172Management of netperf 2.4.4-1 (rev flat)
     173Exporting /users/bruno/netperf/src/netperf-2.4.4 from DIR to /users/bruno/netperf/delivery/netperf-2.4.4... OK
     174Build files generated for
     175No 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
     176filter: no such variable
     177Can't use an undefined value as a HASH reference at /usr/lib/perl5/vendor_perl/5.8.8/ProjectBuilder/Base.pm line 1077.
     178}}}
     179Ok 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.
     180
     181So 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:
     182
     183{{{
     184$ find . -name pkg1'*'
     185./pbconf/pkg1
     186./pbconf/pkg1/rpm/pkg1.spec
     187./pbconf/pkg1/deb/pkg1.dirs
     188./pbconf/pkg1/deb/pkg1.docs
     189$ mv ./pbconf/pkg1 ./pbconf/netperf
     190$ mv ./pbconf/netperf/rpm/pkg1.spec ./pbconf/netperf/rpm/netperf.spec
     191$ mv ./pbconf/netperf/deb/pkg1.dirs ./pbconf/netperf/deb/netperf.dirs
     192$ mv ./pbconf/netperf/deb/pkg1.docs ./pbconf/netperf/deb/netperf.docs
     193}}}
     194
     195Now this is done, it's time to look at those and adapt them. At the begining, we try to make RPM packages.
     196{{{
     197$ vi pbconf/netperf/rpm/netperf.spec
     198[Modifications here]
     199$ cat pbconf/netperf/rpm/netperf.spec
     200#
     201# $Id$
     202#
     203
     204Summary:        The netperf tool is a benchmarking network tool
     205Summary(fr):    netperf est un outil de benchmark réseau
     206
     207Name:           PBPKG
     208Version:        PBVER
     209Release:        PBTAGPBSUF
     210License:        GPL
     211Group:          PBGRP
     212Url:            PBURL
     213Source:         PBSRC
     214BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)
     215
     216%description
     217PBDESC
     218
     219%description -l fr
     220netperf est un outil de benchmark réseau
     221
     222%prep
     223%setup -q
     224
     225%build
     226./configure
     227make %{?_smp_mflags} VERSION=%{version}
     228
     229%install
     230%{__rm} -rf $RPM_BUILD_ROOT
     231make DESTDIR=$RPM_BUILD_ROOT install
     232
     233%clean
     234%{__rm} -rf $RPM_BUILD_ROOT
     235
     236%files
     237%defattr(-,root,root)
     238%doc ChangeLog
     239%doc INSTALL COPYING README AUTHORS NEWS
     240
     241%changelog
     242PBLOG
     243}}}
     244
     245That 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.
     246
     247So now that we have the base for our spec file, we need to look at those filters:
     248
     249{{{
     250$ vi pbconf/pbfilter/all.pbf
     251[Modifications here]
     252$ cat pbconf/pbfilter/all.pbf
     253#
     254# $Id$
     255#
     256# Filter for all files
     257#
     258# PBSRC is replaced by the source package format
     259filter PBSRC = ftp://ftp.netperf.org/netperf/%{name}-%{version}.tar.gz
     260
     261# PBVER is replaced by the version ($pbver in code)
     262filter PBVER = $pbver
     263
     264# PBDATE is replaced by the date ($pbdate in code)
     265filter PBDATE = $pbdate
     266
     267# PBLOG is replaced by the changelog if value is yes
     268filter PBLOG = yes
     269
     270# PBTAG is replaced by the tag ($pbtag in code)
     271filter PBTAG = $pbtag
     272
     273# PBREV is replaced by the revision ($pbrev in code)
     274filter PBREV = $pbrev
     275
     276# PBPKG is replaced by the package name ($pbpkg in code)
     277filter PBPKG = $pbpkg
     278
     279# PBPACKAGER is replaced by the packager name ($pbpackager in code)
     280filter PBPACKAGER = $pbpackager
     281
     282# PBDESC contains the description of the package
     283filter PBDESC = "netperf is a network benchmarking tool"
     284
     285# PBURL contains the URL of the Web site of the project
     286filter PBURL = http://www.netperf.org
     287}}}
     288We can now try again to use pb to create our build file:
     289{{{
     290$ pb -p netperf -r `pwd` cms2build
     291Project: netperf
     292Action: cms2build
     293Packages: netperf
     294
     295Management of netperf 2.4.4-1 (rev flat)
     296Exporting /users/bruno/netperf/src/netperf-2.4.4 from DIR to /users/bruno/netperf/delivery/netperf-2.4.4... OK
     297Build 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
     298No Build files found for gentoo-nover
     299Files configure.ac have been filtered
     300Creating netperf tar files compressed... OK
     301Under /users/bruno/netperf/delivery/netperf-2.4.4.tar.gz
     302}}}
     303
     304Much better. You have now your first useful result from pb :-) Congrats !
     305Well 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:
     306{{{
     307tar tvfz /users/bruno/netperf/delivery/netperf-2.4.4.tar.gz
     308drwxr-x--- bruno/users       0 2007-11-16 00:57 netperf-2.4.4/
     309-rw-r----- bruno/users      30 2007-10-16 20:00 netperf-2.4.4/inet_ntop.c
     310-rwxr-x--- bruno/users   31743 2007-06-02 00:06 netperf-2.4.4/config.sub
     311drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/
     312drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/suse-10.0/
     313-rw-r--r-- bruno/users     880 2007-11-16 00:57 netperf-2.4.4/pbconf/suse-10.0/netperf.spec
     314drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/rhel-5/
     315-rw-r--r-- bruno/users     856 2007-11-16 00:57 netperf-2.4.4/pbconf/rhel-5/netperf.spec
     316drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/fedora-4/
     317-rw-r--r-- bruno/users     856 2007-11-16 00:57 netperf-2.4.4/pbconf/fedora-4/netperf.spec
     318drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/suse-10.1/
     319-rw-r--r-- bruno/users     880 2007-11-16 00:57 netperf-2.4.4/pbconf/suse-10.1/netperf.spec
     320drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/redhat-7.3/
     321-rw-r--r-- bruno/users     856 2007-11-16 00:57 netperf-2.4.4/pbconf/redhat-7.3/netperf.spec
     322drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/sles-9/
     323-rw-r--r-- bruno/users     880 2007-11-16 00:57 netperf-2.4.4/pbconf/sles-9/netperf.spec
     324drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/mandriva-2006.0/
     325-rw-r--r-- bruno/users     867 2007-11-16 00:57 netperf-2.4.4/pbconf/mandriva-2006.0/netperf.spec
     326drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/fedora-7/
     327-rw-r--r-- bruno/users     856 2007-11-16 00:57 netperf-2.4.4/pbconf/fedora-7/netperf.spec
     328drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/mandriva-2007.0/
     329-rw-r--r-- bruno/users     867 2007-11-16 00:57 netperf-2.4.4/pbconf/mandriva-2007.0/netperf.spec
     330drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/mandriva-2008.0/
     331-rw-r--r-- bruno/users     867 2007-11-16 00:57 netperf-2.4.4/pbconf/mandriva-2008.0/netperf.spec
     332drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/sles-10/
     333-rw-r--r-- bruno/users     880 2007-11-16 00:57 netperf-2.4.4/pbconf/sles-10/netperf.spec
     334drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.04/
     335-rw-r--r-- bruno/users       2 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.04/changelog
     336-rw-r--r-- bruno/users     431 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.04/control
     337-rw-r--r-- bruno/users      36 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.04/netperf.docs
     338-rw-r--r-- bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.04/netperf.dirs
     339-rw-r--r-- bruno/users       2 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.04/compat
     340-rw-r--r-- bruno/users    3632 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.04/rules
     341-rw-r--r-- bruno/users     994 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.04/copyright
     342drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-6.06/
     343-rw-r--r-- bruno/users       2 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-6.06/changelog
     344-rw-r--r-- bruno/users     431 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-6.06/control
     345-rw-r--r-- bruno/users      36 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-6.06/netperf.docs
     346-rw-r--r-- bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-6.06/netperf.dirs
     347-rw-r--r-- bruno/users       2 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-6.06/compat
     348-rw-r--r-- bruno/users    3632 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-6.06/rules
     349-rw-r--r-- bruno/users     994 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-6.06/copyright
     350drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.10/
     351-rw-r--r-- bruno/users       2 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.10/changelog
     352-rw-r--r-- bruno/users     431 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.10/control
     353-rw-r--r-- bruno/users      36 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.10/netperf.docs
     354-rw-r--r-- bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.10/netperf.dirs
     355-rw-r--r-- bruno/users       2 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.10/compat
     356-rw-r--r-- bruno/users    3632 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.10/rules
     357-rw-r--r-- bruno/users     994 2007-11-16 00:57 netperf-2.4.4/pbconf/ubuntu-7.10/copyright
     358drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/suse-10.3/
     359-rw-r--r-- bruno/users     880 2007-11-16 00:57 netperf-2.4.4/pbconf/suse-10.3/netperf.spec
     360drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/rhel-3/
     361-rw-r--r-- bruno/users     856 2007-11-16 00:57 netperf-2.4.4/pbconf/rhel-3/netperf.spec
     362drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/mandriva-2007.1/
     363-rw-r--r-- bruno/users     867 2007-11-16 00:57 netperf-2.4.4/pbconf/mandriva-2007.1/netperf.spec
     364drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-3.1/
     365-rw-r--r-- bruno/users       2 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-3.1/changelog
     366-rw-r--r-- bruno/users     431 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-3.1/control
     367-rw-r--r-- bruno/users      36 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-3.1/netperf.docs
     368-rw-r--r-- bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-3.1/netperf.dirs
     369-rw-r--r-- bruno/users       2 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-3.1/compat
     370-rw-r--r-- bruno/users    3632 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-3.1/rules
     371-rw-r--r-- bruno/users     994 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-3.1/copyright
     372drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/fedora-5/
     373-rw-r--r-- bruno/users     856 2007-11-16 00:57 netperf-2.4.4/pbconf/fedora-5/netperf.spec
     374drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/fedora-6/
     375-rw-r--r-- bruno/users     856 2007-11-16 00:57 netperf-2.4.4/pbconf/fedora-6/netperf.spec
     376drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/mandrake-10.2/
     377-rw-r--r-- bruno/users     867 2007-11-16 00:57 netperf-2.4.4/pbconf/mandrake-10.2/netperf.spec
     378drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/suse-10.2/
     379-rw-r--r-- bruno/users     880 2007-11-16 00:57 netperf-2.4.4/pbconf/suse-10.2/netperf.spec
     380drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/redhat-9/
     381-rw-r--r-- bruno/users     856 2007-11-16 00:57 netperf-2.4.4/pbconf/redhat-9/netperf.spec
     382drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/rhel-4/
     383-rw-r--r-- bruno/users     856 2007-11-16 00:57 netperf-2.4.4/pbconf/rhel-4/netperf.spec
     384drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/mandrake-10.1/
     385-rw-r--r-- bruno/users     867 2007-11-16 00:57 netperf-2.4.4/pbconf/mandrake-10.1/netperf.spec
     386drwxr-xr-x bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-4.0/
     387-rw-r--r-- bruno/users       2 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-4.0/changelog
     388-rw-r--r-- bruno/users     431 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-4.0/control
     389-rw-r--r-- bruno/users      36 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-4.0/netperf.docs
     390-rw-r--r-- bruno/users       0 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-4.0/netperf.dirs
     391-rw-r--r-- bruno/users       2 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-4.0/compat
     392-rw-r--r-- bruno/users    3632 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-4.0/rules
     393-rw-r--r-- bruno/users     994 2007-11-16 00:57 netperf-2.4.4/pbconf/debian-4.0/copyright
     394-rw-r----- bruno/users    2382 2007-06-02 00:06 netperf-2.4.4/README.ovms
     395-rwxr-x--- bruno/users    1988 2007-06-02 00:06 netperf-2.4.4/mkinstalldirs
     396-rw-r----- bruno/users   14022 2007-06-05 03:08 netperf-2.4.4/acinclude.m4
     397-rw-r----- bruno/users    4203 2007-06-14 18:51 netperf-2.4.4/README.windows
     398-rw-r----- bruno/users    2100 2007-06-02 00:06 netperf-2.4.4/README
     399-rw-r----- bruno/users    1048 2007-06-02 00:06 netperf-2.4.4/README.aix
     400-rw-r----- bruno/users   45985 2007-10-17 18:55 netperf-2.4.4/aclocal.m4
     401drwxr-x--- bruno/users       0 2007-10-17 23:42 netperf-2.4.4/doc/
     402-rw-r----- bruno/users    1163 2007-06-02 00:06 netperf-2.4.4/doc/netserver.man
     403[...]
     404-rw-r----- bruno/users      27 2007-06-02 00:06 netperf-2.4.4/ChangeLog
     405drwxr-x--- bruno/users       0 2007-10-17 23:42 netperf-2.4.4/src/
     406-rw-r----- bruno/users    7777 2007-06-02 00:06 netperf-2.4.4/src/netperf.c
     407[...]
     408-rw-r----- bruno/users    4095 2007-08-08 22:30 netperf-2.4.4/src/netsh.h
     409-rwxr-x--- bruno/users  290760 2007-10-17 18:55 netperf-2.4.4/configure
     410-rw-r----- bruno/users     106 2007-06-02 00:06 netperf-2.4.4/Makefile.am
     411-rw-r----- bruno/users   32819 2007-10-17 23:20 netperf-2.4.4/Release_Notes
     412-rw-r----- bruno/users    9223 2007-10-17 23:42 netperf-2.4.4/config.h.in
     413-rw-r----- bruno/users       0 2007-06-02 00:06 netperf-2.4.4/NEWS
     414-rw-r----- bruno/users     258 2007-06-02 00:06 netperf-2.4.4/README.osx
     415-rwxr-x--- bruno/users   13866 2007-06-02 00:06 netperf-2.4.4/depcomp
     416-rw-r----- bruno/users    1260 2007-06-02 00:06 netperf-2.4.4/README.solaris
     417-rwxr-x--- bruno/users    7122 2007-06-02 00:06 netperf-2.4.4/install-sh
     418-rw-r----- bruno/users    1204 2007-06-02 00:06 netperf-2.4.4/netperf.spec.in
     419-rwxr-x--- bruno/users   43499 2007-06-02 00:06 netperf-2.4.4/config.guess
     420-rw-r----- bruno/users   14031 2007-11-16 00:57 netperf-2.4.4/configure.ac
     421-rw-r----- bruno/users    2079 2007-06-02 00:06 netperf-2.4.4/COPYING
     422-rwxr-x--- bruno/users   10266 2007-06-02 00:06 netperf-2.4.4/missing
     423-rw-r----- bruno/users    6013 2007-10-15 19:41 netperf-2.4.4/AUTHORS
     424-rw-r----- bruno/users    1772 2007-06-02 00:06 netperf-2.4.4/README.hpux
     425-rw-r----- bruno/users   17464 2007-10-17 18:55 netperf-2.4.4/Makefile.in
     426-rw-r----- bruno/users    9240 2007-06-02 00:06 netperf-2.4.4/INSTALL
     427}}}
     428As 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.
     429
     430So now, we can try to go to the next step and build a package. So issue:
     431{{{
     432$ pb -p netperf -r `pwd` build2pkg
     433Project: netperf
     434Action: build2pkg
     435Packages: netperf
     436Source file: /users/bruno/netperf/delivery/netperf-2.4.4.tar.gz
     437Working directory: /users/bruno/netperf/build
     438Extracting build files... OK
     439Building 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
     440+ umask 022
     441+ cd /users/bruno/netperf/build/BUILD
     442+ '[' 1 -eq 1 ']'
     443+ '[' 1 -eq 1 ']'
     444[... build execution continues ...]
     445+ '[' -f ./configure.in -o -f ./configure.ac ']'
     446+ CONFIGURE_XPATH='--x-includes=/usr/include --x-libraries=/usr/lib64'
     447+ ./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
     448[... build execution continues ...]
     449+ make -j4
     450cd . && /bin/sh /users/bruno/netperf/build/BUILD/netperf-2.4.4/missing --run aclocal-1.7
     451/users/bruno/netperf/build/BUILD/netperf-2.4.4/missing: line 46: aclocal-1.7: command not found
     452WARNING: `aclocal-1.7' is missing on your system.  You should only need it if
     453         you modified `acinclude.m4' or `configure.ac'.  You might want
     454         to install the `Automake' and `Perl' packages.  Grab them from
     455         any GNU archive site.
     456cd . && \
     457          /bin/sh /users/bruno/netperf/build/BUILD/netperf-2.4.4/missing --run automake-1.7 --gnu  Makefile
     458cd . && /bin/sh /users/bruno/netperf/build/BUILD/netperf-2.4.4/missing --run autoconf
     459/users/bruno/netperf/build/BUILD/netperf-2.4.4/missing: line 46: automake-1.7: command not found
     460WARNING: `automake-1.7' is missing on your system.  You should only need it if
     461         you modified `Makefile.am', `acinclude.m4' or `configure.ac'.
     462         You might want to install the `Automake' and `Perl' packages.
     463         Grab them from any GNU archive site.
     464/bin/sh ./config.status --recheck
     465[... build execution continues ...]
     466make[2]: Leaving directory `/users/bruno/netperf/build/BUILD/netperf-2.4.4'
     467make[1]: Leaving directory `/users/bruno/netperf/build/BUILD/netperf-2.4.4'
     468+ exit 0
     469Executing(%install): /bin/sh -e /users/bruno/netperf/build/tmp/rpm-tmp.48294
     470+ umask 022
     471+ cd /users/bruno/netperf/build/BUILD
     472+ cd netperf-2.4.4
     473+ '[' 1 -eq 1 ']'
     474+ /bin/rm -rf /users/bruno/netperf/build/tmp/netperf-2.4.4-1PBSUF-root-bruno
     475+ make DESTDIR=/users/bruno/netperf/build/tmp/netperf-2.4.4-1PBSUF-root-bruno install
     476Making install in src
     477[... build execution continues ...]
     478Checking for unpackaged file(s): /usr/lib/rpm/check-files /users/bruno/netperf/build/tmp/netperf-2.4.4-1PBSUF-root-bruno
     479error: Installed (but unpackaged) file(s) found:
     480   /usr/bin/netperf
     481   /usr/bin/netserver
     482   /usr/share/info/netperf.info.bz2
     483   /usr/share/man/man1/netperf.1.bz2
     484   /usr/share/man/man1/netserver.1.bz2
     485
     486
     487RPM build errors:
     488    Installed (but unpackaged) file(s) found:
     489   /usr/bin/netperf
     490   /usr/bin/netserver
     491   /usr/share/info/netperf.info.bz2
     492   /usr/share/man/man1/netperf.1.bz2
     493   /usr/share/man/man1/netserver.1.bz2
     494child (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
     495}}}
     496So 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.
     497
     498The 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.
     499
     500Project-Builder provide a means when exporting the software to build a coherent automake/autoconf setup by the way of the pbinit script.
     501
     502Create now such a script for your project:
     503{{{
     504$ cat > pbconf/netperf/pbinit << EOF
     505#!/bin/bash
     506aclocal
     507autoconf
     508automake
     509EOF
     510$ chmod 755 pbconf/netperf/pbinit
     511}}}
     512Then it seems that the PBSUF macro isn't expanded correctly. Look for it using a Project-Builder tool:
     513{{{
     514$ pbg PBSUF
     515./pbconf/pbfilter/rpm.pbf:# PBSUF is replaced by the package name ($pbpkg in code)
     516./pbconf/pbfilter/rpm.pbf:#filter PBSUF = $pbsuf
     517./pbconf/netperf/rpm/netperf.spec:Release:        PBTAGPBSUF
     518}}}
     519So 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:
     520{{{
     521$ cat ./pbconf/pbfilter/rpm.pbf
     522#
     523# $Id$
     524#
     525# Filter for rpm build
     526#
     527
     528# PBGRP is replaced by the RPM group of apps
     529# Cf: http://fedoraproject.org/wiki/RPMGroups
     530filter PBGRP = Applications/Network
     531
     532# PBDEP is replaced by the list of dependencies
     533# filter PBDEP =
     534
     535# PBSUF is replaced by the package name ($pbpkg in code)
     536filter PBSUF = $pbsuf
     537
     538# PBOBS is replaced by the Obsolete line
     539#filter PBOBS =
     540}}}
     541And 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:
     542{{{
     543%files
     544%defattr(-,root,root)
     545%doc ChangeLog
     546%doc INSTALL COPYING README AUTHORS NEWS
     547%doc README.* Release_Notes doc/examples
     548%{_bindir}/*
     549%{_mandir}/*/*
     550%{_infodir}/*
     551}}}
     552
     553Now you're ready for your second run !
     554{{{
     555$ pb -p netperf -r `pwd` cms2pkg
     556[... build process ...]
     557Wrote: /users/bruno/netperf/build/SRPMS/netperf-2.4.4-1.mdv2007.1.src.rpm
     558Wrote: /users/bruno/netperf/build/RPMS/x86_64/netperf-2.4.4-1.mdv2007.1.x86_64.rpm
     559Wrote: /users/bruno/netperf/build/RPMS/x86_64/netperf-debug-2.4.4-1.mdv2007.1.x86_64.rpm
     560[... build process ...]
     561Checking validity of rpms with rpmlint... E: netperf no-changelogname-tag
     562E: netperf zero-length /usr/share/doc/netperf-2.4.4/NEWS
     563E: netperf info-files-without-install-info-postin /usr/share/info/netperf.info.bz2
     564E: netperf info-files-without-install-info-postun /usr/share/info/netperf.info.bz2
     565E: netperf no-signature
     566E: netperf no-changelogname-tag
     567E: netperf no-signature
     568$
     569}}}
     570So this time we have an RPM !
     571You can try to install it and check if it works:
     572{{{
     573$ sudo urpmi /users/bruno/netperf/build/RPMS/x86_64/netperf-2.4.4-1.mdv2007.1.x86_64.rpm
     574
     575installation de netperf-2.4.4-1.mdv2007.1.x86_64.rpm depuis /users/bruno/netperf/build/RPMS/x86_64
     576Préparation ...                  ##########################################################################
     577      1/1: netperf               ##########################################################################
     578$ sudo netserver
     579Starting netserver at port 12865
     580Starting netserver at hostname 0.0.0.0 port 12865 and family AF_UNSPEC
     581$ sudo netperf
     582TCP 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
     583Recv   Send    Send
     584Socket Socket  Message  Elapsed
     585Size   Size    Size     Time     Throughput
     586bytes  bytes   bytes    secs.    10^6bits/sec
     587
     588 87380  16384  16384    10.00    3665.59
     589}}}
     590
     591So it seems to work. Check now the RPM:
     592{{{
     593$ rpm -ql netperf
     594/usr/bin/netperf
     595/usr/bin/netserver
     596/usr/share/doc/netperf-2.4.4
     597/usr/share/doc/netperf-2.4.4/AUTHORS
     598/usr/share/doc/netperf-2.4.4/COPYING
     599/usr/share/doc/netperf-2.4.4/ChangeLog
     600/usr/share/doc/netperf-2.4.4/INSTALL
     601/usr/share/doc/netperf-2.4.4/NEWS
     602/usr/share/doc/netperf-2.4.4/README
     603/usr/share/info/netperf.info.bz2
     604/usr/share/man/man1/netperf.1.bz2
     605/usr/share/man/man1/netserver.1.bz2
     606$ rpm -qi netperf
     607Name        : netperf                      Relocations: (not relocatable)
     608Version     : 2.4.4                             Vendor: (none)
     609Release     : 1.mdv2007.1                   Build Date: sam 17 nov 2007 00:40:33 CET
     610Install Date: sam 17 nov 2007 00:47:29 CET      Build Host: victoria2.home.musique-ancienne.org
     611Group       : Archiving/Backup              Source RPM: netperf-2.4.4-1.mdv2007.1.src.rpm
     612Size        : 263698                           License: GPL
     613Signature   : (none)
     614Packager    : Bruno Cornec <bruno@project-builder.org>
     615URL         : http://www.netperf.org
     616Summary     : netperf est un outil de benchmark réseau
     617Description :
     618netperf est un outil de benchmark réseau
     619$ rpm -q --changelog netperf
     620$
     621}}}
     622So 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.
     623You'll have for that to create a new file under pbconf/netperf called pbcl which will be the changelog file for your project:
     624{{{
     625$ cp netperf-2.4.4/Release_Notes pbconf/netperf/pbcl
     626$ vi pbconf/netperf/pbcl
     627[... format modifications ...]
     628$ head -20 pbconf/netperf/pbcl
     629# $Id$
     630
     631NETPERF CHANGES
     632
     6332.4.4 (2007-11-16)
     634-  The LOC_CPU and REM_CPU tests will report their respective beliefs
     635   as to the number of CPUs present when the verbosity is set to more
     636   than one.  This can be used when trying to diagnose issues with CPU
     637   utilization.
     638-  A kind soul who wishes to remain anonymous provided a patch to
     639   enable use of sendfile() on OSX.
     640-  Fix a misplaced \n in a format string of send_tcp_maerts, courtesy
     641   of Alexander Duyck.
     642-  There is an experimental global -r option which will allow one to
     643   include CPU utilization measurements, but make the decision about
     644   hitting confidence based on the result only.  The test banner will
     645   reflects this when -r is used.
     646-  It is no longer necessary to specify a file with the global -F
     647   option when running a _SENDFILE test.  Netperf will create a
     648   temporary file and populate it with random data and use that.  If
     649$
     650EOF
     651}}}
     652The 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...
     653
     654I 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:
     655{{{
     656$ rm netperf-2.4.4/ChangeLog netperf-2.4.4/NEWS
     657}}}
     658
     659Ready to check again:
     660{{{
     661$ pb -p netperf -r `pwd` cms2pkg
     662Project: netperf
     663Action: cms2pkg
     664Packages: netperf
     665
     666Management of netperf 2.4.4-1 (rev flat)
     667Exporting /users/bruno/netperf/src/netperf-2.4.4 from DIR to /users/bruno/netperf/delivery/netperf-2.4.4... OK
     668Generating NEWS file from /users/bruno/netperf/src/pbconf/netperf/pbcl
     669[... build continues ...]
     670Wrote: /users/bruno/netperf/build/SRPMS/netperf-2.4.4-1.mdv2007.1.src.rpm
     671Wrote: /users/bruno/netperf/build/RPMS/x86_64/netperf-2.4.4-1.mdv2007.1.x86_64.rpm
     672Wrote: /users/bruno/netperf/build/RPMS/x86_64/netperf-debug-2.4.4-1.mdv2007.1.x86_64.rpm
     673Executing(%clean): /bin/sh -e /users/bruno/netperf/build/tmp/rpm-tmp.76745
     674+ umask 022
     675+ cd /users/bruno/netperf/build/BUILD
     676+ cd netperf-2.4.4
     677+ /bin/rm -rf /users/bruno/netperf/build/tmp/netperf-2.4.4-1.mdv2007.1-root-bruno
     678+ exit 0
     679OK
     680Checking validity of rpms with rpmlint... E: netperf script-without-shellbang /usr/share/doc/netperf-2.4.4/examples/arr_script
     681E: netperf info-files-without-install-info-postin /usr/share/info/netperf.info.bz2
     682E: netperf info-files-without-install-info-postun /usr/share/info/netperf.info.bz2
     683W: netperf wrong-file-end-of-line-encoding /usr/share/doc/netperf-2.4.4/README.windows
     684E: netperf no-signature
     685E: netperf no-signature
     686OK
     687}}}
     688
     689So seems much better. More verifications:
     690{{{
     691$ sudo rpm -Uvh --force /users/bruno/netperf/build/RPMS/x86_64/netperf-2.4.4-1.mdv2007.1.x86_64.rpm
     692Préparation...              ########################################### [100%]
     693   1:netperf                ########################################### [100%]
     694$ rpm -ql netperf
     695/usr/bin/netperf
     696/usr/bin/netserver
     697/usr/share/doc/netperf-2.4.4
     698/usr/share/doc/netperf-2.4.4/AUTHORS
     699/usr/share/doc/netperf-2.4.4/COPYING
     700/usr/share/doc/netperf-2.4.4/ChangeLog
     701/usr/share/doc/netperf-2.4.4/INSTALL
     702/usr/share/doc/netperf-2.4.4/NEWS
     703/usr/share/doc/netperf-2.4.4/README
     704/usr/share/doc/netperf-2.4.4/README.aix
     705/usr/share/doc/netperf-2.4.4/README.hpux
     706/usr/share/doc/netperf-2.4.4/README.osx
     707/usr/share/doc/netperf-2.4.4/README.ovms
     708/usr/share/doc/netperf-2.4.4/README.solaris
     709/usr/share/doc/netperf-2.4.4/README.windows
     710/usr/share/doc/netperf-2.4.4/Release_Notes
     711/usr/share/doc/netperf-2.4.4/examples
     712/usr/share/doc/netperf-2.4.4/examples/Makefile
     713/usr/share/doc/netperf-2.4.4/examples/Makefile.am
     714/usr/share/doc/netperf-2.4.4/examples/Makefile.in
     715/usr/share/doc/netperf-2.4.4/examples/arr_script
     716/usr/share/doc/netperf-2.4.4/examples/packet_byte_script
     717/usr/share/doc/netperf-2.4.4/examples/sctp_stream_script
     718/usr/share/doc/netperf-2.4.4/examples/snapshot_script
     719/usr/share/doc/netperf-2.4.4/examples/tcp_range_script
     720/usr/share/doc/netperf-2.4.4/examples/tcp_rr_script
     721/usr/share/doc/netperf-2.4.4/examples/tcp_stream_script
     722/usr/share/doc/netperf-2.4.4/examples/udp_rr_script
     723/usr/share/doc/netperf-2.4.4/examples/udp_stream_script
     724/usr/share/info/netperf.info.bz2
     725/usr/share/man/man1/netperf.1.bz2
     726/usr/share/man/man1/netserver.1.bz2
     727$ rpm -q --changelog netperf | head
     728* ven nov 16 2007 Bruno Cornec <bruno@project-builder.org> 2.4.4-1.mdv2007.1
     729- Updated to 2.4.4
     730-  The LOC_CPU and REM_CPU tests will report their respective beliefs
     731   as to the number of CPUs present when the verbosity is set to more
     732   than one.  This can be used when trying to diagnose issues with CPU
     733   utilization.
     734-  A kind soul who wishes to remain anonymous provided a patch to
     735   enable use of sendfile() on OSX.
     736-  Fix a misplaced \n in a format string of send_tcp_maerts, courtesy
     737   of Alexander Duyck.
     738$
     739}}}
     740
     741So 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.
     742
     743Imagine 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:
     744{{{
     745$ pb -p pb -r `pwd` -m fedora_8 -i ~/Download/Fedora-8-i386-DVD.iso newvm
     746Project: pb
     747Action: newvm
     748Creating the QEMU VM... Formating '/users/qemu/fedora_8.qemu', fmt=qcow2, size=5242880 kB
     749OK
     750Launching the VM /users/qemu/fedora_8.qemu... OK
     751Waiting for VM fedora_8 to come up...
     752}}}
     753Then the Virtual Machine is launched booting on your CD, and the rest is just a classical installation of a Linux distribution.
     754
     755