RPM Community Forums

Mailing List Message of <rpm-devel>

RPM Runtime Relocation patch

From: Hatle, Mark <mark.hatle@windriver.com>
Date: Tue 05 Jun 2007 - 05:29:15 CEST
Message-ID: <EBFDFFB87BB22F4AB1B801A86BB41BC70B83D7@ala-mail02.corp.ad.wrs.com>

This is not a completed patch, but a start at the patch.

What problem am I trying to solve?

In the various cross compile environments I have to deal with, rpm is installed not as a distribution tool, but as an application used to control and maintain an embedded linux distribution.

RPM is shipped to the end user as a precompiled binary, that gets installed along with the other embedded linux development tools.  Instead of a traditional system, where rpm is ONLY installed into /usr/lib/rpm, on our system the user may install rpm anywhere they have permissions to write software.

Some users choose /opt/windriver, others /usr/local, others ~/windriver, etc..  So the problem is that various internally hard coded path names cause problems in RPM.

There are three path names in rpm5-4_5 that cause issues:

*) location to /usr/lib/rpm (aka _usrlibrpm)
*) location to /etc/rpm (aka _etcrpm)
*) The LOCALEDIR


The solution:

Luckily rpm5-4_5 has much of the solution already implemented, specifically references to _usrlibrpm, and _etcrpm.  What is required is defining _usrlibrpm and _etcrpm values as early as possible, and making them adjustable at run-time.

The "automatic" run-time adjustment code is left out of this patch, as it's not yet clear what code will be used.  However a substitute function is provided to give a working prototype: void setRuntimeRelocPaths(void)  ...  This function checks three environment variables RPM_USRLIBRPM, RPM_ETCRPM, and RPM_LOCALEDEF, and sets the macros accordingly.  (If the environment variables are not set, it sets them with the defaults.)

The various macros, rpmrc and helper scripts are adjusted to use the _usrlibrpm and _etcrpm macros (or environment variable in the case of the scripts.)


I'm sure there will be questions on this, but I would like to get something similar to this into rpm5-4_5 in the near future.  Any suggestions to the setRuntimeRelocPaths would be appeciated.  Currently I'd like to use make_relative_prefix from libiberty, but there appears to be a license issue preventing that..  but if you are familar with that function it should give you an idea of what I'd like to do.  An alternative which my company has used before is a shell script wrapper to rpm and rpmbuild that sets up the LD_LIBRARY_PATH and the environment variable(s) and then execs rpm.  (That may be a cleaner way to handle this.)

--Mark



Received on Tue Jun 5 05:29:43 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.