[libvirt] [PATCH libvirt-python 00/17] RFC: Split the python binding out

Daniel P. Berrange berrange at redhat.com
Mon Sep 9 16:01:31 UTC 2013


From: "Daniel P. Berrange" <berrange at redhat.com>

This patch series demonstrates the minimum possible changes required
to split the python binding out into a separate GIT repository.

These patches do not apply to current GIT. Instead you have to first
create a new git repo, initializing based on the history of the
python/ subdirectory.

Assuming your current checkout of libvirt is in a directory 'libvirt',
then

  $ git clone libvirt libvirt-python
  $ cd libvirt-python
  $ git filter-branch --subdirectory-filter python --tag-name-filter cat -- --all 
  $ git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d
  $ git reflog expire --expire=now --all
  $ git gc --prune=now

You should now have a repo that's a couple of MB in size, showing only the
files from python/ dir, in the root.

The tags have been re-written to show content from the python/ directory.

One problem I've not yet solved is tag signatures. Many of the original
vN.N.N tags are signed by Daniel Veillard, and the CVE-XXXXXXX ones
signed by Eric Blake.

Obviously when re-writing the tags those signatures are now invalid.
I can't find a way to get 'git filter-branch' to prompt me to sign the
new tags it is creating, and AFAIK, you can't sign an existing tag without
deleting and re-creating it ?


Anyway, with the repo as above, you can now apply the 17 patches from
this series onto that 

The build system uses python distutils instead of autoconf/automake.
It still uses the code generator as before though, pulling the XML
files from /usr/share/libvirt/api (or whever you installed libvirt,
as indicated by pkg-config)

I created a simple autobuild.sh to do an end-to-end build, including
the RPM generation. Or you can just do


   python setup.py build   ('make' equiv)
   python setup.py test    ('make check' equiv)
   python setup.py rpm     ('make rpm' equiv)
   python setup.py clean   ('make clean' equiv)

Historically libvirt python only worked with the exact matching libvirt
binary. Before releasing this, I think we need to make it possible to
compile libvirt-python against any recent-ish libvirt version.

This shouldn't actually be too hard - the generator will take care of
most of it. All we need do is fix up the -override.c files to make
use of version checks to hide APIs not present in older libvirt.

The RPM is designed to be drop in compatible/identical to/with the
existing libvirt-python RPM, so users should notice no difference
in any way when upgrading.

If you don't want to try the filter-branch steps yourself, you can
clone this complete series + repo from

  http://fedorapeople.org/cgit/berrange/public_git/libvirt-python-split.git/

Notice how the history is intact right back to the first commit of the
python bindings.

Daniel P. Berrange (17):
  Update generator for new code layout
  Remove <config.h> from source files
  Remove obsolete Makefile.am
  Remote compiler annotation attributes
  Fix potential use of uninitialized value in virDomainGetVcpuPinInfo
  Remove use of VIR_FREE from code
  Remove use of VIR_ALLOC_N
  Import STREQ macro from libvirt
  Add decl of MIN macro
  Update header file includes
  Import gnulib's xalloc_oversized macro
  Import gnulib's ignore_value macro
  Remove use of virStrcpyStatic
  Remove use of VIR_FORCE_CLOSE
  Add build/ to python module path for sanitytest.py
  Add execute permission for sanitytest.py
  Setup distutils buld system

 .gitignore              |   4 +
 AUTHORS.in              |  12 +
 COPYING                 | 339 ++++++++++++++++++++++++
 COPYING.LESSER          | 502 ++++++++++++++++++++++++++++++++++++
 MANIFEST.in             |  25 ++
 Makefile.am             | 172 -------------
 NEWS                    |   9 +
 autobuild.sh            |  25 ++
 generator.py            |  69 ++---
 libvirt-lxc-override.c  |  14 +-
 libvirt-override.c      | 664 +++++++++++++++++++++++++-----------------------
 libvirt-python.spec.in  |  34 +++
 libvirt-qemu-override.c |  11 +-
 sanitytest.py           |   4 +
 setup.py                | 294 +++++++++++++++++++++
 typewrappers.c          |   8 +-
 16 files changed, 1629 insertions(+), 557 deletions(-)
 create mode 100644 .gitignore
 create mode 100644 AUTHORS.in
 create mode 100644 COPYING
 create mode 100644 COPYING.LESSER
 create mode 100644 MANIFEST.in
 delete mode 100644 Makefile.am
 create mode 100644 NEWS
 create mode 100755 autobuild.sh
 create mode 100644 libvirt-python.spec.in
 mode change 100644 => 100755 sanitytest.py
 create mode 100644 setup.py

-- 
1.8.3.1




More information about the libvir-list mailing list