Packaging/Creating RPM Package files

From GEANT2-JRA1 Wiki

Contents

spec file

header

  • Name: Full name of the package.
  • Version: Upstream release version
  • License: License of the source code
  • Release: Package release version
  • Summary: Short description of the package
  • Source0: Source package name
  • Group: In what RPM group does this package belong
  • packager: The packager
  • URL: Where to download
  • Requires: On what packages should this package depend, example tomcat5
  • BuildArch: What architecture for this package. noarch for scripting languages and java, i386/ia_x86 for binary packages
  • BuildRequires: what packages are required to build this package

%description

longer description of the package.

%prep

What needs to be done before building. Cleanup, and extracting of archive for example.


%build

commands needed to be run to build the project


%install

Commands run for installation of files. Everything should be installed in the ${RPM_BUILD_ROOT}. This virtual structure will be used for package creation.


%post

Post build and install processes. Here you can create extra symlinks, or remove bogus files.


%preun

Commands run before package uninstallation.


%postun

Commands run after package uninstallation.


%clean

How to clean the package source tree

%files

The files that are included in the package, and their permissions. here you can also define config files. Look at the examples for more.


%changelog

What has been changed.

Workflow

# yum install maven2 rpmdevtools
$ cd ~
$ mkdir -p rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS,TMP}

create ~/.rpmmacros with content (or more if you want):

%_topdir      /home/gijs/rpmbuild
%_tmppath     /home/gijs/rpmbuild/TMP
%_gpg_name             Gijs Molenaar <gijs.molenaar@surfnet.nl>

The last line is for signing of the packages, you can specify the key to use (if you want to sign)


$ cd ~/rpmbuild/SOURCES
$ wget surfnet_java-flowsa-ma-<VERSION>.tar.gz
$ cd ~/rpmbuild/SPECS
$ cp ../BUILD/surfnet_java-flowsa-ma-<VERSION>/contrib/surfnet_java-flowsa-ma.specs .
$ rpmbuild -bb ~/rpmbuild/SPECS/surfnet_java-flowsa-ma.specs

RPM will be in ~/rpmbuild/RPMS/noarch

I've used the fedora RPM guide a lot: http://docs.fedoraproject.org/drafts/rpm-guide-en/

Personal tools