[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: Off-root building of RPMs
- From: Nigel Metheringham <Nigel Metheringham dev intechnology co uk>
- To: RPM Package Manager <rpm-list redhat com>
- Subject: Re: Off-root building of RPMs
- Date: Fri, 05 May 2006 09:24:27 +0100
On Fri, 2006-05-05 at 10:48 +1000, John Pye wrote:
> I'm new to this list although I've been building RPMs for a little while
> now. I have finally decided it's time to build my RPMs as a user other
> than root -- to try to work out the problems that I previously had with
> that.
I do wonder if we should make rpmbuild *refuse* to run as root.
> The first problem is that according to 'Maximum RPM' I should be able to
> add a ~/.rpmrc file containing just "topdir:/home/buildbot/rpmbuild",
> and, so long as I have created the required directories (mkdir
> ~/rpmbuild && cd ~/rpmbuild && mkdir SPECS SOURCES RPMS SRPMS BUILD),
> then I should be able to just run 'rpmbuild' and it should all work. It
> doesn't: I get a complaint about the 'topdir' line in my .rpmrc being
> invalid. This is on FC5 with rpm-4.4.2-15.2.
Maximum RPM is really rather dated now.
> I found that the only way to build RPMs off-root was to use the
> suggested .rpmmacros to replace %_topdir with something else. There was
> a nice little download script on the RPM webpage that looked after all
> that. But it seems that the manual needs to be updated to explain if/why
> the .rpmrc approach isn't working, and whether or not that's a
> Fedora-only issue, or what.
Best thing is probably to get the Fedora RPM Development Tools - see
http://fedoraproject.org/wiki/fedora-rpmdevtools
fedora-buildrpmtree sets things up for you. An alternative is
(strangely) the cpan2rpm command/package -
cpan2rpm --mk-rpm-dirs
sets things up for you
> Next, my off-root RPM build fails due to 'install -o root -g root'
> commands. What is the suggested why to have RPMs built for correct root
> installation if you're not able to use the 'install -o' command during
> the build? Is that where the %defattr stuff comes into play? Should I
> not use 'install -o' in RPMs?
Don't set the owner in the %install phase, but instead use a combination
of %defattr for the overall attributes setting, and %attr for specific
file/directory attribute setting.
> Finally, my trickiest problem. I have an RPM spec file as shown below
> that results in a dependency on '/usr/bin/perl5'. I don't have this on
> my system, so I want to trace back where the dependency is coming from.
> I suspect that the 'update-mime-database' command in my %pre and %post
> could be responsible -- how can I check that?
Just do a
find /my/source/dir -type f -print | xargs fgrep /usr/bin/perl5
and see what you get.
The thing like that that catches me out sometimes is examples in the
package documentation that get swept up and including in the %doc file
set. If any of those are executable they will be included in the deps
checking - so an executable perl script which starts
#!/usr/bin/perl5
will cause that dep. Solution is to chmod the file to 444.
Reading the stuff on the Fedora Extras wiki is worth doing - even if you
never intend to submit packages to Extras or even use Fedora. Start at
http://fedoraproject.org/wiki/Packaging/Guidelines
If you are packaging stuff that is going to be put on any other machine
I would strongly recommend using a proper build environment, which makes
sure that things aren't just building because you happen to have a file
in a particular place on your box... it makes things reproducible.
The Fedora Extras favoured one appears to be Mock:-
http://fedoraproject.org/wiki/Extras/MockTricks
http://fedoraproject.org/wiki/Projects/Mock
Personally I use mach - which I find more efficient since it does not
rebuild the build environment every time. [However I do wonder if we
should get something with a happy medium - saves the clean build
environment as a archive, and reinstates that each time]
Mach is at
http://thomas.apestaart.org/projects/mach/
and is also packaged within Fedora Extras and some other environments.
Nigel.
--
[ Nigel Metheringham Nigel Metheringham InTechnology co uk ]
[ - Comments in this message are my own and not ITO opinion/policy - ]
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]