Issue
I want to install gstatus to /usr/local/gstatus/gstatus-0.66. The original tarball install it to <current_path>/gstatus-0.66. How do I modify the spec to make it install to the right place? Original spec:
Name: gstatus
Version: 0.66
Release: 1%{?dist}
...
Source0: %{name}-%{version}.tar.gz
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
...
%prep
%setup -q -n %{name}
...
%install
rm -rf %{buildroot}
%{__python} setup.py install --skip-build --root %{buildroot} --install-scripts %{_bindir}
mkdir -p %{buildroot}%{_mandir}/man8
install -m 0644 gstatus.8 %{buildroot}%{_mandir}/man8/
gzip %{buildroot}%{_mandir}/man8/gstatus.8
...
/usr/local does exist, but I need to create /usr/local/gstatus. Can I modify %install section to:
%install
rm -rf %{buildroot}
mkdir /usr/local/gstatus
%{__python} setup.py install --skip-build --root /usr/local/gstatus/%{buildroot} --install-scripts %{_bindir}
mkdir -p /usr/local/gstatus/%{buildroot}%{_mandir}/man8
install -m 0644 gstatus.8 /usr/local/gstatus/%{buildroot}%{_mandir}/man8/
gzip /usr/local/gstatus/%{buildroot}%{_mandir}/man8/gstatus.8
...
Solution
No. Inside the %install
section you need to put everything under %{buildroot}
. You probably should do something like:
%install
mkdir -p %{buildroot}/usr/local/gstatus/
--root %{buildroot}/usr/local/gstatus/
%files
/usr/local/gstatus/
A few notes:
- yes you need to create all directories under
%{buildroot}
(/usr etc), but you should only package the directories that belong to you. The packaging happens in%files
- under
%files
specifying a directory is recursive by default. By specifying/usr/local/gstatus/
here, the directorygstatus
is packaged recursively.
Answered By - Chris Maes Answer Checked By - Gilberto Lyons (WPSolving Admin)