Results 1 to 4 of 4
Thread renamed from: RPM Confusion
I have read, and re-read (almost) the entire guide, but am still confused about a few things.
I've set up a "sandbox", as recommended:
cat ...
- 05-08-2009 #1Just Joined!
- Join Date
- May 2009
- Posts
- 2
rpmbuild Confusion
Thread renamed from: RPM Confusion
I have read, and re-read (almost) the entire guide, but am still confused about a few things.
I've set up a "sandbox", as recommended:
cat ~/.rpmmacros
%_topdir /home/jack/sandbox
%_builddir %{_topdir}/BUILD
%_rpmdir %{_topdir}/RPMS
%_sourcedir %{_topdir}/SOURCES
%_specdir %{_topdir}/SPECS
%_srcrpmdir %{_topdir}/SRPMS
First of all, I noticed that if I try to use
%_topdir ~/sandbox
or
%_topdir $HOME/sandbox
that the macros don't expand correcly, so I get weird errors
error: cannot create ~/sandbox/RPMS/i386: No such file or directory
error: Could not open ~/sandbox/RPMS/i386/Xapi-0.01-2.i386.rpm: No such file or directory
or
cannot create $HOME/sandbox/RPMS/i386: No such file or directory
Could not open $HOME/sandbox/RPMS/i386/Xapi-0.01-2.i386.rpm: No such file or directory
but if I put the explicit path
%_topdir /home/jack/sandbox
I am able to generate an rpm package successfully.
Secondly, there seems to be no way to test the installation as a non-root user:
rpm -U RPMS/i386/Xapi-0.01-1.i386.rpm
results in this
error: can't create transaction lock on /var/lock/rpm/transaction
I would greatly appreciate any insight which might clarify these issues.
- 05-08-2009 #2Just Joined!
- Join Date
- May 2009
- Posts
- 2
More rpmbuild confusion
The rpm utility is supposed to honor the --prefix switch.
The man page reads:
--prefix NEWPATH
For relocatable binary packages, translate all file paths that start with the installation prefix in the package relocation hint(s) to NEWPATH.
I can't find documentation on package relocation hints.
Where do I put them in the spec file ?
Do I put them in the spec file ?
How do I set the relocation hints at all ?
Why are they hints - if I say relocate, I want it done, not hint that it might be nice !
WTF is going on with RPM ?
Update:
So, are a search for the word "relocatable" in the RedHat rpm guide, I notice that it is covered in the 'advanced' section. Why such a basic topic is considered advanced remains a mystery. None-the-less, it appears to be a bit of a muddle; as an example:
"All files in the %files section must be located under one of the Prefix: directories".
And in the next sentence
"If you have more than one top-level directory, such as /usr and /etc, define more than one Prefix: directive."
Then there is a reference to Chapter 4, which does not seem to contain any information on installing packages (it talks about querying the rpm database) or how to specify different locations for the different prefixes
So, how do I specify where the /usr files get relocated to, and where the /etc files get relocated to ?
- 05-08-2009 #3Just Joined!
- Join Date
- May 2009
- Posts
- 6
On your first two, I can confirm your observations with my own experience.
Yes, it seems that rpmbuild macros do not expand shell special variables.
Yes, you must be root to test you package because installing a package means modifying the system RPM database.
I cannot help you on relocatable (changing the prefix) packages. Here is where I usually look for rpmbuild docs:
h ttp://docs.fedoraproject.org/drafts/rpm-guide-en/
And I just use Google to search that site specifically.
- 06-28-2009 #4Just Joined!
- Join Date
- Jun 2009
- Posts
- 1
To install as a user foo
copy the rpm db
cp -r /var/lib/rpm ~/sandbox
then set dbpath in your ~/.rpmmacros
%_dbpath /home/foo/sandbox/rpm
Then install either with
rpm --relocate /usr=/home/foo/sandbox/usr -i bar.rpm
Alternately you could use just the command line:
rpm --dbpath /home/foo/sandbox/rpm --relocate /usr=/home/foo/sandbox/usr -i bar.rpm
Or if the rpm package supports prefix
rpm --prefix=/home/foo/sandbox -i bar.rpm
I find more support for --relocate than --prefix; but thats more of a build src vs binary thing.


Reply With Quote