0

I have a package, with the directories named lib, sample, api, doc under a parent directory %{name}-%{version}. I want to generate an RPM package out of these folders. This rpm package should unfold these directories under a client specified relocated destination folder. A %{name}-%{version} folder, that has all package directories, is compressed in a tar.gz and kept under a SOURCE folder. After reading spec documentation and web resources, I made the following spec file.

Name: BATMAN
Version: 1.0.0
Release:    1%{?dist}
Summary: A cricket match program
Group: System Environment/Base
License: MEMEME
Source0: BATMAN-1.0.0.tar.gz
Prefix: /tmp
%define reloc_dir /tmp
%define target_dir %{reloc_dir}/manish
%define installdir PingPong-v%{version}

%description
Here comes the description

%prep
rm -rf %{_topdir}/BUILD/*
rm -rf %{target_dir}

%setup

%install
mkdir -p %{buildroot}
cp -R %{_topdir}/BUILD/%{name}-%{version}/* %{buildroot}

###What should come down here##############
mkdir -p %{target_dir}
install -dD %{buildroot}/* %{target_dir}
###########################################

#find %{target_dir} -type d -exec chmod 755 {} \;
#find %{target_dir} -type f -exec chmod 644 {} \;
#chmod -R 755 %{target_dir}

%files
/sample/sample.cpp
/header/BATMAN.hpp
/header/BALLMAN.hpp
/header/BUSYMAN.hpp
/header/BUSHYMAN.hpp
/doc/BATMAN.docx
/lib/BATMAN.so
/lib/BALLMAN.so
/lib/BUSYMAN.so
/lib/BUSHYMAN.so

%defattr(-,root,root,0755)

%clean
rm -rf $RPM_BUILD_ROOT

%changelog

The %setup command successfully unfolds compressed folder under %{_topdir}/BUILD/. Then I copied these files to %{buildroot} (because %files tag was expecting files to be present under BUILDROOT to package). Packaging of all these files is also done successfully but when I run sudo rpm -ivh --nodeps <Package-Vesrion-Arch>.rpm command on resulting rpm then I donlt see any folder getting created under destination side or any copying happening. Although it shows that package is being installed successfully; rpm -qa has an entry for my package.

Manish Shukla
  • 562
  • 6
  • 18
  • Please add the output of `rpm -ql -p package.rpm`. Your `%files` section should add a `%{reloc}` to all entries (or something like this). Ie, `%{reloc}/samples/sample.cpp`, etc. I think you have placed them in the **root** directory. You might like to use `chroot` when you test installs. – artless noise Apr 20 '13 at 18:24
  • Can you clarify this: 'client specified relocated destination folder'? Why are the users installing this not using --root if they're going to be using the rpm into a different directory? – Forrest Apr 23 '13 at 02:03

0 Answers0