[Pkg-libvirt-commits] [SCM] Libguestfs Debian packaging branch, master, updated. debian/1.14.2-1

Hilko Bengen bengen at debian.org
Fri Nov 11 07:30:33 UTC 2011


The following commit has been merged in the master branch:
commit fbfe97e1d38bbf6eff8ada8d4f1d455bb8be889f
Author: Hilko Bengen <bengen at debian.org>
Date:   Thu Nov 3 09:17:37 2011 +0100

    Added upstream's patches for Python 3.x support

diff --git a/debian/patches/0011-python-Correctly-check-for-Python-major-minor.patch b/debian/patches/0011-python-Correctly-check-for-Python-major-minor.patch
new file mode 100644
index 0000000..152888c
--- /dev/null
+++ b/debian/patches/0011-python-Correctly-check-for-Python-major-minor.patch
@@ -0,0 +1,29 @@
+From: "Richard W.M. Jones" <rjones at redhat.com>
+Date: Wed, 2 Nov 2011 18:18:14 +0000
+Subject: python: Correctly check for Python major/minor.
+
+The manual for sys.version warns that you should not parse the string,
+which we were doing.  It would have failed on python "2.10" or
+similar.
+
+Do it correctly using the sys.version_info struct instead.
+---
+ configure.ac |    4 +++-
+ 1 files changed, 3 insertions(+), 1 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 1918701..d5125e5 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -714,7 +714,9 @@ AS_IF([test "x$enable_python" != "xno"],
+ 	    AC_MSG_RESULT([$PYTHON_PREFIX])
+ 
+ 	    AC_MSG_CHECKING([Python version])
+-            PYTHON_VERSION=`$PYTHON -c "import sys; print (sys.version[[0:3]])"`
++            PYTHON_VERSION_MAJOR=`$PYTHON -c "import sys; print (sys.version_info.major)"`
++            PYTHON_VERSION_MINOR=`$PYTHON -c "import sys; print (sys.version_info.minor)"`
++            PYTHON_VERSION="$PYTHON_VERSION_MAJOR.$PYTHON_VERSION_MINOR"
+ 	    AC_MSG_RESULT([$PYTHON_VERSION])
+ 
+             AC_MSG_CHECKING([for Python include path])
+-- 
diff --git a/debian/patches/0012-python-Include-config.h.patch b/debian/patches/0012-python-Include-config.h.patch
new file mode 100644
index 0000000..abea81e
--- /dev/null
+++ b/debian/patches/0012-python-Include-config.h.patch
@@ -0,0 +1,23 @@
+From: "Richard W.M. Jones" <rjones at redhat.com>
+Date: Wed, 2 Nov 2011 18:19:15 +0000
+Subject: python: Include <config.h>.
+
+Ooops ...
+---
+ generator/generator_python.ml |    2 ++
+ 1 files changed, 2 insertions(+), 0 deletions(-)
+
+diff --git a/generator/generator_python.ml b/generator/generator_python.ml
+index c8448aa..10a4eca 100644
+--- a/generator/generator_python.ml
++++ b/generator/generator_python.ml
+@@ -35,6 +35,8 @@ let rec generate_python_c () =
+   generate_header CStyle LGPLv2plus;
+ 
+   pr "\
++#include <config.h>
++
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <assert.h>
+-- 
diff --git a/debian/patches/0013-python-Pass-PYTHON-environment-variable-to-tests.patch b/debian/patches/0013-python-Pass-PYTHON-environment-variable-to-tests.patch
new file mode 100644
index 0000000..952b9f6
--- /dev/null
+++ b/debian/patches/0013-python-Pass-PYTHON-environment-variable-to-tests.patch
@@ -0,0 +1,75 @@
+From: "Richard W.M. Jones" <rjones at redhat.com>
+Date: Wed, 2 Nov 2011 19:42:29 +0000
+Subject: python: Pass $PYTHON environment variable to tests.
+
+If the user set PYTHON when configuring, this variable is not passed
+through to the tests, so it is possible the tests will fail because
+they are testing the wrong version of python.  By passing $PYTHON
+through to the tests we ensure that we test against the same version
+of python that we configured with.
+---
+ python/Makefile.am      |    5 +++--
+ python/run-bindtests    |    4 ++--
+ python/run-python-tests |    4 ++--
+ 3 files changed, 7 insertions(+), 6 deletions(-)
+
+diff --git a/python/Makefile.am b/python/Makefile.am
+index 97fae83..f26ee71 100644
+--- a/python/Makefile.am
++++ b/python/Makefile.am
+@@ -1,5 +1,5 @@
+ # libguestfs Python bindings
+-# Copyright (C) 2009 Red Hat Inc.
++# Copyright (C) 2009-2011 Red Hat Inc.
+ #
+ # This program is free software; you can redistribute it and/or modify
+ # it under the terms of the GNU General Public License as published by
+@@ -48,7 +48,8 @@ libguestfsmod_la_LDFLAGS = -avoid-version -shared
+ TESTS_ENVIRONMENT = \
+ 	LIBGUESTFS_PATH=$(top_builddir)/appliance \
+ 	PYTHONPATH=$(builddir):$(builddir)/.libs \
+-	TMPDIR=$(top_builddir)
++	TMPDIR=$(top_builddir) \
++	PYTHON=$(PYTHON)
+ 
+ TESTS = run-bindtests
+ 
+diff --git a/python/run-bindtests b/python/run-bindtests
+index 08a24e6..cf28bb6 100755
+--- a/python/run-bindtests
++++ b/python/run-bindtests
+@@ -1,6 +1,6 @@
+ #!/bin/sh -
+ # libguestfs Perl bindings
+-# Copyright (C) 2009 Red Hat Inc.
++# Copyright (C) 2009-2011 Red Hat Inc.
+ #
+ # This program is free software; you can redistribute it and/or modify
+ # it under the terms of the GNU General Public License as published by
+@@ -18,5 +18,5 @@
+ 
+ set -e
+ 
+-python ${srcdir}/bindtests.py > bindtests.tmp
++$PYTHON ${srcdir}/bindtests.py > bindtests.tmp
+ diff -u ${srcdir}/../bindtests bindtests.tmp
+diff --git a/python/run-python-tests b/python/run-python-tests
+index 487f8ab..f82dc10 100755
+--- a/python/run-python-tests
++++ b/python/run-python-tests
+@@ -1,6 +1,6 @@
+ #!/bin/sh -
+ # libguestfs Perl bindings
+-# Copyright (C) 2009 Red Hat Inc.
++# Copyright (C) 2009-2011 Red Hat Inc.
+ #
+ # This program is free software; you can redistribute it and/or modify
+ # it under the terms of the GNU General Public License as published by
+@@ -19,5 +19,5 @@
+ set -e
+ 
+ for f in t/*.py; do
+-  python $f
++  $PYTHON $f
+ done
+-- 
diff --git a/debian/patches/0014-python-Fixes-for-Python-3-RHBZ-750889.patch b/debian/patches/0014-python-Fixes-for-Python-3-RHBZ-750889.patch
new file mode 100644
index 0000000..fdfaf87
--- /dev/null
+++ b/debian/patches/0014-python-Fixes-for-Python-3-RHBZ-750889.patch
@@ -0,0 +1,342 @@
+From: "Richard W.M. Jones" <rjones at redhat.com>
+Date: Wed, 2 Nov 2011 19:43:53 +0000
+Subject: python: Fixes for Python 3 (RHBZ#750889).
+
+These fixes allow libguestfs bindings to work with Python 3 (tested
+with Python 3.2)
+
+You can select which Python you compile against by doing:
+
+  PYTHON=python ./configure && make && make check
+
+or:
+
+  PYTHON=python3 ./configure && make && make check
+---
+ .gitignore                       |    1 +
+ configure.ac                     |   14 ++++-
+ generator/generator_bindtests.ml |    2 +-
+ generator/generator_python.ml    |  128 ++++++++++++++++++++++++++++++++------
+ python/guestfs-py-byhand.c       |    2 +-
+ 5 files changed, 123 insertions(+), 24 deletions(-)
+
+diff --git a/.gitignore b/.gitignore
+index 8980fd0..fc70e76 100644
+--- a/.gitignore
++++ b/.gitignore
+@@ -295,6 +295,7 @@ po-docs/*/*.pod
+ po-docs/*/*.1
+ po-docs/*/*.3
+ podwrapper.sh
++python/__pycache__
+ python/bindtests.py
+ python/examples/guestfs-python.3
+ python/examples/stamp-guestfs-python.pod
+diff --git a/configure.ac b/configure.ac
+index d5125e5..1319d32 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -744,9 +744,19 @@ AS_IF([test "x$enable_python" != "xno"],
+                 AC_MSG_RESULT([$PYTHON_INSTALLDIR])
+             fi
+ 
++            dnl Look for libpython and some optional symbols in it.
+             old_LIBS="$LIBS"
+-            LIBS="$LIBS -lpython$PYTHON_VERSION"
+-            AC_CHECK_FUNCS([PyCapsule_New])
++            if test "x$PYTHON_VERSION_MAJOR" = "x3"; then
++                dnl libpython3 is called "libpython3.Xmu.so"
++                LIBPYTHON="python${PYTHON_VERSION}mu"
++            else
++                LIBPYTHON="python$PYTHON_VERSION"
++            fi
++            AC_CHECK_LIB([$LIBPYTHON], [PyList_Size], [],
++                         [AC_MSG_FAILURE([$LIBPYTHON is not installed])])
++
++            AC_CHECK_FUNCS([PyCapsule_New \
++                            PyString_AsString])
+             LIBS="$old_LIBS"
+         fi
+ 
+diff --git a/generator/generator_bindtests.ml b/generator/generator_bindtests.ml
+index 859f189..4d4795a 100644
+--- a/generator/generator_bindtests.ml
++++ b/generator/generator_bindtests.ml
+@@ -301,7 +301,7 @@ g = guestfs.GuestFS ()
+     fun f args -> pr "g.%s (%s)\n" f (mkargs args)
+   );
+ 
+-  pr "print \"EOF\"\n"
++  pr "print (\"EOF\")\n"
+ 
+ and generate_ruby_bindtests () =
+   generate_header HashStyle GPLv2plus;
+diff --git a/generator/generator_python.ml b/generator/generator_python.ml
+index 10a4eca..6d22c18 100644
+--- a/generator/generator_python.ml
++++ b/generator/generator_python.ml
+@@ -49,6 +49,9 @@ get_string_list (PyObject *obj)
+ {
+   size_t i, len;
+   char **r;
++#ifndef HAVE_PYSTRING_ASSTRING
++  PyObject *bytes;
++#endif
+ 
+   assert (obj);
+ 
+@@ -69,8 +72,14 @@ get_string_list (PyObject *obj)
+     return NULL;
+   }
+ 
+-  for (i = 0; i < len; ++i)
++  for (i = 0; i < len; ++i) {
++#ifdef HAVE_PYSTRING_ASSTRING
+     r[i] = PyString_AsString (PyList_GetItem (obj, i));
++#else
++    bytes = PyUnicode_AsUTF8String (PyList_GetItem (obj, i));
++    r[i] = PyBytes_AS_STRING (bytes);
++#endif
++  }
+   r[len] = NULL;
+ 
+   return r;
+@@ -86,8 +95,13 @@ put_string_list (char * const * const argv)
+     ;
+ 
+   list = PyList_New (argc);
+-  for (i = 0; i < argc; ++i)
++  for (i = 0; i < argc; ++i) {
++#ifdef HAVE_PYSTRING_ASSTRING
+     PyList_SetItem (list, i, PyString_FromString (argv[i]));
++#else
++    PyList_SetItem (list, i, PyUnicode_FromString (argv[i]));
++#endif
++  }
+ 
+   return list;
+ }
+@@ -104,8 +118,13 @@ put_table (char * const * const argv)
+   list = PyList_New (argc >> 1);
+   for (i = 0; i < argc; i += 2) {
+     item = PyTuple_New (2);
++#ifdef HAVE_PYSTRING_ASSTRING
+     PyTuple_SetItem (item, 0, PyString_FromString (argv[i]));
+     PyTuple_SetItem (item, 1, PyString_FromString (argv[i+1]));
++#else
++    PyTuple_SetItem (item, 0, PyUnicode_FromString (argv[i]));
++    PyTuple_SetItem (item, 1, PyUnicode_FromString (argv[i+1]));
++#endif
+     PyList_SetItem (list, i >> 1, item);
+   }
+ 
+@@ -152,16 +171,31 @@ free_strings (char **argv)
+         function
+         | name, FString ->
+             pr "  PyDict_SetItemString (dict, \"%s\",\n" name;
++            pr "#ifdef HAVE_PYSTRING_ASSTRING\n";
+             pr "                        PyString_FromString (%s->%s));\n"
+-              typ name
++              typ name;
++            pr "#else\n";
++            pr "                        PyUnicode_FromString (%s->%s));\n"
++              typ name;
++            pr "#endif\n"
+         | name, FBuffer ->
+             pr "  PyDict_SetItemString (dict, \"%s\",\n" name;
++            pr "#ifdef HAVE_PYSTRING_ASSTRING\n";
+             pr "                        PyString_FromStringAndSize (%s->%s, %s->%s_len));\n"
+-              typ name typ name
++              typ name typ name;
++            pr "#else\n";
++            pr "                        PyBytes_FromStringAndSize (%s->%s, %s->%s_len));\n"
++              typ name typ name;
++            pr "#endif\n"
+         | name, FUUID ->
+             pr "  PyDict_SetItemString (dict, \"%s\",\n" name;
++            pr "#ifdef HAVE_PYSTRING_ASSTRING\n";
+             pr "                        PyString_FromStringAndSize (%s->%s, 32));\n"
+-              typ name
++              typ name;
++            pr "#else\n";
++            pr "                        PyBytes_FromStringAndSize (%s->%s, 32));\n"
++              typ name;
++            pr "#endif\n"
+         | name, (FBytes|FUInt64) ->
+             pr "  PyDict_SetItemString (dict, \"%s\",\n" name;
+             pr "                        PyLong_FromUnsignedLongLong (%s->%s));\n"
+@@ -188,8 +222,13 @@ free_strings (char **argv)
+             pr "    PyDict_SetItemString (dict, \"%s\", Py_None);\n" name;
+             pr "  }\n"
+         | name, FChar ->
++            pr "#ifdef HAVE_PYSTRING_ASSTRING\n";
+             pr "  PyDict_SetItemString (dict, \"%s\",\n" name;
+-            pr "                        PyString_FromStringAndSize (&dirent->%s, 1));\n" name
++            pr "                        PyString_FromStringAndSize (&dirent->%s, 1));\n" name;
++            pr "#else\n";
++            pr "  PyDict_SetItemString (dict, \"%s\",\n" name;
++            pr "                        PyUnicode_FromStringAndSize (&dirent->%s, 1));\n" name;
++            pr "#endif\n"
+       ) cols;
+       pr "  return dict;\n";
+       pr "};\n";
+@@ -419,18 +458,31 @@ free_strings (char **argv)
+            pr "  Py_INCREF (Py_None);\n";
+            pr "  py_r = Py_None;\n"
+        | RInt _
+-       | RBool _ -> pr "  py_r = PyInt_FromLong ((long) r);\n"
++       | RBool _ -> pr "  py_r = PyLong_FromLong ((long) r);\n"
+        | RInt64 _ -> pr "  py_r = PyLong_FromLongLong (r);\n"
+-       | RConstString _ -> pr "  py_r = PyString_FromString (r);\n"
++       | RConstString _ ->
++           pr "#ifdef HAVE_PYSTRING_ASSTRING\n";
++           pr "  py_r = PyString_FromString (r);\n";
++           pr "#else\n";
++           pr "  py_r = PyUnicode_FromString (r);\n";
++           pr "#endif\n"
+        | RConstOptString _ ->
+-           pr "  if (r)\n";
++           pr "  if (r) {\n";
++           pr "#ifdef HAVE_PYSTRING_ASSTRING\n";
+            pr "    py_r = PyString_FromString (r);\n";
+-           pr "  else {\n";
++           pr "#else\n";
++           pr "    py_r = PyUnicode_FromString (r);\n";
++           pr "#endif\n";
++           pr "  } else {\n";
+            pr "    Py_INCREF (Py_None);\n";
+            pr "    py_r = Py_None;\n";
+            pr "  }\n"
+        | RString _ ->
++           pr "#ifdef HAVE_PYSTRING_ASSTRING\n";
+            pr "  py_r = PyString_FromString (r);\n";
++           pr "#else\n";
++           pr "  py_r = PyUnicode_FromString (r);\n";
++           pr "#endif\n";
+            pr "  free (r);\n"
+        | RStringList _ ->
+            pr "  py_r = put_string_list (r);\n";
+@@ -445,7 +497,11 @@ free_strings (char **argv)
+            pr "  py_r = put_table (r);\n";
+            pr "  free_strings (r);\n"
+        | RBufferOut _ ->
++           pr "#ifdef HAVE_PYSTRING_ASSTRING\n";
+            pr "  py_r = PyString_FromStringAndSize (r, size);\n";
++           pr "#else\n";
++           pr "  py_r = PyBytes_FromStringAndSize (r, size);\n";
++           pr "#endif\n";
+            pr "  free (r);\n"
+       );
+ 
+@@ -473,15 +529,47 @@ free_strings (char **argv)
+ 
+   (* Init function. *)
+   pr "\
++#if PY_MAJOR_VERSION >= 3
++static struct PyModuleDef moduledef = {
++  PyModuleDef_HEAD_INIT,
++  \"libguestfsmod\",     /* m_name */
++  \"libguestfs module\",   /* m_doc */
++  -1,                    /* m_size */
++  methods,               /* m_methods */
++  NULL,                  /* m_reload */
++  NULL,                  /* m_traverse */
++  NULL,                  /* m_clear */
++  NULL,                  /* m_free */
++};
++#endif
++
++static PyObject *
++moduleinit (void)
++{
++  PyObject *m;
++
++#if PY_MAJOR_VERSION >= 3
++  m = PyModule_Create (&moduledef);
++#else
++  m = Py_InitModule ((char *) \"libguestfsmod\", methods);
++#endif
++
++  return m; /* m might be NULL if module init failed */
++}
++
++#if PY_MAJOR_VERSION >= 3
++PyMODINIT_FUNC
++PyInit_libguestfsmod (void)
++{
++  return moduleinit ();
++}
++#else
+ void
+ initlibguestfsmod (void)
+ {
+-  static int initialized = 0;
+-
+-  if (initialized) return;
+-  Py_InitModule ((char *) \"libguestfsmod\", methods);
+-  initialized = 1;
++  (void) moduleinit ();
+ }
++#endif
+ "
+ 
+ (* Generate Python module. *)
+@@ -489,7 +577,7 @@ and generate_python_py () =
+   generate_header HashStyle LGPLv2plus;
+ 
+   pr "\
+-u\"\"\"Python bindings for libguestfs
++\"\"\"Python bindings for libguestfs
+ 
+ import guestfs
+ g = guestfs.GuestFS ()
+@@ -566,7 +654,7 @@ class GuestFS:
+             raise ClosedHandle (\"GuestFS: method called on closed handle\")
+ 
+     def close (self):
+-        u\"\"\"Explicitly close the guestfs handle.
++        \"\"\"Explicitly close the guestfs handle.
+ 
+         The handle is closed implicitly when its reference count goes
+         to zero (eg. when it goes out of scope or the program ends).
+@@ -581,7 +669,7 @@ class GuestFS:
+         self._o = None
+ 
+     def set_event_callback (self, cb, event_bitmask):
+-        u\"\"\"Register an event callback.
++        \"\"\"Register an event callback.
+ 
+         Register \"cb\" as a callback function for all of the
+         events in \"event_bitmask\".  \"event_bitmask\" should be
+@@ -606,7 +694,7 @@ class GuestFS:
+         return libguestfsmod.set_event_callback (self._o, cb, event_bitmask)
+ 
+     def delete_event_callback (self, event_handle):
+-        u\"\"\"Delete an event callback.\"\"\"
++        \"\"\"Delete an event callback.\"\"\"
+         self._check_not_closed ()
+         libguestfsmod.delete_event_callback (self._o, event_handle)
+ 
+@@ -650,7 +738,7 @@ class GuestFS:
+         let doc = pod2text ~width:60 name doc in
+         let doc = List.map (fun line -> replace_str line "\\" "\\\\") doc in
+         let doc = String.concat "\n        " doc in
+-        pr "        u\"\"\"%s\"\"\"\n" doc;
++        pr "        \"\"\"%s\"\"\"\n" doc;
+       );
+       (* Callers might pass in iterables instead of plain lists;
+        * convert those to plain lists because the C side of things
+diff --git a/python/guestfs-py-byhand.c b/python/guestfs-py-byhand.c
+index 29be83b..1756963 100644
+--- a/python/guestfs-py-byhand.c
++++ b/python/guestfs-py-byhand.c
+@@ -168,7 +168,7 @@ py_guestfs_set_event_callback (PyObject *self, PyObject *args)
+   snprintf (key, sizeof key, "_python_event_%d", eh);
+   guestfs_set_private (g, key, py_callback);
+ 
+-  py_eh = PyInt_FromLong ((long) eh);
++  py_eh = PyLong_FromLong ((long) eh);
+   return py_eh;
+ }
+ 
+-- 
diff --git a/debian/patches/0015-python-Use-sys.version_info-0-instead-of-sys.version.patch b/debian/patches/0015-python-Use-sys.version_info-0-instead-of-sys.version.patch
new file mode 100644
index 0000000..5c55e23
--- /dev/null
+++ b/debian/patches/0015-python-Use-sys.version_info-0-instead-of-sys.version.patch
@@ -0,0 +1,30 @@
+From: "Richard W.M. Jones" <rjones at redhat.com>
+Date: Thu, 3 Nov 2011 09:48:45 +0000
+Subject: python: Use sys.version_info[0] instead of sys.version_info.major.
+
+The major/minor fields only exist in Python >= 2.7.  This works for at
+least Python 2.5 and 2.6.
+
+Thanks to Hilko Bengen.
+
+This updates commit 646142f5136da9cfe2b908703a822c53350f70e9.
+---
+ configure.ac |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 1319d32..ed1da69 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -714,8 +714,8 @@ AS_IF([test "x$enable_python" != "xno"],
+ 	    AC_MSG_RESULT([$PYTHON_PREFIX])
+ 
+ 	    AC_MSG_CHECKING([Python version])
+-            PYTHON_VERSION_MAJOR=`$PYTHON -c "import sys; print (sys.version_info.major)"`
+-            PYTHON_VERSION_MINOR=`$PYTHON -c "import sys; print (sys.version_info.minor)"`
++            PYTHON_VERSION_MAJOR=`$PYTHON -c "import sys; print (sys.version_info@<:@0@:>@)"`
++            PYTHON_VERSION_MINOR=`$PYTHON -c "import sys; print (sys.version_info@<:@1@:>@)"`
+             PYTHON_VERSION="$PYTHON_VERSION_MAJOR.$PYTHON_VERSION_MINOR"
+ 	    AC_MSG_RESULT([$PYTHON_VERSION])
+ 
+-- 
diff --git a/debian/patches/0011-autoreconf.patch b/debian/patches/0016-autoreconf.patch
similarity index 87%
rename from debian/patches/0011-autoreconf.patch
rename to debian/patches/0016-autoreconf.patch
index f0ca6be..5f959a4 100644
--- a/debian/patches/0011-autoreconf.patch
+++ b/debian/patches/0016-autoreconf.patch
@@ -3,23 +3,24 @@ Date: Sat, 20 Aug 2011 20:43:22 +0200
 Subject: autoreconf
 
 ---
- Makefile.in          |   47 ++++++++++++--------------
- aclocal.m4           |   14 ++++---
+ Makefile.in          |   47 +++++++--------
+ aclocal.m4           |   14 +++--
  cat/Makefile.in      |    2 +-
  clone/Makefile.in    |    2 +-
- configure            |   91 ++++++++++++++++++++++++++++----------------------
+ config.h.in          |    3 +
+ configure            |  166 ++++++++++++++++++++++++++++++++++++--------------
  daemon/Makefile.in   |    4 +-
  df/Makefile.in       |    2 +-
  edit/Makefile.in     |    2 +-
  fuse/Makefile.in     |    2 +-
  images/Makefile.in   |    2 +-
- ocaml/Makefile.in    |   19 +++++-----
- perl/Makefile.in     |    8 +++-
- python/Makefile.in   |    3 +-
- resize/Makefile.in   |    6 ++--
- sparsify/Makefile.in |    8 ++--
- tools/Makefile.in    |    6 ++--
- 16 files changed, 116 insertions(+), 102 deletions(-)
+ ocaml/Makefile.in    |   19 +++---
+ perl/Makefile.in     |    8 ++-
+ python/Makefile.in   |    8 ++-
+ resize/Makefile.in   |    6 +-
+ sparsify/Makefile.in |    8 +-
+ tools/Makefile.in    |    6 +-
+ 17 files changed, 190 insertions(+), 111 deletions(-)
 
 diff --git a/Makefile.in b/Makefile.in
 index 3a8c3f6..58d7d6d 100644
@@ -206,8 +207,22 @@ index feba17d..b271059 100644
  all: all-am
  
  .SUFFIXES:
+diff --git a/config.h.in b/config.h.in
+index 6f8080b..475e86e 100644
+--- a/config.h.in
++++ b/config.h.in
+@@ -981,6 +981,9 @@
+ /* Define to 1 if you have the `PyCapsule_New' function. */
+ #undef HAVE_PYCAPSULE_NEW
+ 
++/* Define to 1 if you have the `PyString_AsString' function. */
++#undef HAVE_PYSTRING_ASSTRING
++
+ /* Define to 1 if you have the `raise' function. */
+ #undef HAVE_RAISE
+ 
 diff --git a/configure b/configure
-index b42aec5..d623475 100755
+index d0a99e2..7233d72 100755
 --- a/configure
 +++ b/configure
 @@ -46476,7 +46476,10 @@ else
@@ -494,7 +509,98 @@ index b42aec5..d623475 100755
          fi
  	# Put the nasty error message in config.log where it belongs
  	echo "$FUSE_PKG_ERRORS" >&5
-@@ -52441,7 +52453,7 @@ ac_config_files="$ac_config_files podwrapper.sh"
+@@ -51318,7 +51330,9 @@ $as_echo "$PYTHON_PREFIX" >&6; }
+ 
+ 	    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Python version" >&5
+ $as_echo_n "checking Python version... " >&6; }
+-            PYTHON_VERSION=`$PYTHON -c "import sys; print (sys.version[0:3])"`
++            PYTHON_VERSION_MAJOR=`$PYTHON -c "import sys; print (sys.version_info[0])"`
++            PYTHON_VERSION_MINOR=`$PYTHON -c "import sys; print (sys.version_info[1])"`
++            PYTHON_VERSION="$PYTHON_VERSION_MAJOR.$PYTHON_VERSION_MINOR"
+ 	    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_VERSION" >&5
+ $as_echo "$PYTHON_VERSION" >&6; }
+ 
+@@ -51355,14 +51369,73 @@ $as_echo_n "checking for Python site-packages path... " >&6; }
+ $as_echo "$PYTHON_INSTALLDIR" >&6; }
+             fi
+ 
+-            old_LIBS="$LIBS"
+-            LIBS="$LIBS -lpython$PYTHON_VERSION"
+-            for ac_func in PyCapsule_New
++                        old_LIBS="$LIBS"
++            if test "x$PYTHON_VERSION_MAJOR" = "x3"; then
++                                LIBPYTHON="python${PYTHON_VERSION}mu"
++            else
++                LIBPYTHON="python$PYTHON_VERSION"
++            fi
++            as_ac_Lib=`$as_echo "ac_cv_lib_$LIBPYTHON''_PyList_Size" | $as_tr_sh`
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PyList_Size in -l$LIBPYTHON" >&5
++$as_echo_n "checking for PyList_Size in -l$LIBPYTHON... " >&6; }
++if eval \${$as_ac_Lib+:} false; then :
++  $as_echo_n "(cached) " >&6
++else
++  ac_check_lib_save_LIBS=$LIBS
++LIBS="-l$LIBPYTHON  $LIBS"
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++
++/* Override any GCC internal prototype to avoid an error.
++   Use char because int might match the return type of a GCC
++   builtin and then its argument prototype would still apply.  */
++#ifdef __cplusplus
++extern "C"
++#endif
++char PyList_Size ();
++int
++main ()
++{
++return PyList_Size ();
++  ;
++  return 0;
++}
++_ACEOF
++if ac_fn_c_try_link "$LINENO"; then :
++  eval "$as_ac_Lib=yes"
++else
++  eval "$as_ac_Lib=no"
++fi
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
++LIBS=$ac_check_lib_save_LIBS
++fi
++eval ac_res=\$$as_ac_Lib
++	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
++$as_echo "$ac_res" >&6; }
++if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
++  cat >>confdefs.h <<_ACEOF
++#define `$as_echo "HAVE_LIB$LIBPYTHON" | $as_tr_cpp` 1
++_ACEOF
++
++  LIBS="-l$LIBPYTHON $LIBS"
++
++else
++  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
++as_fn_error $? "$LIBPYTHON is not installed
++See \`config.log' for more details" "$LINENO" 5; }
++fi
++
++
++            for ac_func in PyCapsule_New \
++                            PyString_AsString
+ do :
+-  ac_fn_c_check_func "$LINENO" "PyCapsule_New" "ac_cv_func_PyCapsule_New"
+-if test "x$ac_cv_func_PyCapsule_New" = xyes; then :
++  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
++ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
++if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+   cat >>confdefs.h <<_ACEOF
+-#define HAVE_PYCAPSULE_NEW 1
++#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+ _ACEOF
+ 
+ fi
+@@ -52441,7 +52514,7 @@ ac_config_files="$ac_config_files podwrapper.sh"
  
  ac_config_files="$ac_config_files run"
  
@@ -503,7 +609,7 @@ index b42aec5..d623475 100755
  
  cat >confcache <<\_ACEOF
  # This file is a shell script that caches the results of configure
-@@ -53654,7 +53666,6 @@ do
+@@ -53654,7 +53727,6 @@ do
      "clone/Makefile") CONFIG_FILES="$CONFIG_FILES clone/Makefile" ;;
      "csharp/Makefile") CONFIG_FILES="$CONFIG_FILES csharp/Makefile" ;;
      "daemon/Makefile") CONFIG_FILES="$CONFIG_FILES daemon/Makefile" ;;
@@ -663,9 +769,18 @@ index f8232d3..12444e8 100644
  
  # No!  Otherwise it is deleted before the clean-local rule runs.
 diff --git a/python/Makefile.in b/python/Makefile.in
-index d3cd517..43078d3 100644
+index d3cd517..9f80541 100644
 --- a/python/Makefile.in
 +++ b/python/Makefile.in
+@@ -16,7 +16,7 @@
+ @SET_MAKE@
+ 
+ # libguestfs Python bindings
+-# Copyright (C) 2009 Red Hat Inc.
++# Copyright (C) 2009-2011 Red Hat Inc.
+ #
+ # This program is free software; you can redistribute it and/or modify
+ # it under the terms of the GNU General Public License as published by
 @@ -70,6 +70,7 @@ build_triplet = @build@
  host_triplet = @host@
  DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
@@ -674,9 +789,13 @@ index d3cd517..43078d3 100644
  subdir = python
  ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
  am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \
-@@ -1281,7 +1282,7 @@ EXTRA_DIST = \
+@@ -1279,9 +1280,10 @@ EXTRA_DIST = \
+ @HAVE_PYTHON_TRUE at TESTS_ENVIRONMENT = \
+ @HAVE_PYTHON_TRUE@	LIBGUESTFS_PATH=$(top_builddir)/appliance \
  @HAVE_PYTHON_TRUE@	PYTHONPATH=$(builddir):$(builddir)/.libs \
- @HAVE_PYTHON_TRUE@	TMPDIR=$(top_builddir)
+- at HAVE_PYTHON_TRUE@	TMPDIR=$(top_builddir)
++ at HAVE_PYTHON_TRUE@	TMPDIR=$(top_builddir) \
++ at HAVE_PYTHON_TRUE@	PYTHON=$(PYTHON)
  
 - at HAVE_PYTHON_TRUE@TESTS = run-bindtests run-python-tests
 + at HAVE_PYTHON_TRUE@TESTS = run-bindtests $(am__append_1)
diff --git a/debian/patches/series b/debian/patches/series
index b39e30e..d45a1e4 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -8,4 +8,9 @@
 0008-out-of-tree-build-daemon.patch
 0009-Fix-en-dis-able-install-daemon.patch
 0010-Fix-include.patch
-0011-autoreconf.patch
+0011-python-Correctly-check-for-Python-major-minor.patch
+0012-python-Include-config.h.patch
+0013-python-Pass-PYTHON-environment-variable-to-tests.patch
+0014-python-Fixes-for-Python-3-RHBZ-750889.patch
+0015-python-Use-sys.version_info-0-instead-of-sys.version.patch
+0016-autoreconf.patch

-- 
Libguestfs Debian packaging



More information about the Pkg-libvirt-commits mailing list