Hi,
First off - apologies for long delay.
to clarify - I only ask about %doc macro.
I have created a minimal spec fie:
$ cat sample_rpm.spec
Name: sample_rpm
Version: 1
Release: 1%{?dist}
Summary: Sample rpm package
Group: Development/Tools
License: GPL
URL: None
Source0: sample_rpm.tar.xz
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
%description
Test package for '%doc'
global _defaultdocdir /opt/sample_rpm/share/doc
%prep
%setup -n sample_rpm
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/opt/sample_rpm/share/doc
#cp -R * %{buildroot}/opt/sample_rpm/share/doc
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%doc sample_file.txt
--------
which builds without issue, but the output of rpm -qpl is
$ rpm -qpl
/home/rpmtester/rpmbuild/RPMS/x86_64/sample_rpm-1-1.el6.x86_64.rpm
/usr/share/doc/sample_rpm-1
/usr/share/doc/sample_rpm-1/sample_file.txt
and not /opt/....
BTW, the content of the tar file is the single .txt file.
So the question remains - how do I override %doc install location?
On 04/03/2015 01:05 PM, Michael Schwendt wrote:
On Fri, 03 Apr 2015 11:21:47 +0300, Daniel Letai wrote:
Hi List,
I'm a newb at writing spec files, please bear with me.
I'm rebuilding a package for RHEL 6, so if this is the wrong list,
please let me know.
I have redefined the prefix stack:
%global _prefix /opt/%{name}/%{version}
%global _exec_prefix %{_prefix}
%global _bindir %{_exec_prefix}/bin
%global _sbindir %{_exec_prefix}/sbin
%global _libexecdir %{_exec_prefix}/libexec
%global _sysconfdir /etc
%global _sharedstatedir /var/lib
%global _localstatedir /var
%global _libdir %{_exec_prefix}/%{_lib}
%global _includedir %{_prefix}/include
%global _datarootdir %{_prefix}/share
%global _datadir %{_datarootdir}
%global _infodir %{_datarootdir}/info
%global _localedir %{_datarootdir}/locale
%global _mandir %{_datarootdir}/man
%global _docdir %{_datarootdir}/doc
%global _htmldir %{_docdir}
%global _dvidir %{_docdir}
%global _pdfdir %{_docdir}
%global _psdir %{_docdir}
%global _defaultdocdir %{_docdir}
In configure:
../configure \
--prefix=%{_prefix} \
--exec-prefix=%{_exec_prefix} \
--bindir=%{_bindir} \
--sbindir=%{_sbindir} \
--sysconfdir=%{_sysconfdir} \
--datadir=%{_datadir} \
--includedir=%{_includedir} \
--libdir=%{_libdir} \
--libexecdir=%{_libexecdir} \
--localstatedir=%{_localstatedir} \
--sharedstatedir=%{_sharedstatedir} \
--mandir=%{_mandir} \
--infodir=%{_infodir} \
--docdir=%{_docdir} \
...
In make install:
make DESTDIR=%{buildroot} \
prefix=%{_prefix} \
mandir=%{_mandir} \
infodir=%{_infodir} \
docdir=%{_docdir} \
install
The package completes without errors, resulting in RPMs, but In the
output I see multiple instances of:
+ DOCDIR=~/rpmbuild/BUILDROOT/<rpm top buildroot
dir>/usr/share/doc/%{name}-%{version}
+ export DOCDIR
and when installing the RPMs they install docs to /usr/share/doc.
when building and installing manually all is well (share/doc under /opt/...)
What am I doing wrong?
First, please clarify: The two steps you mention, the "configure" step
and "make install", are completely unrelated to %doc. Do you refer to
documentation files installed by "make install …" or to using the %doc
macro to copy local files to the package's documentation directory?
It should be a simple exercise to create a minimal spec file that
includes a single %doc line in its %files section to experiment with
redefined RPM macros (not limited to "rpmbuild -bb --define "_prefix /opt"
test.spec).
--
packaging mailing list
packaging@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/packaging
--
packaging mailing list
packaging@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/packaging