Use libglnx

Starting down the path of not using libgsystem.  The main win here
will be code sharing between ostree/rpm-ostree as well as going down
the path of not using GFile * for local files.
This commit is contained in:
Colin Walters 2015-02-17 17:38:36 -05:00
parent ef53e0100b
commit 965a304a17
13 changed files with 31 additions and 10 deletions

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
# Standard C/Automake goo
.deps
.libs
.dirstamp
*.typelib
*.la
*.lo

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "libglnx"]
path = libglnx
url = https://git.gnome.org/browse/libglnx

View File

@ -106,10 +106,10 @@ libostree_1_la_SOURCES += \
$(NULL)
endif
libostree_1_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree \
libostree_1_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/libglnx -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree \
$(OT_INTERNAL_GIO_UNIX_CFLAGS) $(OT_DEP_LZMA_CFLAGS)
libostree_1_la_LDFLAGS = -version-number 1:0:0 -Bsymbolic-functions -export-symbols-regex '^ostree_'
libostree_1_la_LIBADD = libotutil.la libostree-kernel-args.la $(OT_INTERNAL_GIO_UNIX_LIBS) $(OT_DEP_LZMA_LIBS)
libostree_1_la_LIBADD = libotutil.la libglnx.la libostree-kernel-args.la $(OT_INTERNAL_GIO_UNIX_LIBS) $(OT_DEP_LZMA_LIBS)
if USE_LIBARCHIVE
libostree_1_la_CFLAGS += $(OT_DEP_LIBARCHIVE_CFLAGS)

View File

@ -75,9 +75,9 @@ ostree_SOURCES += \
ostree_bin_shared_cflags = $(AM_CFLAGS) -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -I$(srcdir)/src/ostree \
$(NULL)
ostree_bin_shared_ldadd = libotutil.la libostree-kernel-args.la libostree-1.la
ostree_bin_shared_ldadd = libglnx.la libotutil.la libostree-kernel-args.la libostree-1.la
ostree_CFLAGS = $(ostree_bin_shared_cflags) $(OT_INTERNAL_GIO_UNIX_CFLAGS)
ostree_CFLAGS = $(ostree_bin_shared_cflags) $(OT_INTERNAL_GIO_UNIX_CFLAGS) -I$(srcdir)/libglnx
ostree_LDADD = $(ostree_bin_shared_ldadd) $(OT_INTERNAL_GIO_UNIX_LIBS)
if USE_LIBSOUP

View File

@ -41,5 +41,5 @@ libotutil_la_SOURCES = \
src/libotutil/otutil.c \
src/libotutil/otutil.h \
$(NULL)
libotutil_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/libotutil -DLOCALEDIR=\"$(datadir)/locale\" $(OT_INTERNAL_GIO_UNIX_CFLAGS)
libotutil_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/libglnx -I$(srcdir)/src/libotutil -DLOCALEDIR=\"$(datadir)/locale\" $(OT_INTERNAL_GIO_UNIX_CFLAGS)
libotutil_la_LIBADD = $(OT_INTERNAL_GIO_UNIX_LIBS)

View File

@ -46,6 +46,12 @@ GIRS =
TYPELIBS = $(GIRS:.gir=.typelib)
endif
libglnx_srcpath := $(srcdir)/libglnx
libglnx_cflags := $(OT_DEP_GIO_UNIX_CFLAGS) "-I$(libglnx_srcpath)"
libglnx_libs := $(OT_DEP_GIO_UNIX_LIBS)
include libglnx/Makefile-libglnx.am.inc
noinst_LTLIBRARIES += libglnx.la
include Makefile-otutil.am
include Makefile-libostree.am
include Makefile-ostree.am

View File

@ -28,7 +28,13 @@ else
gtkdocize || exit $?
fi
cd $olddir
if ! test -f libglnx/README.md; then
git submodule update --init
fi
# Workaround automake bug with subdir-objects and computed paths
sed -e 's,$(libglnx_srcpath),'${srcdir}/libglnx, < libglnx/Makefile-libglnx.am >libglnx/Makefile-libglnx.am.inc
autoreconf --force --install --verbose
cd $olddir
test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"

1
libglnx Submodule

@ -0,0 +1 @@
Subproject commit 20b507de5c14df8da678d48f9028fe61340c390d

View File

@ -31,6 +31,7 @@
#include "ostree-chain-input-stream.h"
#include "otutil.h"
#include "libgsystem.h"
#include "libglnx.h"
#define ALIGN_VALUE(this, boundary) \
(( ((unsigned long)(this)) + (((unsigned long)(boundary)) -1)) & (~(((unsigned long)(boundary))-1)))
@ -209,7 +210,7 @@ file_header_new (GFileInfo *file_info,
guint32 mode;
const char *symlink_target;
GVariant *ret;
gs_unref_variant GVariant *tmp_xattrs = NULL;
g_autoptr(GVariant) tmp_xattrs = NULL;
uid = g_file_info_get_attribute_uint32 (file_info, "unix::uid");
gid = g_file_info_get_attribute_uint32 (file_info, "unix::gid");

View File

@ -133,7 +133,7 @@ ot_util_variant_map (GFile *src,
GError **error)
{
gboolean ret = FALSE;
gs_unref_variant GVariant *ret_variant = NULL;
g_autoptr(GVariant) ret_variant = NULL;
GMappedFile *mfile = NULL;
mfile = gs_file_map_noatime (src, NULL, error);

View File

@ -26,6 +26,7 @@
#include <libgsystem.h>
#include <string.h> /* Yeah...let's just do that here. */
#include <gsystem-local-alloc.h>
#include <libglnx.h>
#define ot_gobject_refz(o) (o ? g_object_ref (o) : o)

View File

@ -61,7 +61,7 @@ ot_admin_require_booted_deployment_or_osname (OstreeSysroot *sysroot,
char *
ot_admin_checksum_version (GVariant *checksum)
{
gs_unref_variant GVariant *metadata = NULL;
g_autoptr(GVariant) metadata = NULL;
const char *ret = NULL;
metadata = g_variant_get_child_value (checksum, 0);

View File

@ -27,6 +27,8 @@
#include <stdlib.h>
#include <string.h>
#include <libglnx.h>
#include "ostree.h"
#include "ot-main.h"
#include "otutil.h"
@ -230,7 +232,7 @@ ostree_option_context_parse (GOptionContext *context,
GCancellable *cancellable,
GError **error)
{
gs_unref_object OstreeRepo *repo = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
gboolean success = FALSE;
/* Entries are listed in --help output in the order added. We add the