[CentOS] Building packages using RPMBUILD

Leonard den Ottolander leonard at den.ottolander.nl
Thu Dec 16 16:03:58 UTC 2010


Hello Keith,

(Oops, send out the previous mail before it was finished.)

On Thu, 2010-12-16 at 15:08 +0000, Keith Roberts wrote:
> [rpmbuilder at karsites sox]$ rpm -iv ./sox-12.18.1-1.src.rpm
> error: cannot write to %sourcedir /usr/src/redhat/SOURCES

/usr/src/redhat and sub dirs are owned root.root. If you want to build
as a normal user (and you should!) you should fix the ownership of those
directories.

> Is there a package I need to install and run to set 
> things up corectly?

redhat-rpm-config sets certain build macros. Although not strictly
required you should probably always install this packages. One thing I
stumbled on is that a new type of check summing is used nowadays for the
content of the rpms. If the correct macro isn't set you might run into
installation conflicts, f.e. for multilib doc files.

> I have created a user called 'rpmbuilder' under my home dir, 
> and created the rpmbuild dirs under that.

If you make a different user to do builds you should rather give it its
own home dir. But you can just as well build using your default account.

> So what build dir shall I go for?

Whatever you prefer. Just using /usr/src/redhat is probably the easiest.
If you want to use a different path scheme you can override the default
settings in ~/.rpmmacros to suit your needs.

For example, I use
%_sourcedir     %{_topdir}/%{name}-%{version}
%_specdir       %{_sourcedir}
so the source files end up in their own directory and not all in the
same SOURCES dir.

Regards,
Leonard.

-- 
mount -t life -o ro /dev/dna /genetic/research





More information about the CentOS mailing list