RPM Community Forums

Mailing List Message of <rpm-users>

Re: rpm spec: clearing Prefix: to create a non-relocatable subpackage (of a relocatable package)?

From: Jeffrey Johnson <n3npq@me.com>
Date: Wed 09 Oct 2013 - 19:46:21 CEST
Message-id: <CB5E4387-4A4D-4AF5-91DF-24632E761EB0@me.com>

On Oct 7, 2013, at 8:02 AM, Andreas Luik wrote:

> Hello,
>   I'm trying to create a non-relocatable subpackage from a spec file, where the
> main package is relocatable, i.e. has a Prefix: tag.  It is possible to use Prefix:
> for subpackages, e.g. to use a different value as for the main package, but I
> have not been able to "clear" the main package's prefix setting.  Using the following
> spec file:
> Name: xxx
> Version: 1.0
> ...
> Prefix: /usr/local
> %description
> test
> %package sub
> Summary: subpackage
> Prefix:
> %description sub
> subpackage test
> ...
> (Prefix: without a value) generates the error message
> error: line xx: Empty tag: Prefix:
> Thanks in advance for any suggestions.

The real problem here is in the assumed goal of "create a non-relocatable subpackage".

Every path in every package can be relocated by --relocate /old/path=/newpath. The
only restriction is that only full directory/file paths, not partial paths, can be relocated.
E.g. given a path like /A/B/C/abc, one cannot relocate with a file prefix (or pattern) like
	--relocate /A/B/C/a=/somewhere/else

The only current usage for a Prefix: (and multiple Prefix:'s or Prefixes: are permitted) is
to automatically disable a warning/error message that can be overridden by another option.

If you want to use Prefix:, then specify all relocations in all subpackages. The behavior
for a "non-relocateable" subpackage will always depend on what options were used
to install that package, and there is no way (nor should there be: only the end-user,
not the builder, can determine what paths are useful/needed in general) to prevent
--relocate from being used with appropriate overrides.

Note that the modestly serious design flaw with relocateable paths in *.rpm packages is that
the relocations are not remembered persistently. So if you decide to relocate some
path, then you also need to add --relocate on every future install.

The other flaw is that relocations are per-transaction (or CLI invocation), not per-package.
This means that if you have two packages with an identical path which you want to
relocate in one package but not the other, then the 2 package installations MUST be
in in different transactions and installed separately.


73 de Jeff

> Kind regards,
> -- 
> i. A. Andreas Luik
> in - innovative navigation GmbH
> phone: +49 7154 807171
> fax: +49 7154 807154
> email: Andreas.Luik@innovative-navigation.de
> in - innovative navigation GmbH, Leibnizstrasse 11, D-70806 Kornwestheim
> Geschäftsführer/Managing Directors:
> Dr. Thomas Gern, Dr. Martin Sandler, Dr. Reinhard Zimmermann, Uwe Vögele
> Handelsregister: Stuttgart HRB 205770
> in - innovative navigation GmbH is ISO 9001:2008 certified. 
Received on Wed Oct 9 20:46:33 2013
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.