On Thu, Jun 25, 2015 at 06:49:42PM +0200, Cédric Bosdonnat wrote:
Removing this dependency avoids getting all libvirt.so dependencies
loaded in our container.
---
libvirt-sandbox/Makefile.am | 41 +++++++++++----
libvirt-sandbox/libvirt-sandbox-config-all.h | 61 ++++++++++++++++++++++
.../libvirt-sandbox-config-interactive.c | 2 +-
.../libvirt-sandbox-config-mount-file.c | 2 +-
.../libvirt-sandbox-config-mount-guest-bind.c | 2 +-
.../libvirt-sandbox-config-mount-host-bind.c | 2 +-
.../libvirt-sandbox-config-mount-host-image.c | 2 +-
libvirt-sandbox/libvirt-sandbox-config-mount-ram.c | 2 +-
libvirt-sandbox/libvirt-sandbox-config-mount.c | 2 +-
.../libvirt-sandbox-config-network-address.c | 2 +-
...rt-sandbox-config-network-filterref-parameter.c | 2 +-
.../libvirt-sandbox-config-network-filterref.c | 2 +-
.../libvirt-sandbox-config-network-route.c | 2 +-
libvirt-sandbox/libvirt-sandbox-config-network.c | 2 +-
.../libvirt-sandbox-config-service-generic.c | 2 +-
.../libvirt-sandbox-config-service-systemd.c | 2 +-
libvirt-sandbox/libvirt-sandbox-config-service.c | 2 +-
libvirt-sandbox/libvirt-sandbox-config.c | 2 +-
libvirt-sandbox/libvirt-sandbox-init-common.c | 5 +-
libvirt-sandbox/libvirt-sandbox.h | 18 +------
20 files changed, 111 insertions(+), 46 deletions(-)
create mode 100644 libvirt-sandbox/libvirt-sandbox-config-all.h
diff --git a/libvirt-sandbox/Makefile.am b/libvirt-sandbox/Makefile.am
index 30c9ebf..0e623c5 100644
--- a/libvirt-sandbox/Makefile.am
+++ b/libvirt-sandbox/Makefile.am
@@ -50,11 +50,9 @@ SANDBOX_RPC_FILES = \
libvirt-sandbox-rpcpacket.h \
$(NULL)
-SANDBOX_HEADER_FILES = \
- libvirt-sandbox.h \
- libvirt-sandbox-main.h \
- libvirt-sandbox-util.h \
+SANDBOX_CONFIG_HEADER_FILES = \
libvirt-sandbox-config.h \
+ libvirt-sandbox-config-all.h \
I'd be inclined to *not* add this - merely keep this header
file as non-installed.
libvirt-sandbox-config-network.h \
libvirt-sandbox-config-network-address.h \
libvirt-sandbox-config-network-filterref-parameter.h \
@@ -71,6 +69,12 @@ SANDBOX_HEADER_FILES = \
libvirt-sandbox-config-service.h \
libvirt-sandbox-config-service-systemd.h \
libvirt-sandbox-config-service-generic.h \
+ $(NULL)
+
+SANDBOX_HEADER_FILES = \
+ libvirt-sandbox.h \
+ libvirt-sandbox-main.h \
+ libvirt-sandbox-util.h \
libvirt-sandbox-builder.h \
libvirt-sandbox-builder-initrd.h \
libvirt-sandbox-builder-machine.h \
@@ -81,7 +85,9 @@ SANDBOX_HEADER_FILES = \
libvirt-sandbox-context.h \
libvirt-sandbox-context-interactive.h \
libvirt-sandbox-context-service.h \
+ $(SANDBOX_CONFIG_HEADER_FILES) \
$(NULL)
+
SANDBOX_SOURCE_FILES = \
libvirt-sandbox-main.c \
libvirt-sandbox-config.c \
@@ -166,31 +172,48 @@ libvirt_sandbox_1_0_la_LDFLAGS = \
libvirt_sandbox_init_common_SOURCES = libvirt-sandbox-init-common.c \
$(SANDBOX_GENERATED_RPC_FILES) \
$(SANDBOX_RPC_FILES) \
+ $(SANDBOX_CONFIG_HEADER_FILES) \
+ libvirt-sandbox-config.c \
+ libvirt-sandbox-config-network.c \
+ libvirt-sandbox-config-network-address.c \
+ libvirt-sandbox-config-network-filterref.c \
+ libvirt-sandbox-config-network-filterref-parameter.c \
+ libvirt-sandbox-config-network-route.c \
+ libvirt-sandbox-config-mount.c \
+ libvirt-sandbox-config-mount-file.c \
+ libvirt-sandbox-config-mount-host-bind.c \
+ libvirt-sandbox-config-mount-host-image.c \
+ libvirt-sandbox-config-mount-guest-bind.c \
+ libvirt-sandbox-config-mount-ram.c \
+ libvirt-sandbox-config-interactive.c \
+ libvirt-sandbox-config-service.c \
+ libvirt-sandbox-config-service-systemd.c \
+ libvirt-sandbox-config-service-generic.c \
We could useful defined a SANDBOX_CONFIG_SOURCE_FILES rule so
we can avoid duplicating the list config source files in two
places,
$(NULL)
libvirt_sandbox_init_common_CFLAGS = \
-DLIBEXECDIR="\"$(libexecdir)\"" \
-DSANDBOXCONFIGDIR="\"$(sandboxconfigdir)\"" \
-DLOCALEDIR="\"$(datadir)/locale"\" \
+ -DLIBVIRT_SANDBOX_BUILD \
$(COVERAGE_CFLAGS) \
-I$(top_srcdir) \
-I$(top_builddir) \
+ $(LIBVIRT_GCONFIG_CFLAGS) \
$(GIO_UNIX_CFLAGS) \
- $(LIBVIRT_GLIB_CFLAGS) \
- $(LIBVIRT_GOBJECT_CFLAGS) \
$(CAPNG_CFLAGS) \
+ $(SELINUX_CFLAGS) \
$(WARN_CFLAGS) \
$(NULL)
libvirt_sandbox_init_common_LDFLAGS = \
-lutil \
$(COVERAGE_CFLAGS:-f%=-Wc,f%) \
$(GIO_UNIX_LIBS) \
- $(LIBVIRT_GLIB_LIBS) \
- $(LIBVIRT_GOBJECT_LIBS) \
+ $(LIBVIRT_GCONFIG_LIBS) \
$(CAPNG_LIBS) \
+ $(SELINUX_LIBS) \
$(WARN_CFLAGS) \
$(NULL)
libvirt_sandbox_init_common_LDADD = \
- libvirt-sandbox-1.0.la \
$(NULL)
libvirt_sandbox_init_lxc_SOURCES = libvirt-sandbox-init-lxc.c
diff --git a/libvirt-sandbox/libvirt-sandbox-config-all.h
b/libvirt-sandbox/libvirt-sandbox-config-all.h
new file mode 100644
index 0000000..9a2d70c
--- /dev/null
+++ b/libvirt-sandbox/libvirt-sandbox-config-all.h
@@ -0,0 +1,61 @@
+/*
+ * libvirt-sandbox.h: libvirt sandbox integration
+[ *
+ * Copyright (C) 2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author: Daniel P. Berrange <berrange(a)redhat.com>
+ */
+
+#ifndef __LIBVIRT_SANDBOX_CONFIG_ALL_H__
+#define __LIBVIRT_SANDBOX_CONFIG_ALL_H__
+
+/* External include */
+#include <libvirt-gconfig/libvirt-gconfig.h>
+#include <glib.h>
+#include <glib-object.h>
+#include <gio/gio.h>
+
+/* Local includes */
+#include <libvirt-sandbox/libvirt-sandbox-util.h>
+#include <libvirt-sandbox/libvirt-sandbox-config-mount.h>
+#include <libvirt-sandbox/libvirt-sandbox-config-mount-file.h>
+#include <libvirt-sandbox/libvirt-sandbox-config-mount-host-bind.h>
+#include <libvirt-sandbox/libvirt-sandbox-config-mount-host-image.h>
+#include <libvirt-sandbox/libvirt-sandbox-config-mount-guest-bind.h>
+#include <libvirt-sandbox/libvirt-sandbox-config-mount-ram.h>
+#include <libvirt-sandbox/libvirt-sandbox-config-network-address.h>
+#include <libvirt-sandbox/libvirt-sandbox-config-network-filterref-parameter.h>
+#include <libvirt-sandbox/libvirt-sandbox-config-network-filterref.h>
+#include <libvirt-sandbox/libvirt-sandbox-config-network-route.h>
+#include <libvirt-sandbox/libvirt-sandbox-config-network.h>
+#include <libvirt-sandbox/libvirt-sandbox-config.h>
+#include <libvirt-sandbox/libvirt-sandbox-config-initrd.h>
+#include <libvirt-sandbox/libvirt-sandbox-config-interactive.h>
+#include <libvirt-sandbox/libvirt-sandbox-config-service.h>
+#include <libvirt-sandbox/libvirt-sandbox-config-service-systemd.h>
+#include <libvirt-sandbox/libvirt-sandbox-config-service-generic.h>
+
+#endif /* __LIBVIRT_SANDBOX_CONFIG_ALL_H__ */
+
+/*
+ * Local variables:
+ * c-indent-level: 4
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * tab-width: 8
+ * End:
+ */
diff --git a/libvirt-sandbox/libvirt-sandbox-config-interactive.c
b/libvirt-sandbox/libvirt-sandbox-config-interactive.c
index 82d9431..27b4c16 100644
--- a/libvirt-sandbox/libvirt-sandbox-config-interactive.c
+++ b/libvirt-sandbox/libvirt-sandbox-config-interactive.c
@@ -23,7 +23,7 @@
#include <config.h>
#include <string.h>
-#include "libvirt-sandbox/libvirt-sandbox.h"
+#include "libvirt-sandbox/libvirt-sandbox-config-all.h"
/**
* SECTION: libvirt-sandbox-config-interactive
diff --git a/libvirt-sandbox/libvirt-sandbox-config-mount-file.c
b/libvirt-sandbox/libvirt-sandbox-config-mount-file.c
index d6a3122..e53929f 100644
--- a/libvirt-sandbox/libvirt-sandbox-config-mount-file.c
+++ b/libvirt-sandbox/libvirt-sandbox-config-mount-file.c
@@ -23,7 +23,7 @@
#include <config.h>
#include <string.h>
-#include "libvirt-sandbox/libvirt-sandbox.h"
+#include "libvirt-sandbox/libvirt-sandbox-config-all.h"
/**
* SECTION: libvirt-sandbox-config-mount-file
diff --git a/libvirt-sandbox/libvirt-sandbox-config-mount-guest-bind.c
b/libvirt-sandbox/libvirt-sandbox-config-mount-guest-bind.c
index 5b3b87f..061f625 100644
--- a/libvirt-sandbox/libvirt-sandbox-config-mount-guest-bind.c
+++ b/libvirt-sandbox/libvirt-sandbox-config-mount-guest-bind.c
@@ -23,7 +23,7 @@
#include <config.h>
#include <string.h>
-#include "libvirt-sandbox/libvirt-sandbox.h"
+#include "libvirt-sandbox/libvirt-sandbox-config-all.h"
/**
* SECTION: libvirt-sandbox-config-mount-guest-bind
diff --git a/libvirt-sandbox/libvirt-sandbox-config-mount-host-bind.c
b/libvirt-sandbox/libvirt-sandbox-config-mount-host-bind.c
index d65f51f..c0c911b 100644
--- a/libvirt-sandbox/libvirt-sandbox-config-mount-host-bind.c
+++ b/libvirt-sandbox/libvirt-sandbox-config-mount-host-bind.c
@@ -23,7 +23,7 @@
#include <config.h>
#include <string.h>
-#include "libvirt-sandbox/libvirt-sandbox.h"
+#include "libvirt-sandbox/libvirt-sandbox-config-all.h"
/**
* SECTION: libvirt-sandbox-config-mount-host-bind
diff --git a/libvirt-sandbox/libvirt-sandbox-config-mount-host-image.c
b/libvirt-sandbox/libvirt-sandbox-config-mount-host-image.c
index 37573ef..cf7ce49 100644
--- a/libvirt-sandbox/libvirt-sandbox-config-mount-host-image.c
+++ b/libvirt-sandbox/libvirt-sandbox-config-mount-host-image.c
@@ -23,7 +23,7 @@
#include <config.h>
#include <string.h>
-#include "libvirt-sandbox/libvirt-sandbox.h"
+#include "libvirt-sandbox/libvirt-sandbox-config-all.h"
/**
* SECTION: libvirt-sandbox-config-mount-image
diff --git a/libvirt-sandbox/libvirt-sandbox-config-mount-ram.c
b/libvirt-sandbox/libvirt-sandbox-config-mount-ram.c
index f4ad6e2..1e0c352 100644
--- a/libvirt-sandbox/libvirt-sandbox-config-mount-ram.c
+++ b/libvirt-sandbox/libvirt-sandbox-config-mount-ram.c
@@ -23,7 +23,7 @@
#include <config.h>
#include <string.h>
-#include "libvirt-sandbox/libvirt-sandbox.h"
+#include "libvirt-sandbox/libvirt-sandbox-config-all.h"
/**
* SECTION: libvirt-sandbox-config-mount-ram
diff --git a/libvirt-sandbox/libvirt-sandbox-config-mount.c
b/libvirt-sandbox/libvirt-sandbox-config-mount.c
index b84199e..21a8684 100644
--- a/libvirt-sandbox/libvirt-sandbox-config-mount.c
+++ b/libvirt-sandbox/libvirt-sandbox-config-mount.c
@@ -23,7 +23,7 @@
#include <config.h>
#include <string.h>
-#include "libvirt-sandbox/libvirt-sandbox.h"
+#include "libvirt-sandbox/libvirt-sandbox-config-all.h"
/**
* SECTION: libvirt-sandbox-config-mount
diff --git a/libvirt-sandbox/libvirt-sandbox-config-network-address.c
b/libvirt-sandbox/libvirt-sandbox-config-network-address.c
index b2e58dc..68b0268 100644
--- a/libvirt-sandbox/libvirt-sandbox-config-network-address.c
+++ b/libvirt-sandbox/libvirt-sandbox-config-network-address.c
@@ -23,7 +23,7 @@
#include <config.h>
#include <string.h>
-#include "libvirt-sandbox/libvirt-sandbox.h"
+#include "libvirt-sandbox/libvirt-sandbox-config-all.h"
/**
* SECTION: libvirt-sandbox-config-network_address
diff --git a/libvirt-sandbox/libvirt-sandbox-config-network-filterref-parameter.c
b/libvirt-sandbox/libvirt-sandbox-config-network-filterref-parameter.c
index 5086ac6..2807b4f 100644
--- a/libvirt-sandbox/libvirt-sandbox-config-network-filterref-parameter.c
+++ b/libvirt-sandbox/libvirt-sandbox-config-network-filterref-parameter.c
@@ -23,7 +23,7 @@
#include <config.h>
#include <string.h>
-#include "libvirt-sandbox/libvirt-sandbox.h"
+#include "libvirt-sandbox/libvirt-sandbox-config-all.h"
/**
* SECTION: libvirt-sandbox-config-network-filterref-parameter
diff --git a/libvirt-sandbox/libvirt-sandbox-config-network-filterref.c
b/libvirt-sandbox/libvirt-sandbox-config-network-filterref.c
index c0c8e01..1770c0b 100644
--- a/libvirt-sandbox/libvirt-sandbox-config-network-filterref.c
+++ b/libvirt-sandbox/libvirt-sandbox-config-network-filterref.c
@@ -24,7 +24,7 @@
#include <config.h>
#include <string.h>
-#include "libvirt-sandbox/libvirt-sandbox.h"
+#include "libvirt-sandbox/libvirt-sandbox-config-all.h"
/**
* SECTION: libvirt-sandbox-config-network-filterref
diff --git a/libvirt-sandbox/libvirt-sandbox-config-network-route.c
b/libvirt-sandbox/libvirt-sandbox-config-network-route.c
index 311b2e7..1664d18 100644
--- a/libvirt-sandbox/libvirt-sandbox-config-network-route.c
+++ b/libvirt-sandbox/libvirt-sandbox-config-network-route.c
@@ -23,7 +23,7 @@
#include <config.h>
#include <string.h>
-#include "libvirt-sandbox/libvirt-sandbox.h"
+#include "libvirt-sandbox/libvirt-sandbox-config-all.h"
/**
* SECTION: libvirt-sandbox-config-network_route
diff --git a/libvirt-sandbox/libvirt-sandbox-config-network.c
b/libvirt-sandbox/libvirt-sandbox-config-network.c
index 2bb55bf..df21700 100644
--- a/libvirt-sandbox/libvirt-sandbox-config-network.c
+++ b/libvirt-sandbox/libvirt-sandbox-config-network.c
@@ -23,7 +23,7 @@
#include <config.h>
#include <string.h>
-#include "libvirt-sandbox/libvirt-sandbox.h"
+#include "libvirt-sandbox/libvirt-sandbox-config-all.h"
/**
* SECTION: libvirt-sandbox-config-network
diff --git a/libvirt-sandbox/libvirt-sandbox-config-service-generic.c
b/libvirt-sandbox/libvirt-sandbox-config-service-generic.c
index a9e8858..d1118c2 100644
--- a/libvirt-sandbox/libvirt-sandbox-config-service-generic.c
+++ b/libvirt-sandbox/libvirt-sandbox-config-service-generic.c
@@ -23,7 +23,7 @@
#include <config.h>
#include <string.h>
-#include "libvirt-sandbox/libvirt-sandbox.h"
+#include "libvirt-sandbox/libvirt-sandbox-config-all.h"
/**
* SECTION: libvirt-sandbox-config-service-generic
diff --git a/libvirt-sandbox/libvirt-sandbox-config-service-systemd.c
b/libvirt-sandbox/libvirt-sandbox-config-service-systemd.c
index 8436a25..dc2e4a5 100644
--- a/libvirt-sandbox/libvirt-sandbox-config-service-systemd.c
+++ b/libvirt-sandbox/libvirt-sandbox-config-service-systemd.c
@@ -23,7 +23,7 @@
#include <config.h>
#include <string.h>
-#include "libvirt-sandbox/libvirt-sandbox.h"
+#include "libvirt-sandbox/libvirt-sandbox-config-all.h"
/**
* SECTION: libvirt-sandbox-config-service-systemd
diff --git a/libvirt-sandbox/libvirt-sandbox-config-service.c
b/libvirt-sandbox/libvirt-sandbox-config-service.c
index a99f42a..388ec63 100644
--- a/libvirt-sandbox/libvirt-sandbox-config-service.c
+++ b/libvirt-sandbox/libvirt-sandbox-config-service.c
@@ -23,7 +23,7 @@
#include <config.h>
#include <string.h>
-#include "libvirt-sandbox/libvirt-sandbox.h"
+#include "libvirt-sandbox/libvirt-sandbox-config-all.h"
/**
* SECTION: libvirt-sandbox-config-service
diff --git a/libvirt-sandbox/libvirt-sandbox-config.c
b/libvirt-sandbox/libvirt-sandbox-config.c
index fbc65a6..d82076a 100644
--- a/libvirt-sandbox/libvirt-sandbox-config.c
+++ b/libvirt-sandbox/libvirt-sandbox-config.c
@@ -26,7 +26,7 @@
#include <glib/gi18n.h>
-#include "libvirt-sandbox/libvirt-sandbox.h"
+#include "libvirt-sandbox/libvirt-sandbox-config-all.h"
#include <errno.h>
#include <selinux/selinux.h>
diff --git a/libvirt-sandbox/libvirt-sandbox-init-common.c
b/libvirt-sandbox/libvirt-sandbox-init-common.c
index 68f96ba..46464ea 100644
--- a/libvirt-sandbox/libvirt-sandbox-init-common.c
+++ b/libvirt-sandbox/libvirt-sandbox-init-common.c
@@ -22,7 +22,7 @@
#include <config.h>
-#include <libvirt-sandbox/libvirt-sandbox.h>
+#include <libvirt-sandbox/libvirt-sandbox-config-all.h>
#include <glib/gi18n.h>
#include <stdio.h>
@@ -1179,9 +1179,6 @@ int main(int argc, char **argv) {
exit(EXIT_FAILURE);
}
- if (!gvir_sandbox_init_check(&argc, &argv, &error))
- exit(EXIT_FAILURE);
-
g_set_application_name(_("Libvirt Sandbox Init Common"));
context = g_option_context_new (_("- Libvirt Sandbox"));
diff --git a/libvirt-sandbox/libvirt-sandbox.h b/libvirt-sandbox/libvirt-sandbox.h
index adb21a1..b9de570 100644
--- a/libvirt-sandbox/libvirt-sandbox.h
+++ b/libvirt-sandbox/libvirt-sandbox.h
@@ -31,23 +31,7 @@
#include <libvirt-sandbox/libvirt-sandbox-main.h>
#include <libvirt-sandbox/libvirt-sandbox-util.h>
#include <libvirt-sandbox/libvirt-sandbox-enum-types.h>
-#include <libvirt-sandbox/libvirt-sandbox-config-mount.h>
-#include <libvirt-sandbox/libvirt-sandbox-config-mount-file.h>
-#include <libvirt-sandbox/libvirt-sandbox-config-mount-host-bind.h>
-#include <libvirt-sandbox/libvirt-sandbox-config-mount-host-image.h>
-#include <libvirt-sandbox/libvirt-sandbox-config-mount-guest-bind.h>
-#include <libvirt-sandbox/libvirt-sandbox-config-mount-ram.h>
-#include <libvirt-sandbox/libvirt-sandbox-config-network-address.h>
-#include <libvirt-sandbox/libvirt-sandbox-config-network-filterref-parameter.h>
-#include <libvirt-sandbox/libvirt-sandbox-config-network-filterref.h>
-#include <libvirt-sandbox/libvirt-sandbox-config-network-route.h>
-#include <libvirt-sandbox/libvirt-sandbox-config-network.h>
-#include <libvirt-sandbox/libvirt-sandbox-config.h>
-#include <libvirt-sandbox/libvirt-sandbox-config-initrd.h>
-#include <libvirt-sandbox/libvirt-sandbox-config-interactive.h>
-#include <libvirt-sandbox/libvirt-sandbox-config-service.h>
-#include <libvirt-sandbox/libvirt-sandbox-config-service-systemd.h>
-#include <libvirt-sandbox/libvirt-sandbox-config-service-generic.h>
+#include <libvirt-sandbox/libvirt-sandbox-config-all.h>
I'd prefer to not change libvirt-sandbox.h - just keep this
libvirt-sandbox-config-all.h file as in-tree only, avoid
putting it into /usr/include
#include <libvirt-sandbox/libvirt-sandbox-builder.h>
#include <libvirt-sandbox/libvirt-sandbox-builder-initrd.h>
#include <libvirt-sandbox/libvirt-sandbox-builder-machine.h>
Regards,
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|