[libvirt] [PATCH] spec: Do not install *.py[co] in python examples

Unfortunately, rpm is stupid enough to bytycompile python scripts even though they are located in /usr/share/doc/libvirt-python-*/examples and it does so after %install phase is finished. Thus there's no way we could remove those files from BUILDROOT. As a workaround, we may safely remove the examples subdirectory completely without losing anything. The python scripts that were installed there are also copied directly into /usr/share/doc/libvirt-python-*/ by %doc python/tests/*.py rule. And yes, the files are actually tests, not examples. --- libvirt.spec.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libvirt.spec.in b/libvirt.spec.in index 7457a48..13cc8a2 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1392,6 +1392,8 @@ rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_lxc.aug %if ! %{with_python} rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/libvirt-python-%{version} +%else +rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/libvirt-python-%{version}/examples %endif %if ! %{with_qemu} -- 1.8.0.2

On Mon, Dec 17, 2012 at 08:23:11PM +0100, Jiri Denemark wrote:
Unfortunately, rpm is stupid enough to bytycompile python scripts even though they are located in /usr/share/doc/libvirt-python-*/examples and it does so after %install phase is finished. Thus there's no way we could remove those files from BUILDROOT. As a workaround, we may safely remove the examples subdirectory completely without losing anything. The python scripts that were installed there are also copied directly into /usr/share/doc/libvirt-python-*/ by
%doc python/tests/*.py
rule. And yes, the files are actually tests, not examples. --- libvirt.spec.in | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/libvirt.spec.in b/libvirt.spec.in index 7457a48..13cc8a2 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1392,6 +1392,8 @@ rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_lxc.aug
%if ! %{with_python} rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/libvirt-python-%{version} +%else +rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/libvirt-python-%{version}/examples %endif
%if ! %{with_qemu}
It is a shame to loose the examples here, but I don't see an nicer alternative ACK 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 Tue, Dec 18, 2012 at 16:27:27 +0000, Daniel P. Berrange wrote:
On Mon, Dec 17, 2012 at 08:23:11PM +0100, Jiri Denemark wrote:
Unfortunately, rpm is stupid enough to bytycompile python scripts even though they are located in /usr/share/doc/libvirt-python-*/examples and it does so after %install phase is finished. Thus there's no way we could remove those files from BUILDROOT. As a workaround, we may safely remove the examples subdirectory completely without losing anything. The python scripts that were installed there are also copied directly into /usr/share/doc/libvirt-python-*/ by
%doc python/tests/*.py
rule. And yes, the files are actually tests, not examples. --- libvirt.spec.in | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/libvirt.spec.in b/libvirt.spec.in index 7457a48..13cc8a2 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1392,6 +1392,8 @@ rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_lxc.aug
%if ! %{with_python} rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/libvirt-python-%{version} +%else +rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/libvirt-python-%{version}/examples %endif
%if ! %{with_qemu}
It is a shame to loose the examples here, but I don't see an nicer alternative
As I explained (or tried to) in the commit message, we don't lose them. The files in examples directory actually come from src/python/tests and all python scripts from there are already installed directly in /usr/share/doc/libvirt-python-*/. In other words, the python scripts in examples were installed twice.
ACK
Thanks, I pushed the patch. Jirka
participants (2)
-
Daniel P. Berrange
-
Jiri Denemark