RPM spec made relocatable by adding prefix but whi

2019-08-08 18:54发布

问题:

Summary: A small lighttpd
Name: lighttpd
Version: 1.4.28
Release: 1000

License: LGPL
Group: Applications/Webserver
URL: http://www.lighttpd.com/
Source: http://www.lighttpd.com/lighttpd-%{version}.tar.gz
BuildRoot: %{name}-%{version}
Prefix: /opt/src/Opensource/lighttpd-1.4.28/install
#Do not terminate if there are files in the buildroot that are not packed into the rpm.
%define _unpackaged_files_terminate_build       0
#Do not terminate if there are any documents missing in the buildroot dir and not      packaged
%define _missing_doc_files_terminate_build      0
%description
A small foot print webserver
%files
%defattr(-, root, root, 0755)
#%doc README
/sbin/lighttpd
/lib/mod_auth.so
/lib/mod_cgi.so
/lib/mod_cml.so
/lib/mod_compress.so
Given this i build my rpm using the following command
rpmbuild -bb --buildroot /opt/src/Opensource/lighttpd-1.4.28/install  lightppd.spec
rpm -qpi  on the generated rpm gives me the following output
Name        : lighttpd               Relocations:/opt/src/Opensource/lighttpd-1.4.28/install
Version     : 1.4.28                            Vendor:  Repository
Release     : 1000                          Build Date: Tue 19 Jul 2011 05:17:44 PM PDT
Install Date: (not installed)               Build Host: 
Group       : Applications/Webserver        Source RPM: lighttpd-1.4.28-1000.src.rpm
Size        : 259873                           License: LGPL
Signature   : (none)

while installing i issue the command

rpm -ivh --prefix /opt/components/  --dbpath /opt/rpm/database

I get the rpm installed 

but i dont see any installtion directory or files installed in the location /opt/components

回答1:

Check out http://www.rpm.org/max-rpm/s1-rpm-reloc-wrinkles.html, in particular the first bullet that says "files in the %files section should start with the prefix tag line".

Try prefixing your file names in your %files section with '/opt/src/Opensource/lighttpd-1.4.28/install', rebuild the rpm and then try the installation again.