[Fedora-packaging] %{_prefix} vs Prefix: and relocatable packages (was: cmake rpm macro(s):)

Axel Thimm Axel.Thimm at ATrpms.net
Tue Mar 20 14:33:02 UTC 2007


On Tue, Mar 20, 2007 at 01:48:45PM +0000, Kevin Kofler wrote:
> Axel Thimm <Axel.Thimm <at> ATrpms.net> writes:
> > > Won't setting %{_prefix} make the package relocatable?
> > 
> > At build time? No, it won't, and for truly being relocatable the
> > package needs to support this at runtime, e.g. the build should not
> > hardwire /usr and friends anywhere. Being relocatabale needs a lot of
> > work at the source level.
> 
> No, my question was if it will make RPM _think_ the package is relocatable, 
> even if it actually is not, which of course will screw up badly if the user 
> really tries to relocate the package.

I understand what you mean - no, setting _prefix does not make a
package relocatable. The long version follows:

Packages become relocatable by having a

Prefix: ...

tag. That's not how _prefix is set, _prefix is set like

%_prefix /usr

under /usr/lib/rpm somewhere, or even by %define _prefix ... in the
specfile.

You will sometimes find

Prefix: /
or
Prefix: /usr
or
Prefix: %{_prefix}

That doesn't really set prefix, it tells rpm that you promise to
install everything under that folder and nowhere else outside of it
(rpmbuild will bail out otherwise) and that that part of the buildroot
is relocatable.

Is it clearer or did I add to the confusion :)
-- 
Axel.Thimm at ATrpms.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-packaging/attachments/20070320/c0ec57df/attachment.sig>


More information about the Fedora-packaging mailing list