libvirt-python spec file and Makefile
authorMohamed Larabi <mohamed.larabi@inria.fr>
Fri, 7 Feb 2014 10:47:22 +0000 (11:47 +0100)
committerMohamed Larabi <mohamed.larabi@inria.fr>
Fri, 7 Feb 2014 10:47:22 +0000 (11:47 +0100)
Makefile
libvirt-python.spec [new file with mode: 0644]

index d062989..e59159b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,11 @@
 WEBFETCH                := wget
 SHA1SUM                 := sha1sum
 
-# tried to download this on the fly using git archive at git://libvirt.org/libvirt.git
-# but it feels like git archive is not supported/allowed there
-ALL                     += libvirt
-libvirt-URL1           := http://mirror.onelab.eu/third-party/libvirt-1.0.4.tar.gz
-libvirt-URL2           := http://planet-lab.org/third-party/libvirt-1.0.4.tar.gz
-libvirt-SHA1SUM        := 45e74a9a4c3a88c98ac4ae5d8200ea65c42b6951
-libvirt                := $(notdir $(libvirt-URL1))
+ALL                     += libvirt-python
+libvirt-python-URL1    := http://mirror.onelab.eu/third-party/libvirt-python-1.2.1.tar.gz
+libvirt-python-URL2    := http://planet-lab.org/third-party/libvirt-python-1.2.1.tar.gz
+libvirt-python-SHA1SUM        := 874014e3b1b199919d40a34f12829fa1d610a2ea
+libvirt-python                := $(notdir $(libvirt-python-URL1))
 
 all: $(ALL)
 .PHONY: all
@@ -17,38 +15,33 @@ define download_target
 $(1): $($(1))
 .PHONY: $(1)
 $($(1)): 
-       @if [ ! -e "$($(1))" ] ; then \
-       { echo Using primary; echo "$(WEBFETCH) $($(1)-URL1)" ; $(WEBFETCH) $($(1)-URL1) ; } || \
-       { echo Using secondary; echo "$(WEBFETCH) $($(1)-URL2)" ; $(WEBFETCH) $($(1)-URL2) ; } ; fi
-       @if [ ! -e "$($(1))" ] ; then echo "Could not download source file: $($(1)) does not exist" ; exit 1 ; fi
-       @if test "$$$$($(SHA1SUM) $($(1)) | awk '{print $$$$1}')" != "$($(1)-SHA1SUM)" ; then \
-           echo "sha1sum of the downloaded $($(1)) does not match the one from 'Makefile'" ; \
-           echo "Local copy: $$$$($(SHA1SUM) $($(1)))" ; \
-           echo "In Makefile: $($(1)-SHA1SUM)" ; \
-           false ; \
-       else \
-           ls -l $($(1)) ; \
-       fi
+        @if [ ! -e "$($(1))" ] ; then \
+        { echo Using primary; echo "$(WEBFETCH) $($(1)-URL1)" ; $(WEBFETCH) $($(1)-URL1) ; } || \
+        { echo Using secondary; echo "$(WEBFETCH) $($(1)-URL2)" ; $(WEBFETCH) $($(1)-URL2) ; } ; fi
+        @if [ ! -e "$($(1))" ] ; then echo "Could not download source file: $($(1)) does not exist" ; exit 1 ; fi
+        @if test "$$$$($(SHA1SUM) $($(1)) | awk '{print $$$$1}')" != "$($(1)-SHA1SUM)" ; then \
+            echo "sha1sum of the downloaded $($(1)) does not match the one from 'Makefile'" ; \
+            echo "Local copy: $$$$($(SHA1SUM) $($(1)))" ; \
+            echo "In Makefile: $($(1)-SHA1SUM)" ; \
+            false ; \
+        else \
+            ls -l $($(1)) ; \
+        fi
 endef
 
-$(eval $(call download_target,libvirt))
+$(eval $(call download_target,libvirt-python))
 
 sources: $(ALL) 
 .PHONY: sources
 
 ####################
 # default - overridden by the build
-SPECFILE = libvirt.spec
+SPECFILE = libvirt-python.spec
 
 PWD=$(shell pwd)
 PREPARCH ?= noarch
 RPMDIRDEFS = --define "_sourcedir $(PWD)" --define "_builddir $(PWD)" --define "_srcrpmdir $(PWD)" --define "_rpmdir $(PWD)"
-BUILDOPTS = --without xen --without qemu --without hyperv --without phyp --without esx \
-                       --without netcf --without avahi --without polkit --without sasl --without audit \
-                       --without storage-iscsi --without storage-scsi --without storage-disk \
-                       --without storage-rbd --without selinux --without dtrace --without sanlock \
-                       --without libxl --with capng --with udev --with interface \
-                       --define 'packager PlanetLab'
+BUILDOPTS = --with python3 --define 'packager PlanetLab'
 
 trees: sources
        rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps -bp --target $(PREPARCH) $(SPECFILE)
diff --git a/libvirt-python.spec b/libvirt-python.spec
new file mode 100644 (file)
index 0000000..b8bbfd3
--- /dev/null
@@ -0,0 +1,88 @@
+# -*- rpm-spec -*-
+
+%define mainstream_version 1.2.1
+%define module_version_varname mainstream_version
+%define taglevel 0
+
+# Disable python 3 bindings
+%define with_python3 0
+
+Summary: The libvirt virtualization API python2 binding
+Name: libvirt-python
+Version: %{mainstream_version}
+Release: %{taglevel}
+Source0: http://libvirt.org/sources/python/%{name}-%{version}.tar.gz
+Url: http://libvirt.org
+License: LGPLv2+
+Group: Development/Libraries
+BuildRequires: libvirt-devel = %{version}-%{release}
+BuildRequires: python-devel
+%if %{with_python3}
+BuildRequires: python3-devel
+%endif
+
+%if %{with_python3}
+%package -n libvirt-python3
+Summary: The libvirt virtualization API python3 binding
+Url: http://libvirt.org
+License: LGPLv2+
+Group: Development/Libraries
+%endif
+
+# Don't want provides for python shared objects
+%{?filter_provides_in: %filter_provides_in %{python_sitearch}/.*\.so}
+%{?filter_setup}
+
+%description
+The libvirt-python package contains a module that permits applications
+written in the Python programming language to use the interface
+supplied by the libvirt library to use the virtualization capabilities
+of recent versions of Linux (and other OSes).
+
+%if %{with_python3}
+%description -n libvirt-python3
+The libvirt-python package contains a module that permits applications
+written in the Python programming language to use the interface
+supplied by the libvirt library to use the virtualization capabilities
+of recent versions of Linux (and other OSes).
+%endif
+
+%prep
+%setup -q
+
+%build
+CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
+%if %{with_python3}
+CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
+%endif
+
+%install
+%{__python} setup.py install --skip-build --root=%{buildroot}
+%if %{with_python3}
+%{__python3} setup.py install --skip-build --root=%{buildroot}
+%endif
+rm -f %{buildroot}%{_libdir}/python*/site-packages/*egg-info
+
+%files
+%defattr(-,root,root)
+%doc ChangeLog AUTHORS NEWS README COPYING COPYING.LESSER examples/
+%{_libdir}/python2*/site-packages/libvirt.py*
+%{_libdir}/python2*/site-packages/libvirt_qemu.py*
+%{_libdir}/python2*/site-packages/libvirt_lxc.py*
+%{_libdir}/python2*/site-packages/libvirtmod*
+
+%if %{with_python3}
+%files -n libvirt-python3
+%defattr(-,root,root)
+%doc ChangeLog AUTHORS NEWS README COPYING COPYING.LESSER examples/
+%{_libdir}/python3*/site-packages/libvirt.py*
+%{_libdir}/python3*/site-packages/libvirt_qemu.py*
+%{_libdir}/python3*/site-packages/libvirt_lxc.py*
+%{_libdir}/python3*/site-packages/__pycache__/libvirt.cpython-*.py*
+%{_libdir}/python3*/site-packages/__pycache__/libvirt_qemu.cpython-*.py*
+%{_libdir}/python3*/site-packages/__pycache__/libvirt_lxc.cpython-*.py*
+%{_libdir}/python3*/site-packages/libvirtmod*
+%endif
+
+%changelog
+