I created a directory structure as shown below:
Code:
$cd /home/raj
$cd rpmbuild/
$ls BUILD/ BUILDROOT/ SPECS/ SOURCES/ tmp/
$cd /home/raj/rpmbuild/SOURCES
[raj@proj SOURCES]$ ls
etc opt usr
[raj@roj SOURCES]$
I created one file under each directory and zipped it through tar cvf command
Code:
SOURCES]$ ls
custom.tar.gz
Now I create a SPEC file like shown below:
Code:
Name: custom
Version: 1.0
Release: 1%{?dist}
Summary: Custom sam PKG
Group: Development/Libraries
License: GPL
URL: NA
Source: custom-1.0.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: gcc
Requires: glibc
%description
This is my test RPM
%prep
%setup -q
%build
%install
find "$RPM_BUILD_ROOT" -not -type d -printf '%%attr(%m,root,root) /%P\n' > %{_tmppath}/%{name}_contents.txt
%clean
rm -rf $RPM_BUILD_ROOT
%files
%files -f %{_tmppath}/%{name}_contents.txt
[raj@proj SPECS]$ rpmbuild -bb custom.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.tasfMI
+ umask 022
+ cd /home/raj/rpmbuild/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /home/raj/rpmbuild/BUILD
+ rm -rf custom-1.0
+ /bin/tar -xf /home/raj/rpmbuild/SOURCES/custom-1.0.tar.gz
+ cd custom-1.0
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.b4qn0X
+ umask 022
+ cd /home/raj/rpmbuild/BUILD
+ cd custom-1.0
+ LANG=C
+ export LANG
+ unset DISPLAY
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.e0qhfd
+ umask 022
+ cd /home/raj/rpmbuild/BUILD
+ '[' /home/raj/rpmbuild/BUILDROOT/custom-1.0-1.el6.x86_64 '!=' / ']'
+ rm -rf /home/raj/rpmbuild/BUILDROOT/custom-1.0-1.el6.x86_64
++ dirname /home/raj/rpmbuild/BUILDROOT/custom-1.0-1.el6.x86_64
+ mkdir -p /home/raj/rpmbuild/BUILDROOT
+ mkdir /home/raj/rpmbuild/BUILDROOT/custom-1.0-1.el6.x86_64
+ cd custom-1.0
+ LANG=C
+ export LANG
+ unset DISPLAY
+ find /home/raj/rpmbuild/BUILDROOT/custom-1.0-1.el6.x86_64 -not -type d -printf '%attr(%m,root,root) /%PATCH\n'
+ /usr/lib/rpm/find-debuginfo.sh --strict-build-id /home/raj/rpmbuild/BUILD/cust om-1.0
+ /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
+ /usr/lib/rpm/brp-python-bytecompile
+ /usr/lib/rpm/redhat/brp-python-hardlink
+ /usr/lib/rpm/redhat/brp-java-repack-jars
Processing files: custom-1.0-1.el6.x86_64
Processing files: custom-debuginfo-1.0-1.el6.x86_64
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/raj/rpmbuild/BUI LDROOT/custom-1.0-1.el6.x86_64
warning: Could not canonicalize hostname: cseproj
Wrote: /home/raj/rpmbuild/RPMS/x86_64/custom-1.0-1.el6.x86_64.rpm
Wrote: /home/raj/rpmbuild/RPMS/x86_64/custom-debuginfo-1.0-1.el6.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.T5grtY
+ umask 022
+ cd /home/raj/rpmbuild/BUILD
+ cd custom-1.0
+ rm -rf /home/raj/rpmbuild/BUILDROOT/custom-1.0-1.el6.x86_64
+ exit 0
While I check if RPM contains files or not, I found:
Code:
rpm -qlip custom-1.0-1.el6.x86_64.rpm
Name : custom Relocations: (not relocatable)
Version : 1.0 Vendor: (none)
Release : 1.el6 Build Date: Fri 17 May 2013 09:12:06 AM IST
Install Date: (not installed) Build Host: cseproj
Group : Development/Libraries Source RPM: custom-1.0-1.el6.src.rpm
Size : 0 License: GPL
Signature : (none)
URL : NA
Summary : Custom sam PKG
Description :
This is my test RPM
(contains no files)