[cmake-developers] [PATCH][CPack][RPM] multiple path relocation prefixes

Domen Vrankar domen.vrankar at gmail.com
Mon Jan 12 09:20:19 EST 2015


> I'm not familiar with the corresponding use case.  Please explain
> how "multiple relocation paths" works in general with RPM tools.

In RPM packages you can specify multiple "Prefix:" sections and during
installation you have multiple options:

use "--prefix <new_path>" during installation: this will take the
value of first "Prefix:" path from spec file and relocate all the
paths from old path to provided path (I'd say that this is a back
compatibility feature of RPM) - for this reason I have preserved first
"Prefix:" path in spec file to be the same as in
CPACK_PACKAGING_INSTALL_PREFIX variable (same as before the patch) in
situations where this path is really used (with the patch
CPACK_PACKAGING_INSTALL_PREFIX would probably be set to / in most
cases).

use --relocate <path_from_spec_file>=<new_path> (this flag may be
repeated multiple times): "Prefix:" path from spec file that matches
the one provided by relocate flag will be replaced by new path and
this enables us to move for e.g. only documentation or libraries - we
are no longer bound to one root location for all files in a single
relocatable RPM.

http://rpm5.org/docs/api/relocatable.html

e.g.
-------------------------

spec file:
Prefix: /foo
Prefix: /foo/bin
Prefix: /foo/share/lib

/foo/bin/some_program
/foo/lib/some_lib
/foo/share/lib/some_other_lib
/bar/not_relocatable

rpm installation:
rpm -i --relocate /foo/bin=/bar/bin --relocate /foo/share/lib=/foo/lib
<rpm_file>

This will relocate some_program and some_other_lib during install but
will keep some_lib on the same location as defined in spec file.

rpm installation option 2:
rpm -i --prefix /foo/share <rpm_file>

This will relocate all three files to /foo/share/bin/some_program,
/foo/share/lib/some_lib and /foo/share/share/lib/some_other_lib

In both cases not_relocatable file will not be relocated since its
path prefix was not defined in spec file as relocatable.

-------------------------

I've checked and this feature is provided in RPM 3.0.5 on AIX as well
as in 4.12 on latest Fedora (version 21) so the feature is not just
RPM5 fork specific.

I've bound the relocation paths to standard GNU filesystem locations
and since GNUInstallDirs.cmake module already provides this
functionality for install command I extended that module. I don't know
who the maintainer of the module is so I hope that extending it in
such way is OK.

Thanks,
Domen


More information about the cmake-developers mailing list