[libvirt] [PATCH] spec: fix libvirt-docs subpackage on RHEL

RHEL's rpmbuild wipes the docdir for a (sub-)package if any %doc directives are present, prior to copying in the marked documentation. This means we can't prepopulate this directory with the HTML documentation during the %install phase. Instead, move the HTML documentation to a temporary directory during %install and mark the contents of this temporary directory with %doc. Signed-off-by: Michael Chapman <mike@very.puzzling.org> --- libvirt.spec.in | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 72815f4..a5b01df 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1491,8 +1491,8 @@ rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.lxc rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.uml %endif -mv $RPM_BUILD_ROOT%{_datadir}/doc/libvirt-%{version} \ - $RPM_BUILD_ROOT%{_datadir}/doc/libvirt-docs-%{version} +# Copied into libvirt-docs subpackage eventually +mv $RPM_BUILD_ROOT%{_datadir}/doc/libvirt-%{version} libvirt-docs %if %{with_dtrace} %ifarch %{power64} s390x x86_64 ia64 alpha sparc64 @@ -1732,12 +1732,7 @@ fi %files docs %defattr(-, root, root) -%doc AUTHORS ChangeLog.gz NEWS README TODO - -# Website -%dir %{_datadir}/doc/libvirt-docs-%{version} -%dir %{_datadir}/doc/libvirt-docs-%{version}/html -%{_datadir}/doc/libvirt-docs-%{version}/html/* +%doc AUTHORS ChangeLog.gz NEWS README TODO libvirt-docs/* # API docs %dir %{_datadir}/gtk-doc/html/libvirt/ -- 1.8.4.2

On Wed, Nov 13, 2013 at 12:02:08PM +1100, Michael Chapman wrote:
RHEL's rpmbuild wipes the docdir for a (sub-)package if any %doc directives are present, prior to copying in the marked documentation. This means we can't prepopulate this directory with the HTML documentation during the %install phase.
Instead, move the HTML documentation to a temporary directory during %install and mark the contents of this temporary directory with %doc.
Huh, AFAICT, this has worked fine for years. What actual problem are you seeing without this patch ? Do you have the 'redhat-rpm-config' package installed ? Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On Wed, 13 Nov 2013, Daniel P. Berrange wrote:
On Wed, Nov 13, 2013 at 12:02:08PM +1100, Michael Chapman wrote:
RHEL's rpmbuild wipes the docdir for a (sub-)package if any %doc directives are present, prior to copying in the marked documentation. This means we can't prepopulate this directory with the HTML documentation during the %install phase.
Instead, move the HTML documentation to a temporary directory during %install and mark the contents of this temporary directory with %doc.
Huh, AFAICT, this has worked fine for years. What actual problem are you seeing without this patch ? Do you have the 'redhat-rpm-config' package installed ?
Yes, I do. Here's the relevant bits from my Mock log: Executing(%doc): /bin/sh -e /var/tmp/rpm-tmp.ZgFSCX + umask 022 + cd /builddir/build/BUILD + cd libvirt-1.1.4 + DOCDIR=/builddir/build/BUILDROOT/libvirt-1.1.4-1.el6.x86_64/usr/share/doc/libvirt-docs-1.1.4 + export DOCDIR + rm -rf /builddir/build/BUILDROOT/libvirt-1.1.4-1.el6.x86_64/usr/share/doc/libvirt-docs-1.1.4 + /bin/mkdir -p /builddir/build/BUILDROOT/libvirt-1.1.4-1.el6.x86_64/usr/share/doc/libvirt-docs-1.1.4 + cp -pr AUTHORS ChangeLog.gz NEWS README TODO /builddir/build/BUILDROOT/libvirt-1.1.4-1.el6.x86_64/usr/share/doc/libvirt-docs-1.1.4 + exit 0 warning: File listed twice: /usr/share/doc/libvirt-docs-1.1.4 Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 ... error: create archive failed on file /builddir/build/BUILDROOT/libvirt-1.1.4-1.el6.x86_64/usr/share/doc/libvirt-docs-1.1.4/html/32favicon.png: cpio: Bad magic RPM build errors: File listed twice: /usr/share/doc/libvirt-docs-1.1.4 create archive failed on file /builddir/build/BUILDROOT/libvirt-1.1.4-1.el6.x86_64/usr/share/doc/libvirt-docs-1.1.4/html/32favicon.png: cpio: Bad magic I think the problem was introduced with commit e23216da, and that it's only because the %doc directive now contains relative paths. Before then the only %doc directives in that subpackage were absolute paths. RHEL 6's rpmbuild at least seems to handle those differently, and it doesn't generate an "rm -rf" line if only absolute paths are present. - Michael

On Wed, 13 Nov 2013, Michael Chapman wrote:
error: create archive failed on file /builddir/build/BUILDROOT/libvirt-1.1.4-1.el6.x86_64/usr/share/doc/libvirt-docs-1.1.4/html/32favicon.png: cpio: Bad magic RPM build errors: File listed twice: /usr/share/doc/libvirt-docs-1.1.4 create archive failed on file /builddir/build/BUILDROOT/libvirt-1.1.4-1.el6.x86_64/usr/share/doc/libvirt-docs-1.1.4/html/32favicon.png: cpio: Bad magic
Hi, I'm wondering what, if anything, is happening with this patch. At the moment libvirt.spec does not work on RHEL 6. There does not appear to be any way to stop rpmbuild from wiping the docdir if a %doc directive with relative paths exists. (Upstream did correct this behaviour -- see http://www.rpm.org/ticket/836 -- but that's in a newer version of RPM than that provided on RHEL 6.) Regards, Michael

On Tue, Nov 19, 2013 at 01:03:05PM +1100, Michael Chapman wrote:
On Wed, 13 Nov 2013, Michael Chapman wrote:
error: create archive failed on file /builddir/build/BUILDROOT/libvirt-1.1.4-1.el6.x86_64/usr/share/doc/libvirt-docs-1.1.4/html/32favicon.png: cpio: Bad magic RPM build errors: File listed twice: /usr/share/doc/libvirt-docs-1.1.4 create archive failed on file /builddir/build/BUILDROOT/libvirt-1.1.4-1.el6.x86_64/usr/share/doc/libvirt-docs-1.1.4/html/32favicon.png: cpio: Bad magic
Hi,
I'm wondering what, if anything, is happening with this patch.
At the moment libvirt.spec does not work on RHEL 6. There does not appear to be any way to stop rpmbuild from wiping the docdir if a %doc directive with relative paths exists. (Upstream did correct this behaviour -- see http://www.rpm.org/ticket/836 -- but that's in a newer version of RPM than that provided on RHEL 6.)
Oh, I confirmed that the build was broken for me without this patch. I'm still not 100% understanding why the change we did broke it, but your patch does fix it at least. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On Wed, Nov 13, 2013 at 12:02:08PM +1100, Michael Chapman wrote:
RHEL's rpmbuild wipes the docdir for a (sub-)package if any %doc directives are present, prior to copying in the marked documentation. This means we can't prepopulate this directory with the HTML documentation during the %install phase.
Instead, move the HTML documentation to a temporary directory during %install and mark the contents of this temporary directory with %doc.
Signed-off-by: Michael Chapman <mike@very.puzzling.org> --- libvirt.spec.in | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
Ok, I've pushed this changed. Thanks for the problem diagnosis & patch. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
participants (2)
-
Daniel P. Berrange
-
Michael Chapman