Final excision of libgsystem dependency

Lots and lots of preparation led to this moment - when nothing
apparent changes for users!  Woo!

But seriously, having the extra dependency is a minor annoyance, and
in the big picture I think the libgsystem idea was wrong - we need to
land things in GLib, and use git submodules for API-unstable or
Linux-specific sharing.  For a lot of OSTree, the libgsystem `GFile*`
orientation was also wrong, we really want fd-relative.

Closes: #444
Approved by: jlebon
This commit is contained in:
Colin Walters 2016-06-22 20:12:31 -04:00 committed by Atomic Bot
parent fd9536bb19
commit a29bb0ab6b
11 changed files with 50 additions and 29 deletions

View File

@ -54,7 +54,7 @@ AM_PATH_GLIB_2_0
dnl When bumping the gio-unix-2.0 dependency (or glib-2.0 in general),
dnl remember to bump GLIB_VERSION_MIN_REQUIRED and
dnl GLIB_VERSION_MAX_ALLOWED in Makefile.am
GIO_DEPENDENCY="gio-unix-2.0 >= 2.40.0 libgsystem >= 2015.1"
GIO_DEPENDENCY="gio-unix-2.0 >= 2.40.0"
PKG_CHECK_MODULES(OT_DEP_GIO_UNIX, $GIO_DEPENDENCY)
dnl 5.1.0 is an arbitrary version here

@ -1 +1 @@
Subproject commit 871617d51984604e28483d959e37fd6ce4524b0e
Subproject commit 4ae5e3beaaa674abfabf7404ab6fafcc4ec547db

View File

@ -15,7 +15,6 @@ BuildRequires: gtk-doc
# Core requirements
BuildRequires: pkgconfig(gio-unix-2.0)
BuildRequires: pkgconfig(libsoup-2.4)
BuildRequires: pkgconfig(libgsystem)
BuildRequires: pkgconfig(e2p)
# Extras
BuildRequires: pkgconfig(libarchive)

View File

@ -21,7 +21,6 @@
#include "config.h"
#include "ot-fs-utils.h"
#include "libgsystem.h"
#include "libglnx.h"
#include <sys/xattr.h>
#include <gio/gunixinputstream.h>

View File

@ -463,3 +463,39 @@ ot_file_enumerator_iterate (GFileEnumerator *direnum,
}
#endif
G_LOCK_DEFINE_STATIC (pathname_cache);
/**
* ot_file_get_path_cached:
*
* Like g_file_get_path(), but returns a constant copy so callers
* don't need to free the result.
*/
const char *
ot_file_get_path_cached (GFile *file)
{
const char *path;
static GQuark _file_path_quark = 0;
if (G_UNLIKELY (_file_path_quark) == 0)
_file_path_quark = g_quark_from_static_string ("gsystem-file-path");
G_LOCK (pathname_cache);
path = g_object_get_qdata ((GObject*)file, _file_path_quark);
if (!path)
{
path = g_file_get_path (file);
if (path == NULL)
{
G_UNLOCK (pathname_cache);
return NULL;
}
g_object_set_qdata_full ((GObject*)file, _file_path_quark, (char*)path, (GDestroyNotify)g_free);
}
G_UNLOCK (pathname_cache);
return path;
}

View File

@ -115,4 +115,14 @@ ot_file_enumerator_iterate (GFileEnumerator *direnum,
#endif
#define g_file_enumerator_iterate ot_file_enumerator_iterate
const char *
ot_file_get_path_cached (GFile *file);
static inline
const char *
gs_file_get_path_cached (GFile *file)
{
return ot_file_get_path_cached (file);
}
G_END_DECLS

View File

@ -23,9 +23,7 @@
#pragma once
#include <gio/gio.h>
#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

@ -23,8 +23,8 @@
#include "config.h"
#include "libglnx.h"
#include "otutil.h"
#include "ot-editor.h"
#include "libgsystem.h"
#include <sys/wait.h>
#include <string.h>

View File

@ -31,25 +31,6 @@ case "$ci_distro" in
;;
esac
case "$ci_suite" in
(jessie)
# Add alexl's Debian 8 backport repository to get libgsystem
# TODO: remove this when libgsystem is no longer needed
$sudo apt-get -y update
$sudo apt-get -y install apt-transport-https wget
wget -O - https://sdk.gnome.org/apt/debian/conf/alexl.gpg.key | $sudo apt-key add -
echo "deb [arch=amd64] https://sdk.gnome.org/apt/debian/ jessie main" | $sudo tee /etc/apt/sources.list.d/flatpak.list
;;
(trusty|xenial)
# Add alexl's Flatpak PPA, again to get libgsystem
# TODO: remove this when libgsystem is no longer needed
$sudo apt-get -y update
$sudo apt-get -y install software-properties-common
$sudo add-apt-repository --yes ppa:alexlarsson/flatpak
;;
esac
case "$ci_distro" in
(debian|ubuntu)
# TODO: fetch this list from the Debian packaging git repository?
@ -77,7 +58,6 @@ case "$ci_distro" in
libgirepository1.0-dev \
libglib2.0-dev \
libgpgme11-dev \
libgsystem-dev \
liblzma-dev \
libmount-dev \
libselinux1-dev \

View File

@ -21,7 +21,6 @@
#include "config.h"
#include "libglnx.h"
#include "libgsystem.h"
#include <glib.h>
#include <stdlib.h>
#include <gio/gio.h>

View File

@ -20,8 +20,8 @@
#include "config.h"
#include <libgsystem.h>
#include <gpgme.h>
#include "libglnx.h"
#include "ostree-gpg-verify-result-private.h"