How to create an RPM for Suse

I need to install version 1.4 of Subversion on a Suse 10.1 (64 bit) box. I can't change either of these two versions and there isn't an RPM for this distro. After looking around I assume that I'll have to create an RPM myself. Is there a better way than this? If not does anyone have any tips on the process?

I don't need a step-by-step tutorial, just a basic outline of the process.


Solution 1:

Rebuilding an existing src.rpm is probably the easiest. I would definitely not go the way of configure, make, make install because (a) that doesn't scale, (b) doesn't provide for easy removal / upgrading of the package and (c) is not atomic.

Building an RPM is not so hard. There used to be a pretty good beginners tutorial at Linux.com, before they destroyed the site. You can try this one, but it's a lot of text, not easy to digest. Still, it's better than nothing.

I'll give you a few pointers, out of the back of my head:

  1. setup an .rpmmacros file in ~
  2. create ~/rpmbuild/{RPMS,SRPMS,SPECS,BUILD,BUILDROOT,SOURCES}
  3. drop the source tarball in ~/rpmbuild/SOURCES
  4. drop the the spec file(s) in ~/rpmbuild/SPECS
  5. run rpmbuild -bp YOURSPEC in ~/rpmbuild/SPECS (runs prepare phase)
  6. run rpmbuild -bc YOURSPEC in ~/rpmbuild/SPECS (above and runs compile phase)
  7. run rpmbuild -bb YOURSPEC in ~/rpmbuild/SPECS (above and builds actual package)

If everything worked out, your RPM will have appeared in ~/rpmbuild/RPMS/${arch}.

I tend to use 5, 6 and 7 separately when creating new RPM's, because I like to inspect the ouput in detail. You might want to go for 7 immediately if you have a vendor provided specfile.

I usually have something like this in my .rpmmacros.

%_topdir /home/YOURNAME/rpmbuild
%packager YOUR NAME <[email protected]>
%_tmppath /tmp

As for the syntax of the specfile: it is not that hard. There exists a very detailed, be it very old, reference work called 'Maximum RPM'. Everything you want to know is in there.


Solution 2:

As wzzrd says, try to rebuild an existing SRPM.

Searching for OpenSUSE 10.3 RPMS yields 2 interesting results:

  • source RPM
  • x86_64 RPM

I know that 10.3 is far from 10.1, but it's a good shot.

Solution 3:

The OpenSuse project provides a build service that can help you easily package RPM's for not only OpenSuse/SLES, but Fedora/RHEL/CentOS, Debian, Ubuntu and Mandriva. All in one fell swoop.

Solution 4:

If you really need and rpm for later package management ease, I would try getting this source rpm svn 1.4.0 sources for SuSE 10.2, install that, cd to /usr/src//SPECS then rpm -bb subversion-1.4.0-31.spec.

I personally would prefer to just get the source from http://subversion.tigris.org and do the usual "configure && make && make check && sudo make install" dance.