Wednesday, September 22, 2010

Week 2 (September 13) - RPM Packages I (using rpmbuild)

Objectives:
- Prepare system for rpm packaging by installing core development tools.
- Rebuild/Repackage an existing RPM package using rpmdev tools and play around with the .rpmmacros -j value for each compile.

Preparations for rpm packaging:

In order to successfuly repackage a source rpm, certain tools are needed in my fedora system.

I need all of the following (Install using yum):
rpmdevtools
rpm-build
rpmlint
rpm
yum-utils

Rebuild/Repackage an existing RPM package:

NOTE: None of the steps below require root
STEPS:
1. Once all the required tools are downloaded, I need to create my build directory using the command
#rpmdev-setuptree
The rpmdev-setuptree command will create the rpmbuild directory located at my user's home (~/rpmbuild).

2. Download a source package using yum.
#yumdownloader --source privoxy

3. Install the downloaded source package (which places the package's .spec file into ~/rpmbuild/SPECS and other source and patch files in ~/rpmbuild/SOURCES).
Command: rpm -i pkg*src*rpm
#rpm -i privoxy-3.0.16-2.fc13.src.rpm

4. I then have to go to ~/rpmbuild/SPECS/ directory and check the spec file of the software to be packaged; then run the "rpmbuild" command on the spec file, which will go through a series of steps to produce my packages.
#rpmbuild -ba privoxy.spec

Editing the .rpmmacros file and change the value for -j:

The .rpmmacros file is an invisible file located in user's home directory (~/.rpmmacros)
There's not much I know of this file (I'll study more about it) but as Chris Tyler stated in class, the %_smp_mflags -j3 (where -j3 is the default option)
tells the kernel on how to fast it should go when installing a software.
So I played around with the %_smp_mflags -j3 value. I was expecting that a higher -j value would mean faster build time.....

I was wrong!

Unfortunately for my build, the   -j3 (default) option, is  .565 seconds slower than the -j1 option  in time (user mode). I tested other options up to   -j5 which resulted to slower build times.

I will  test my build on other systems this coming Friday to make sure my observation is correct. The test was ran on a Fedora 13 system (virtual machine) using Windows 7 as a host (AMD dual-core).

UPDATE: (September 26, 2010)

I learned from Chris that the -j1 option in the .rpmmacros file is well suited for single core processors. I proved it true when I checked my virtualbox settings for my guest machine. I have a single core processor setup.

I recompiled the same package, only this time in an amd dual core system. The default value -j4 seems to be well suited for a faster compile.

0 comments:

Post a Comment