Issue
I am trying to create a "relocatable RPM" of bunch of script and .png files. No build/compile. I wrote
Name: utp
Version: 1.0
Release: 1%{?dist}
Summary: some summary
Group: Applications/Engineering
License: Proprietary
URL: http://www.example.com
Source0: %{name}-%{version}.tgz
BuildArch: noarch
Prefix: /opt
%description
A very nice description
%prep
echo "=== prep ... done"
%setup -n utp
echo "=== setup ... done"
# %files -f %{_tmppath}/files.list
%files
and I get
medi@medi:~/work> rpm -qi -p rpmbuild/RPMS/noarch/utp-1.0-1.el8.noarch.rpm
Name : utp
Version : 1.0
Release : 1.el8
Architecture: noarch
Install Date: (not installed)
Group : Applications/Engineering
Size : 0
License : Proprietary
Signature : (none)
Source RPM : utp-1.0-1.el8.src.rpm
Build Date : Mon 17 Feb 2020 03:44:00 PM PST
Build Host : medi.example.com
Relocations : /opt
URL : http://www.example.com
Summary : some summary
Description :
A very nice description
and
medi@medi:~/work> rpm -ql -p rpmbuild/RPMS/noarch/utp-1.0-1.el8.noarch.rpm
(contains no files)
medi@medi:~/work>
Most likely the problem is with '%files'. I tried to specify a list (commented out now), but I ran into the following
Processing files: utp-1.0-1.el8.noarch
error: Directory not found: /home/medi/work/rpmbuild/BUILDROOT/utp-1.0-1.el8.x86_64/opt/utp
error: File not found: /home/medi/work/rpmbuild/BUILDROOT/utp-1.0-1.el8.x86_64/opt/utp/utg
error: File not found: /home/medi/work/rpmbuild/BUILDROOT/utp-1.0-1.el8.x86_64/opt/utp/utg/UserGuide.txt
where my file.list looks like
/opt/utp/
/opt/utp/utg
/opt/utp/utg/UserGuide.txt
/opt/utp/utg/install.txt
Since I want to make this a relocatable one (see Prefix: /opt), I prepended '/opt'.
I think overall, I am confused. Yes I did read the doc, but I am missing it.
Solution
The reason for pkg not having content is because %file directive was empty and with -f one has to be careful about where files are. After many reads, I figured that %files look for files in %{buildroot} by default so this combination solved it
%install
cp -r ./* %{buildroot}
%files
/%{name}
So, now I have content, but then I ran into some shebang_mangling, where I had to disable that.
Answered By - Medi Montaseri