RPM: Using the rpm command (Tips and tricks)
Revision as of 17:30, 21 August 2012 by David (talk | contribs) (Created page with "===== Extract Scripts ===== <syntaxhighlight> rpm -qp --scripts my_package.rpm > ListOfScripts </syntaxhighlight> ===== Force remove/ uninstall ===== <syntaxhighlight> rpm -e --nodeps </syntaxhighlight> ===== Extract F...")
Extract Scripts
rpm -qp --scripts my_package.rpm > ListOfScriptsForce remove/ uninstall
rpm -e --nodepsExtract Files
- Not installing
rpm2cpio my_package.rpm | cpio -idmvWhat RPM does a file belong to
rpm -qif /path/to/fileWhat files does an RPM provide
#If RPM is installed
rpm -ql rpm-pacakge-name
# include file info
rpm -qil rpm-package-name
#If RPM is not installed
rpm -qpl ./rpm-package-name
rpm -qpil ./rpm-package-nameCreate an RPM
1. I recompiled hdf5 and put it under /shared/hdf5-1.8.7.gnu/ :
[root@mel1 ~]# ls /shared/hdf5-1.8.7.gnu/
bin include lib share2. I created a dummy spec file that will just package what’s under this directory:
Summary: my own package
Name: hdf
Version: 1.2.3.4
Release: 1
License: my_license
Group: Applications/System
%description
Brief description of software package.
%prep
%build
%install
%clean
%files
%defattr(-,root,root)
/shared/hdf5-1.8.7.gnu/*
%changelog3. Then I can build the binary rpm:
rpmbuild -bb ./testhdf.spec4. The binary rpm will be then available here:
[root@mel1 ~]# ls /usr/src/redhat/RPMS/x86_64/hdf-1.2.3.4-1.x86_64.rpm
/usr/src/redhat/RPMS/x86_64/hdf-1.2.3.4-1.x86_64.rpm
[root@mel1 ~]# rpm -qpi /usr/src/redhat/RPMS/x86_64/hdf-1.2.3.4-1.x86_64.rpm
Name : hdf Relocations: (not relocatable)
Version : 1.2.3.4 Vendor: (none)
Release : 1 Build Date: Mon 18 Jul 2011 11:53:14 AM EDT
Install Date: (not installed) Build Host: mel1.lsf.platform.com
Group : Applications/System Source RPM: hdf-1.2.3.4-1.src.rpm
Size : 20293890 License: my_license
Signature : (none)
Summary : my own package
Description :
Brief description of software package.
[root@mel1 ~]# rpm -qp --provides /usr/src/redhat/RPMS/x86_64/hdf-1.2.3.4-1.x86_64.rpm
libhdf5.so.7()(64bit)
libhdf5_cpp.so.7()(64bit)
libhdf5_fortran.so.7()(64bit)
libhdf5_hl.so.7()(64bit)
libhdf5_hl_cpp.so.7()(64bit)
libhdf5hl_fortran.so.7()(64bit)
hdf = 1.2.3.4-1
[root@mel1 ~]# rpm -qpl /usr/src/redhat/RPMS/x86_64/hdf-1.2.3.4-1.x86_64.rpm
/shared/hdf5-1.8.7.gnu/bin
/shared/hdf5-1.8.7.gnu/bin/gif2h5
/shared/hdf5-1.8.7.gnu/bin/h52gif
/shared/hdf5-1.8.7.gnu/bin/h5c++
/shared/hdf5-1.8.7.gnu/bin/h5cc
/shared/hdf5-1.8.7.gnu/bin/h5copy
/shared/hdf5-1.8.7.gnu/bin/h5debug
/shared/hdf5-1.8.7.gnu/bin/h5diff
/shared/hdf5-1.8.7.gnu/bin/h5dump
/shared/hdf5-1.8.7.gnu/bin/h5fc
/shared/hdf5-1.8.7.gnu/bin/h5import
/shared/hdf5-1.8.7.gnu/bin/h5jam
/shared/hdf5-1.8.7.gnu/bin/h5ls
/shared/hdf5-1.8.7.gnu/bin/h5mkgrp
/shared/hdf5-1.8.7.gnu/bin/h5perf_serial
/shared/hdf5-1.8.7.gnu/bin/h5redeploy
/shared/hdf5-1.8.7.gnu/bin/h5repack
/shared/hdf5-1.8.7.gnu/bin/h5repart
/shared/hdf5-1.8.7.gnu/bin/h5stat
....
...