[CentOS] Building packages using RPMBUILD

Thu Dec 16 16:27:24 UTC 2010
Keith Roberts <keith at karsites.net>

On Thu, 16 Dec 2010, Leonard den Ottolander wrote:

> To: CentOS mailing list <centos at centos.org>
> From: Leonard den Ottolander <leonard at den.ottolander.nl>
> Subject: Re: [CentOS] Building packages using RPMBUILD
> 
> Hello Keith,
>
> (Oops, send out the previous mail before it was finished.)

OK!

> 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.

Right. I did su to root, and it work OK. But will chown 
those if I decide to use that branch of dirs.

>> 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.

That's installed OK.

Installed Packages
Name       : redhat-rpm-config
Arch       : noarch
Version    : 8.0.45
Release    : 32.el5.centos
Size       : 128 k
Repo       : installed
Summary    : CentOS specific rpm configuration files.
License    : GPL
Description: CentOS specific rpm configuration files.


double-tabbing on rpm gives me:

[root at karsites ~]# rpm
rpm                 rpmdev-diff         rpmdev-sha384 
rpmlint
rpm2cpio            rpmdev-extract      rpmdev-sha512 
rpmls
rpmargs             rpmdev-md5          rpmdev-sum 
rpmpeek
rpmbuild            rpmdev-newspec      rpmdev-vercmp 
rpmquery
rpmbuild-md5        rpmdev-rmdevelrpms  rpmdev-wipetree 
rpmsign
rpmdb               rpmdev-setuptree    rpmdiff 
rpmsodiff
rpmdev-bumpspec     rpmdev-sha1         rpmelfsym 
rpmsoname
rpmdev-checksig     rpmdev-sha224       rpmfile 
rpmverify
rpmdev-cksum        rpmdev-sha256       rpminfo

>> 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.

Sorry, I meant I have created a new user account under the 
/home/rpmbuilder directory.

>> 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.

That's a handy tip to know!

Thanks again.

I'll see how things go now.

Kind Regards,

Keith

-- 
In theory, theory and practice are the same;
in practice they are not.

This email was sent from my laptop with Centos 5.5