[CentOS] rpmbuild environment CentOS5 vs CentOS6

Wed Jul 24 09:36:59 UTC 2013
Marc Deop <damnshock at gmail.com>

On Wednesday 03 July 2013 08:03:51 Kahlil Hodgson wrote:
> make sure you have rpmdevtools
> 
>     yum install rpmdevtools
> 
> then run
> 
>     rpmdev-setuptree
> 
> to setup the ~/rpmbuild tree structure
> 
> Hope this helps
> 
> K
> 
> 
> Kahlil (Kal) Hodgson                       GPG: C9A02289
> Head of Technology                         (m) +61 (0) 4 2573 0382
> DealMax Pty Ltd                            (w) +61 (0) 3 9008 5281
> 
> Suite 1415
> 401 Docklands Drive
> Docklands VIC 3008 Australia
> 
> "All parts should go together without forcing.  You must remember that
> the parts you are reassembling were disassembled by you.  Therefore,
> if you can't get them together again, there must be a reason.  By all
> means, do not use a hammer."  -- IBM maintenance manual, 1925
> 
> 
> 
> On Wed, Jul 3, 2013 at 7:40 AM, Peter Wood <peterwood.sd at gmail.com> wrote:
> 
> > On CentOS5 I was used to create a simple spec file where at the end I'll
> > declare files and directories I wan't to package:
> >
> > --< Snip >--
> > %files
> > %dir /opt/myapp
> > %dir /opt/myapp/bin
> > %dir /opt/myapp/etc
> > /opt/myapp/bin/exec01
> > /opt/myapp/etc/myapp.conf
> > ----
> >
> > I'll copy the file in /usr/src/redhat/SPECS and run "rpmbuild -bb
> > myapp.spec".
> >
> > On CentOS6 rpm-build package no longer creates the /usr/src/redhat/...
> > directory tree. I followed the CentOS6 Wiki instructions to setup my
> > rpmbuild environment for a regular user.
> >
> > When I try to build the package on CentOS6 I'm getting this error for every
> > single file and directory:
> >
> > File not found:
> > /home/peter/rpmbuild/BUILDROOT/myapp-5.2-1el6.x86_64/opt/myapp/bin/exec01
> >
> > I tried to override buildroot:
> >
> >   rpmbuild -bb --define="buildroot /" myapp.spec
> >   error: %{buildroot} can not be "/"
> >
> > As a workaround I can manually create
> >   /home/peter/rpmbuild/BUILDROOT/myapp-5.2-1el6.x86_64/
> >   and copy all my file in there but that's a lot of extra work.
> >
> > Is there a way to get the same functionality on CentOS6 where rpmbuild will
> > collect the files from the main / directory and build the rpm package?
> >
> > Thank you,
> >
> > -- Peter
> > _______________________________________________
> > CentOS mailing list
> > CentOS at centos.org
> > http://lists.centos.org/mailman/listinfo/centos
> >
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos

Or you can set the _topdir variable to your liking:

cat /home/marcdeop/.rpmmacros 
%_topdir      %(echo $HOME)/rpmbuild
%_smp_mflags  -j3