[libvirt] [PATCH libvirt-python 00/14] Split the python binding out

Doug Goldstein cardoe at gentoo.org
Wed Nov 13 23:21:21 UTC 2013


On Tue, Nov 12, 2013 at 12:21 PM, Daniel P. Berrange
<berrange at redhat.com> wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
>
> This patch series is a followup to
>
> https://www.redhat.com/archives/libvir-list/2013-September/msg00413.html
>
> 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.
>
> All the GPG signatures from tags are removed, since they are invalid
> after rewriting history. This was previously agreed to be the right
> way to handle this.
>
> 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-v6.git/
>
> (May take upto 1 hour to appear from the time I sent this message)
>
> Notice how the history is intact right back to the first commit of the
> python bindings.
>
> Daniel P. Berrange (14):
>   Remove obsolete Makefile.am
>   Update generator for new code layout
>   Update header file includes
>   Import STREQ macro from libvirt
>   Add decl of MIN macro
>   Import gnulib's xalloc_oversized macro
>   Import gnulib's ignore_value macro
>   Import code annotation macros from libvirt
>   Import VIR_ALLOC / VIR_ALLOC_N / VIR_REALLOC_N functions
>   Remove use of virStrcpyStatic
>   Import VIR_FORCE_CLOSE macro from libvirt
>   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             |  27 +++
>  Makefile.am             | 173 -----------------
>  NEWS                    |   9 +
>  autobuild.sh            |  25 +++
>  generator.py            |  69 +++----
>  libvirt-lxc-override.c  |   9 +-
>  libvirt-override.c      | 122 ++++++------
>  libvirt-python.spec.in  |  34 ++++
>  libvirt-qemu-override.c |   8 +-
>  libvirt-utils.c         | 136 +++++++++++++
>  libvirt-utils.h         | 193 +++++++++++++++++++
>  sanitytest.py           |   4 +
>  setup.py                | 262 +++++++++++++++++++++++++
>  typewrappers.c          |   5 +-
>  18 files changed, 1638 insertions(+), 295 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
>  create mode 100644 libvirt-utils.c
>  create mode 100644 libvirt-utils.h
>  mode change 100644 => 100755 sanitytest.py
>  create mode 100644 setup.py
>

So while I personally don't have a use case for this, it seemed
interesting enough to be able to learn a few of the elements behind
what makes all this go. So I've taken this patch set and working from
to get it building against libvirt 0.10.2 (specifically on Fedora 18).
If there's interest in getting this working with an even older version
let me know. I'll push my series to
http://github.com/cardoe/libvirt-python but I plan on getting it
building first and then rebasing to get it clean and then I'll post
the patches to the ML.

-- 
Doug Goldstein




More information about the libvir-list mailing list