building RPMs: the spec-file

Today I find myself in the need to build an RPM of the "ratbox" ircd, with some patches. To get a headstart, I decided to look around for an existing spec-file and I found one here:

Now, I was under the impression that RPM was some standard and that therefore, a spec-file had some standards as well. The spec-file I downloaded comes from the OpenPKG project and seems to have some non-standard "extensions".

First of all, my rpmbuild complains about this line:

Class: BASE

I removed that line

Next, some pre-build dependencies fail

error: Failed build dependencies:
OpenPKG is needed by ratbox-2.2.8-20080112.i386
openpkg >= 20060823 is needed by ratbox-2.2.8-20080112.i386

I removed those dependencies

After that, the %prep section fails:

Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.26173
+ umask 022
+ cd /usr/src/redhat/BUILD
+ %setup -q -c
/var/tmp/rpm-tmp.26173: line 24: fg: no job control
error: Bad exit status from /var/tmp/rpm-tmp.26173 (%prep)

RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.26173 (%prep)

That's apparently because there are spaces in front of "%setup" and friends. I removed them.

And now I get:

error: File /usr/src/redhat/SOURCES/ircd-ratbox-2.2.8.tgz: No such file or directory

Right. Quadruple fail. I guess I'll just have to write my own spec file instead.