Merge lib/* into common

This moves all the files from lib into common, and it also adds all the libflatpak
sources into libflatpak-common, making libflatpak just a wrapper around the common
helper library.

This move allows the CLI to use all the code from libflatpak. We were already doing
this with a few things like flatpak-error*.[ch], and we want to do it even more
when sharing FlatpakTransaction. This also allows use to slowly move
the CLI to using the libflatpak apis for some things.

Closes: #1706
Approved by: alexlarsson
This commit is contained in:
Alexander Larsson
2018-05-24 13:34:37 +02:00
committed by Atomic Bot
parent 1ad3b8c30b
commit efb92704fe
39 changed files with 145 additions and 164 deletions

6
.gitignore vendored
View File

@@ -51,10 +51,10 @@ document-portal/xdp-dbus.[ch]
document-portal/xdp-resources.[ch]
.dirstamp
test-suite*.log
lib/flatpak-version-macros.h
common/flatpak-version-macros.h
flatpak.pc
lib/flatpak-enum-types.c
lib/flatpak-enum-types.h
common/flatpak-enum-types.c
common/flatpak-enum-types.h
test-libflatpak
Flatpak-1.0.*
/app/parse-datetime.c

View File

@@ -51,8 +51,6 @@ AM_CPPFLAGS = \
-I$(srcdir)/libglnx \
-I$(srcdir)/common \
-I$(builddir)/common \
-I$(srcdir)/lib \
-I$(builddir)/lib \
-include "config.h" \
$(NULL)
@@ -90,7 +88,6 @@ include libglnx/Makefile-libglnx.am.inc
include common/Makefile.am.inc
include data/Makefile.am.inc
include app/Makefile.am.inc
include lib/Makefile.am.inc
include session-helper/Makefile.am.inc
include portal/Makefile.am.inc
include system-helper/Makefile.am.inc

View File

@@ -35,7 +35,7 @@
#include "flatpak-builtins-utils.h"
#include "flatpak-transaction.h"
#include "flatpak-utils-private.h"
#include "lib/flatpak-error.h"
#include "flatpak-error.h"
#include "flatpak-chain-input-stream-private.h"
static char *opt_arch;

View File

@@ -1,8 +1,39 @@
lib_LTLIBRARIES += libflatpak.la
noinst_LTLIBRARIES += libflatpak-common.la
noinst_PROGRAMS += test-libflatpak
flatpakincludedir = $(includedir)/flatpak
flatpakinclude_HEADERS = \
common/flatpak.h \
common/flatpak-ref.h \
common/flatpak-error.h \
common/flatpak-installed-ref.h \
common/flatpak-remote-ref.h \
common/flatpak-related-ref.h \
common/flatpak-bundle-ref.h \
common/flatpak-installation.h \
common/flatpak-remote.h \
common/flatpak-version-macros.h \
$(NULL)
nodist_flatpakinclude_HEADERS = \
common/flatpak-enum-types.h \
$(NULL)
dbus_built_sources = common/flatpak-dbus-generated.c common/flatpak-dbus-generated.h common/flatpak-document-dbus-generated.c common/flatpak-document-dbus-generated.h
systemd_dbus_built_sources = common/flatpak-systemd-dbus-generated.c common/flatpak-systemd-dbus-generated.h
common/flatpak-enum-types.h: $(flatpakinclude_HEADERS) common/flatpak-enum-types.h.template
$(AM_V_GEN) $(GLIB_MKENUMS) --template $(filter %.template,$^) $(filter-out %.template,$^) > \
common/flatpak-enum-types.h.tmp && mv common/flatpak-enum-types.h.tmp common/flatpak-enum-types.h
common/flatpak-enum-types.c: $(flatpakinclude_HEADERS) common/flatpak-enum-types.c.template
$(AM_V_GEN) $(GLIB_MKENUMS) --template $(filter %.template,$^) $(filter-out %.template,$^) > \
common/flatpak-enum-types.c.tmp && mv common/flatpak-enum-types.c.tmp common/flatpak-enum-types.c
EXTRA_DIST += common/flatpak-enum-types.c.template common/flatpak-enum-types.h.template
common/flatpak-dbus-generated.c: data/org.freedesktop.Flatpak.xml Makefile
mkdir -p $(builddir)/common
$(AM_V_GEN) $(GDBUS_CODEGEN) \
@@ -34,15 +65,18 @@ common/%-dbus-generated.h: common/%-dbus-generated.c
@true # Built as a side-effect of the rules for the .c
nodist_libflatpak_common_la_SOURCES = \
$(nodist_flatpakinclude_HEADERS) \
$(dbus_built_sources) \
$(systemd_dbus_built_sources) \
$(xdp_dbus_built_sources) \
common/flatpak-enum-types.c \
$(NULL)
BUILT_SOURCES += $(nodist_libflatpak_common_la_SOURCES)
CLEANFILES += $(nodist_libflatpak_common_la_SOURCES)
libflatpak_common_la_SOURCES = \
$(flatpakinclude_HEADERS) \
common/flatpak-common-types-private.h \
common/flatpak-bwrap.c \
common/flatpak-bwrap-private.h \
@@ -66,9 +100,22 @@ libflatpak_common_la_SOURCES = \
common/flatpak-json-oci-private.h \
common/flatpak-oci-registry.c \
common/flatpak-oci-registry-private.h \
common/flatpak-ref.c \
common/flatpak-installed-ref.c \
common/flatpak-installed-ref-private.h \
common/flatpak-remote-ref.c \
common/flatpak-remote-ref-private.h \
common/flatpak-bundle-ref.c \
common/flatpak-related-ref.c \
common/flatpak-related-ref-private.h \
common/flatpak-remote-private.h \
common/flatpak-remote.c \
common/flatpak-error.c \
common/flatpak-installation.c \
$(NULL)
libflatpak_common_la_CFLAGS = \
-DFLATPAK_COMPILATION \
$(AM_CFLAGS) \
$(BASE_CFLAGS) \
$(HIDDEN_VISIBILITY_CFLAGS) \
@@ -81,3 +128,90 @@ libflatpak_common_la_CFLAGS = \
-I$(srcdir)/dbus-proxy \
$(NULL)
libflatpak_common_la_LIBADD = $(AM_LIBADD) libglnx.la $(BASE_LIBS) $(OSTREE_LIBS) $(SOUP_LIBS) $(JSON_LIBS) $(XAUTH_LIBS) $(LIBSECCOMP_LIBS) $(INTERNAL_GPGME_LIBS)
libflatpak_la_SOURCES = \
common/flatpak.c \
$(NULL)
libflatpak_la_CFLAGS = \
$(HIDDEN_VISIBILITY_CFLAGS) \
-DFLATPAK_COMPILATION \
-I$(top_srcdir)/common \
-I$(top_builddir)/common \
$(AM_CFLAGS) \
$(BASE_CFLAGS) \
$(OSTREE_CFLAGS) \
$(SOUP_CFLAGS) \
$(JSON_CFLAGS) \
$(NULL)
libflatpak_la_LDFLAGS = \
$(AM_LDFLAGS) \
-version-info $(LT_VERSION_INFO) \
-export-dynamic \
-rpath $(libdir) \
$(NULL)
libflatpak_la_LIBADD = \
$(AM_LIBADD) \
libflatpak-common.la \
$(BASE_LIBS) \
$(OSTREE_LIBS) \
$(SOUP_LIBS) \
$(JSON_LIBS) \
$(NULL)
test_libflatpak_SOURCES = \
common/test-lib.c \
$(NULL)
test_libflatpak_CFLAGS = \
$(AM_CFLAGS) \
$(BASE_CFLAGS) \
-I$(top_srcdir)/common \
-I$(top_builddir)/common \
$(NULL)
test_libflatpak_LDADD = \
$(AM_LDADD) \
$(BASE_LIBS) \
libflatpak.la \
$(NULL)
# gobject-introspection rules
-include $(INTROSPECTION_MAKEFILE)
INTROSPECTION_GIRS =
if HAVE_INTROSPECTION
Flatpak-1.0.gir: libflatpak.la Makefile
introspected_headers = \
$(flatpakinclude_HEADERS) \
$(nodist_flatpakinclude_HEADERS) \
$(NULL)
introspected_sources = $(filter-out %-private.h,$(sources))
Flatpak_1_0_gir_NAMESPACE = Flatpak
Flatpak_1_0_gir_VERSION = 1.0
Flatpak_1_0_gir_LIBS = libflatpak.la
Flatpak_1_0_gir_FILES = $(introspected_headers) $(introspected_sources)
Flatpak_1_0_gir_CFLAGS = $(libflatpak_la_CFLAGS)
Flatpak_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0
Flatpak_1_0_gir_SCANNERFLAGS = \
--warn-all \
--c-include='flatpak.h' \
--pkg-export=flatpak
INTROSPECTION_GIRS += Flatpak-1.0.gir
girdir = $(datadir)/gir-1.0
nodist_gir_DATA = $(INTROSPECTION_GIRS)
CLEANFILES += $(nodist_gir_DATA)
typelibdir = $(libdir)/girepository-1.0
nodist_typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
CLEANFILES += $(nodist_typelib_DATA)
endif # HAVE_INTROSPECTION

View File

@@ -42,7 +42,7 @@
#include "flatpak-utils-private.h"
#include "flatpak-dir-private.h"
#include "flatpak-systemd-dbus-generated.h"
#include "lib/flatpak-error.h"
#include "flatpak-error.h"
/* Same order as enum */
const char *flatpak_context_shares[] = {

View File

@@ -38,7 +38,7 @@
#include <gio/gio.h>
#include <gio/gunixsocketaddress.h>
#include "libglnx/libglnx.h"
#include "lib/flatpak-error.h"
#include "flatpak-error.h"
#include <ostree.h>
#include "flatpak-dir-private.h"

View File

@@ -46,7 +46,7 @@
#include "flatpak-utils-private.h"
#include "flatpak-dir-private.h"
#include "flatpak-systemd-dbus-generated.h"
#include "lib/flatpak-error.h"
#include "flatpak-error.h"
/* We don't want to export paths pointing into these, because they are readonly
(so we can't create mountpoints there) and don't match whats on the host anyway */

View File

View File

View File

@@ -52,7 +52,7 @@
#include "flatpak-dir-private.h"
#include "flatpak-systemd-dbus-generated.h"
#include "flatpak-document-dbus-generated.h"
#include "lib/flatpak-error.h"
#include "flatpak-error.h"
#define DEFAULT_SHELL "/bin/sh"

View File

@@ -21,7 +21,7 @@
#include "config.h"
#include "flatpak-utils-private.h"
#include "lib/flatpak-error.h"
#include "flatpak-error.h"
#include "flatpak-dir-private.h"
#include "flatpak-oci-registry-private.h"
#include "flatpak-run-private.h"

View File

View File

View File

View File

@@ -437,7 +437,7 @@ Makefile
doc/Makefile
doc/reference/Makefile
flatpak.pc
lib/flatpak-version-macros.h
common/flatpak-version-macros.h
doc/reference/version.xml
doc/flatpak-docs.xml
po/Makefile.in

View File

@@ -1,149 +0,0 @@
lib_LTLIBRARIES += libflatpak.la
noinst_PROGRAMS += test-libflatpak
flatpakincludedir = $(includedir)/flatpak
flatpakinclude_HEADERS = \
lib/flatpak.h \
lib/flatpak-ref.h \
lib/flatpak-error.h \
lib/flatpak-installed-ref.h \
lib/flatpak-remote-ref.h \
lib/flatpak-related-ref.h \
lib/flatpak-bundle-ref.h \
lib/flatpak-installation.h \
lib/flatpak-remote.h \
lib/flatpak-version-macros.h \
$(NULL)
nodist_flatpakinclude_HEADERS = \
lib/flatpak-enum-types.h \
$(NULL)
BUILT_SOURCES += \
$(nodist_flatpakinclude_HEADERS) \
$(nodist_libflatpak_la_SOURCES) \
$(NULL)
DISTCLEANFILES += \
$(nodist_flatpakinclude_HEADERS) \
$(nodist_libflatpak_la_SOURCES) \
$(NULL)
lib/flatpak-enum-types.h: $(flatpakinclude_HEADERS) lib/flatpak-enum-types.h.template
$(AM_V_GEN) $(GLIB_MKENUMS) --template $(filter %.template,$^) $(filter-out %.template,$^) > \
lib/flatpak-enum-types.h.tmp && mv lib/flatpak-enum-types.h.tmp lib/flatpak-enum-types.h
lib/flatpak-enum-types.c: $(flatpakinclude_HEADERS) lib/flatpak-enum-types.c.template
$(AM_V_GEN) $(GLIB_MKENUMS) --template $(filter %.template,$^) $(filter-out %.template,$^) > \
lib/flatpak-enum-types.c.tmp && mv lib/flatpak-enum-types.c.tmp lib/flatpak-enum-types.c
EXTRA_DIST += lib/flatpak-enum-types.c.template lib/flatpak-enum-types.h.template
libflatpak_la_SOURCES = \
lib/flatpak.c \
lib/flatpak-ref.c \
lib/flatpak-installed-ref.c \
lib/flatpak-installed-ref-private.h \
lib/flatpak-remote-ref.c \
lib/flatpak-remote-ref-private.h \
lib/flatpak-bundle-ref.c \
lib/flatpak-related-ref.c \
lib/flatpak-related-ref-private.h \
lib/flatpak-remote-private.h \
lib/flatpak-remote.c \
lib/flatpak-error.c \
lib/flatpak-installation.c \
$(NULL)
nodist_libflatpak_la_SOURCES = \
lib/flatpak-enum-types.c \
$(NULL)
sources = \
$(libflatpak_la_SOURCES) \
$(nodist_libflatpak_la_SOURCES) \
$(NULL)
libflatpak_la_CFLAGS = \
$(HIDDEN_VISIBILITY_CFLAGS) \
-DFLATPAK_COMPILATION \
-I$(top_srcdir)/lib \
-I$(top_builddir)/lib \
$(AM_CFLAGS) \
$(BASE_CFLAGS) \
$(OSTREE_CFLAGS) \
$(SOUP_CFLAGS) \
$(JSON_CFLAGS) \
$(NULL)
libflatpak_la_LDFLAGS = \
$(AM_LDFLAGS) \
-version-info $(LT_VERSION_INFO) \
-export-dynamic \
-rpath $(libdir) \
$(NULL)
libflatpak_la_LIBADD = \
$(AM_LIBADD) \
libflatpak-common.la \
$(BASE_LIBS) \
$(OSTREE_LIBS) \
$(SOUP_LIBS) \
$(JSON_LIBS) \
$(NULL)
test_libflatpak_SOURCES = \
lib/test-lib.c \
$(NULL)
test_libflatpak_CFLAGS = \
$(AM_CFLAGS) \
$(BASE_CFLAGS) \
-I$(top_srcdir)/lib \
-I$(top_builddir)/lib \
$(NULL)
test_libflatpak_LDADD = \
$(AM_LDADD) \
$(BASE_LIBS) \
libflatpak.la \
$(NULL)
# gobject-introspection rules
-include $(INTROSPECTION_MAKEFILE)
INTROSPECTION_GIRS =
if HAVE_INTROSPECTION
Flatpak-1.0.gir: libflatpak.la Makefile
introspected_headers = \
$(flatpakinclude_HEADERS) \
$(nodist_flatpakinclude_HEADERS) \
$(NULL)
introspected_sources = $(filter-out %-private.h,$(sources))
Flatpak_1_0_gir_NAMESPACE = Flatpak
Flatpak_1_0_gir_VERSION = 1.0
Flatpak_1_0_gir_LIBS = libflatpak.la
Flatpak_1_0_gir_FILES = $(introspected_headers) $(introspected_sources)
Flatpak_1_0_gir_CFLAGS = $(libflatpak_la_CFLAGS)
Flatpak_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0
Flatpak_1_0_gir_SCANNERFLAGS = \
--warn-all \
--c-include='flatpak.h' \
--pkg-export=flatpak
INTROSPECTION_GIRS += Flatpak-1.0.gir
girdir = $(datadir)/gir-1.0
nodist_gir_DATA = $(INTROSPECTION_GIRS)
CLEANFILES += $(nodist_gir_DATA)
typelibdir = $(libdir)/girepository-1.0
nodist_typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
CLEANFILES += $(nodist_typelib_DATA)
endif # HAVE_INTROSPECTION

View File

@@ -16,7 +16,6 @@ systemdsystemunit_DATA = system-helper/flatpak-system-helper.service
flatpak_system_helper_SOURCES = \
system-helper/flatpak-system-helper.c \
lib/flatpak-error.c \
$(NULL)
flatpak_system_helper_LDADD = $(BASE_LIBS) $(OSTREE_LIBS) $(JSON_LIBS) $(POLKIT_LIBS) libflatpak-common.la

View File

@@ -29,7 +29,7 @@
#include "flatpak-dbus-generated.h"
#include "flatpak-dir-private.h"
#include "flatpak-oci-registry-private.h"
#include "lib/flatpak-error.h"
#include "flatpak-error.h"
static PolkitAuthority *authority = NULL;
static FlatpakSystemHelper *helper = NULL;