build: use split stringlist functions from common/utils

The OCaml and Python bindings directly use the utils.c source in
common/utils, mostly for guestfs_int_free_string_list.  That source
contained also functions using gnulib functions, however without
linking to gnulib.  When building with default build flags (e.g. without
as-needed mode), the gnulib symbols cannot be resolved, leading to
unusable OCaml and Python libraries.

As solution, update the common submodule to get the split of the split
of the stringlist functions in common/utils, and adapt the OCaml and
Python bindings:
- both now use stringlists-utils.c instead of utils.c
- fix the Python distutils setup to include only the sources really
  needed
This commit is contained in:
Pino Toscano
2019-12-20 11:29:44 +01:00
parent e789a070de
commit cb0edd4354
7 changed files with 17 additions and 51 deletions

9
.gitignore vendored
View File

@@ -451,9 +451,6 @@ Makefile.in
/python/actions.h
/python/bindtests.py
/python/build
/python/c-ctype.h
/python/cleanups.c
/python/cleanups.h
/python/config.h
/python/dist
/python/examples/guestfs-python.3
@@ -461,17 +458,15 @@ Makefile.in
/python/guestfs.py
/python/guestfs.pyc
/python/guestfs.pyo
/python/guestfs-internal-all.h
/python/guestfs-utils.h
/python/ignore-value.h
/python/guestfs-stringlists-utils.h
/python/MANIFEST
/python/module.c
/python/stringlists-utils.c
/python/structs.c
/python/__pycache__
/python/setup.py
/python/stamp-extra-files
/python/t/tests_helper.py
/python/utils.c
/rescue/stamp-virt-rescue.pod
/rescue/virt-rescue
/rescue/virt-rescue.1

2
common

Submodule common updated: 4c57e0b769...9c247a10e6

View File

@@ -42,7 +42,7 @@ let rec generate_python_actions_h () =
#define GUESTFS_PYTHON_ACTIONS_H_
#include \"guestfs.h\"
#include \"guestfs-utils.h\"
#include \"guestfs-stringlists-utils.h\"
#define PY_SSIZE_T_CLEAN 1

View File

@@ -94,7 +94,7 @@ libguestfsocaml_a_SOURCES = \
guestfs-c-actions.c \
guestfs-c-errnos.c \
../common/utils/cleanups.c \
../common/utils/utils.c
../common/utils/stringlists-utils.c
if HAVE_OCAMLDOC

View File

@@ -16,9 +16,5 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include actions.h
include c-ctype.h
include cleanups.h
include config.h
include guestfs-internal-all.h
include guestfs-utils.h
include ignore-value.h
include guestfs-stringlists-utils.h

View File

@@ -63,7 +63,8 @@ libguestfsmod_la_SOURCES = \
actions.h \
handle.c \
module.c \
structs.c
structs.c \
../common/utils/stringlists-utils.c
libguestfsmod_la_CPPFLAGS = \
-DGUESTFS_PRIVATE=1 \
@@ -75,7 +76,6 @@ libguestfsmod_la_CFLAGS = \
$(WARN_CFLAGS) $(WERROR_CFLAGS)
libguestfsmod_la_LIBADD = \
$(top_builddir)/common/utils/libutils_la-utils.lo \
$(top_builddir)/lib/libguestfs.la
libguestfsmod_la_LDFLAGS = -avoid-version -shared -module -shrext $(PYTHON_EXT_SUFFIX)
@@ -97,39 +97,19 @@ setup-install: setup.py stamp-extra-files
# Python's crappy MANIFEST file cannot graft single files, so we have
# to hard-link any extra files we need into the local directory.
stamp-extra-files: \
c-ctype.h \
cleanups.c \
cleanups.h \
config.h \
guestfs-internal-all.h \
guestfs-utils.h \
ignore-value.h \
utils.c
guestfs-stringlists-utils.h \
stringlists-utils.c
touch $@
config.h:
ln ../config.h $@
c-ctype.h:
ln $(top_srcdir)/gnulib/lib/c-ctype.h $@
guestfs-stringlists-utils.h:
ln $(top_srcdir)/common/utils/guestfs-stringlists-utils.h $@
cleanups.c:
ln $(top_srcdir)/common/utils/cleanups.c $@
cleanups.h:
ln $(top_srcdir)/common/utils/cleanups.h $@
ignore-value.h:
ln $(top_srcdir)/gnulib/lib/ignore-value.h $@
guestfs-internal-all.h:
ln $(top_srcdir)/lib/guestfs-internal-all.h $@
guestfs-utils.h:
ln $(top_srcdir)/common/utils/guestfs-utils.h $@
utils.c:
ln $(top_srcdir)/common/utils/utils.c $@
stringlists-utils.c:
ln $(top_srcdir)/common/utils/stringlists-utils.c $@
# Tests.
@@ -148,15 +128,10 @@ CLEANFILES += \
*.pyc \
examples/*~ examples/*.pyc \
t/*~ t/*.pyc \
c-ctype.h \
config.h \
cleanups.c \
cleanups.h \
guestfs-internal-all.h \
guestfs-utils.h \
ignore-value.h \
guestfs-stringlists-utils.h \
stamp-extra-files \
utils.c
stringlists-utils.c
clean-local:
rm -rf build dist __pycache__ t/__pycache__

View File

@@ -62,7 +62,7 @@ This package contains the Python bindings for libguestfs.
'handle.c',
'module.c',
'structs.c',
'utils.c'],
'stringlists-utils.c'],
include_dirs=['.', '../lib'],
libraries=['guestfs'],