2.2. Packages

A Rocks roll requires that all packages contained in the roll must be in the native format of the OS. For Redhat-based Rocks clusters, this means all packages must be RPMS.

2.2.1. The Software is Already in an RPM

If the software you wish to install is already in RPM format, you can directly put it into the roll source tree. For example, to put the RPM unzip-5.52-3.el5.x86_64.rpm into the Valgrind Roll, execute:

# mkdir -p /export/src/roll/valgrind/RPMS/x86_64
# cp /tmp/unzip-5.52-3.el5.x86_64.rpm /export/src/roll/valgrind/RPMS/x86_64

2.2.2. Bundle an Existing Subdirectory into an RPM

If your application is already installed on your frontend and you would like to bundle its subdirectory into and RPM, you can create an RPM that contains all the files in a subdirectory. For example, let's say you want to create an RPM from all the files under /opt/stream. You can execute:

# rocks create package /opt/stream stream

This will create a package named stream-1.0-1.x86_64.rpm in the current working directory. To see the contents of the package, execute:

# rpm -qlp stream-1.0-1.x86_64.rpm 
/
/opt
/opt/stream
/opt/stream/bin
/opt/stream/bin/stream
/opt/stream/bin/stream_f
/opt/stream/docs
/opt/stream/docs/HISTORY.txt
/opt/stream/docs/LICENSE.txt
/opt/stream/docs/Makefile
/opt/stream/docs/READ.ME
/opt/stream/docs/ROCKS.txt
/opt/stream/docs/linux.mk
/opt/stream/docs/mysecond.c
/opt/stream/docs/stream.c
/opt/stream/docs/stream.f
/opt/stream/docs/sunos.mk
/opt/stream/docs/version.mk

There are several more options you can supply to "rocks create package" (execute "rocks create package help" to see all the options).

Now place the RPM into the correct directory within the roll:

# mkdir -p /export/src/roll/valgrind/RPMS/x86_64
# cp stream-1.0-1.x86_64.rpm /export/src/roll/valgrind/RPMS/x86_64

2.2.3. Create an RPM from a Source Code Tarball

The most common way we create RPMS is from source tarballs (the classic: untar, configure, make, make install).

First, we'll download the source tarball into the correct directory:

# cd /export/src/roll/valgrind/src/valgrind
# wget http://valgrind.org/downloads/valgrind-3.6.0.tar.bz2

Edit version.mk and change TARBALL_POSTFIX = tgz to TARBALL_POSTFIX = tar.bz2, change PKGROOT = /opt/valgrind to PKGROOT = /opt,and change VERSION = 1.0 to VERSION = 3.6.0. Your version.mk should look like:

PKGROOT		= /opt
NAME    	= valgrind
VERSION 	= 3.6.0
RELEASE 	= 1
TARBALL_POSTFIX	= tar.bz2

Edit Makefile and change the line: gunzip -c to bzcat (since the tarball is a bz2).

Now build the RPM:

# make rpm

It will take several minutes to build the package. When it completes, you'll see the line:

Wrote: /export/src/roll/valgrind/RPMS/x86_64/valgrind-3.6.0-1.x86_64.rpm

You can inspect the contents of the valgrind RPM:

# rpm -qlp /export/src/roll/valgrind/RPMS/x86_64/valgrind-3.6.0-1.x86_64.rpm
/
/opt
/opt/valgrind
/opt/valgrind/bin
/opt/valgrind/bin/callgrind_annotate
/opt/valgrind/bin/callgrind_control
/opt/valgrind/bin/cg_annotate
/opt/valgrind/bin/cg_diff
/opt/valgrind/bin/cg_merge
/opt/valgrind/bin/ms_print
/opt/valgrind/bin/no_op_client_for_valgrind
/opt/valgrind/bin/valgrind
/opt/valgrind/bin/valgrind-listener
/opt/valgrind/include
/opt/valgrind/include/valgrind
/opt/valgrind/include/valgrind/callgrind.h
   .
   .
   .

Note that the valgrind-3.6.0-1.x86_64.rpm RPM was automatically placed into the correct directory (/export/src/roll/valgrind/RPMS/x86_64).