I have java application with pom.xml. I am making rpm package with prefixes tags .
When I am querying on prefix tags of rpm :
sudo rpm -qp --queryformat "%{prefixes}\n" java-hbase-processor-1.0-SNAPSHOT20160330060627.noarch.rpm
I got ==> /var
IF I run following command :
rpm -qi java-hbase-processor | grep Relocations
I got : Relocations : /opt /tmp Relocations : /var /tmp
All above shows that rpm is relocatable . But if run install command
sudo rpm -i --prefix=/home/sohanvir/ java-hbase-processor-1.0-SNAPSHOT20160330060627.noarch.rpm
It will give error with message:
error: package java-hbase-processor is not relocatable
Thanks in advance .
According to RPM.org :
By default, RPM will install a relocatable package in the prefix directory listed in the spec file. You can override this on the RPM install command line with "--prefix
<dir>
" . For example, if the package in question were going to be installed in "/opt" but you don't have enough disk space there (and it is a relocatable package), you could install it "--prefix /usr/opt" .If there is more then one Prefix you may relocate each prefix separately by using syntax like:
rpm ... --relocate /opt=/usr/opt --relocate /etc=/usr/etc ...
If any of the Prefixes is not being relocated they can be skipped on the command line
However, it goes on to say that there are a number of things that can go wrong in building a relocatable RPM (even if you see the Prefix
tags). If you only want to extract files from the RPM, there are tools for that (such as rpmunpack
, rpm2cpio
or unrpm
).
Further reading:
Chapter 15. Making a Relocatable Package
A relocatable package is a package that is standard in every way, save one. The difference lies in the prefix tag. When this tag is added to a spec file, RPM will attempt to build a relocatable package.
Note the word "attempt". There are a few conditions that must be met before a relocatable package can be built successfully, and this chapter will cover them all. But first, let's look at exactly how RPM can relocate a package. And the one component at the heart of package relocation is the prefix tag.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.