Hide Forgot
From Bugzilla Helper: User-Agent: Mozilla/4.78 [de] (X11; U; Linux 2.4.9-21 i686; Nav) Description of problem: I'm currently building some packages which depend on a relocatable third-party package (IBMJava2-SDK) and need to create some symlinks depending on _where_ the user actually has installed IBMJava2-SDK. Since installation of IBMJava2-SDK does not create any system-wide config files, tried to retrieve the prefix using the following line in my %post script JDKPREFIX=`rpm -q --queryformat '%{INSTALLPREFIX}\n' IBMJava2-SDK` however when executing, i get the following error: error: cannot get shared lock on /var/lib/rpm/Packages error: cannot open Packages index using db3 - Operation not permitted (1) If i would do a write-operation on the database, i would understand this error, but a query should open the rpm-db read-only?! Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1. Create a dummy RPM with the attached spec. 2. Install this RPM, it will hang in until you delete /tmp/rpmloop 3. On a second console, try some rpm queries, they will fail. Additional info:
Created attachment 44517 [details] specfile for creating an RPM which waits in %post until /tmp/rpmloop is removed
You can't invoke rpm from %post et al scriptlets because (as you have seen) the rpmdb has an exclusive lock. The install prefix that you want is in an environment variable. Build a test package with %post env exit 1 build, install with relocation, and you'll see the environment variable you want.
You misunderstood, I want to retrieve the install-prefix of _ANOTHER_ (thirparty), previously installed relocatable package from within the %post script of _MY_ package, _NOT_ the prefix of my package (that would be too easy ;-))
Then you can't do that from a %post scriptlet. You might try using slocate to find a file from the other package. Another alternative is to explicitly restrict relocations to a known set, and check each member of the set for installation. There's also the quick hack of passing an environment variable to the %post scriptlet from a query performed before attempting an install. Not recommended, but I believe that will work.