[tracker/sam/remove-libuuid] Remove libuuid dependency, bump GLib requirement to >= 2.52.0
- From: Sam Thursfield <sthursfield src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/sam/remove-libuuid] Remove libuuid dependency, bump GLib requirement to >= 2.52.0
- Date: Wed, 4 Dec 2019 19:45:38 +0000 (UTC)
commit 4e311b1310a35f88d52f75d4328b519124c82b82
Author: Sam Thursfield <sam afuera me uk>
Date: Wed Dec 4 20:34:38 2019 +0100
Remove libuuid dependency, bump GLib requirement to >= 2.52.0
The functionality that we were using from libuuid is now present in
GLib itself.
Fixes https://gitlab.gnome.org/GNOME/tracker/issues/131
meson.build | 10 +---------
src/libtracker-data/meson.build | 2 +-
src/libtracker-data/tracker-uuid.c | 13 -------------
src/libtracker-sparql/meson.build | 6 ++----
src/libtracker-sparql/tracker-utils.vala | 14 +-------------
5 files changed, 5 insertions(+), 40 deletions(-)
---
diff --git a/meson.build b/meson.build
index 376c0784c..844e4728e 100644
--- a/meson.build
+++ b/meson.build
@@ -24,7 +24,7 @@ libversion = '@0@.@1@.@2@'.format(soversion, tracker_binary_age - tracker_interf
libdir = join_paths(get_option('prefix'), get_option('libdir'))
datadir = join_paths(get_option('prefix'), get_option('datadir'))
-glib_required = '2.46.0'
+glib_required = '2.52.0'
# 3.6.11 for sqlite_backup API
# 3.6.16 to fix test failures
@@ -51,14 +51,6 @@ sqlite = dependency('sqlite3', version: '>' + sqlite_required)
libmath = cc.find_library('m', required: false)
-# FIXME: here we work around a quirk todo with Meson and Vala: the 'uuid'
-# pkg-config component corresponds to 'libuuid.vapi', but Meson assumes that
-# .vapi name always matches pkg-config name, and will add `--pkg uuid` to the
-# Vala commandline. By finding 'uuid' using find_library() instead, we get
-# a dependency object back that won't cause any `--pkg` arguments to be added
-# to the Vala commandline, but still works as expected for C code.
-uuid = cc.find_library('uuid')
-
add_project_arguments('-Wformat', '-Wformat-security', language: 'c')
# There are various gchar vs. unsigned char warnings that occur in extract
diff --git a/src/libtracker-data/meson.build b/src/libtracker-data/meson.build
index 4f40c1fcc..1ef30f709 100644
--- a/src/libtracker-data/meson.build
+++ b/src/libtracker-data/meson.build
@@ -28,7 +28,7 @@ tracker_data_enums = gnome.mkenums('tracker-data-enum-types',
)
tracker_data_dependencies = [
- tracker_common_dep, gvdb_dep, sqlite, uuid,
+ tracker_common_dep, gvdb_dep, sqlite,
]
if get_option('fts')
diff --git a/src/libtracker-data/tracker-uuid.c b/src/libtracker-data/tracker-uuid.c
index f2b18967a..7717dfed5 100644
--- a/src/libtracker-data/tracker-uuid.c
+++ b/src/libtracker-data/tracker-uuid.c
@@ -23,24 +23,11 @@
#define DEFAULT_PREFIX "urn:uuid"
-#if ! GLIB_CHECK_VERSION (2, 52, 0)
-#include <uuid/uuid.h>
-#endif
-
gchar *
tracker_generate_uuid (const gchar *uri_prefix)
{
gchar *result;
-#if GLIB_CHECK_VERSION (2, 52, 0)
result = g_uuid_string_random ();
-#else
- uuid_t base = { 0, };
- gchar uuid[37];
-
- uuid_generate (base);
- uuid_unparse_lower (base, uuid);
- result = g_strdup_printf (uuid);
-#endif
if (uri_prefix) {
gchar *uri;
diff --git a/src/libtracker-sparql/meson.build b/src/libtracker-sparql/meson.build
index 2bd750f36..971d39bf3 100644
--- a/src/libtracker-sparql/meson.build
+++ b/src/libtracker-sparql/meson.build
@@ -7,8 +7,6 @@ enums_h = gnome.mkenums('tracker-sparql-enum-types',
h_template: 'tracker-sparql-enum-types.h.template',
)
-tracker_sparql_intermediate_dependencies = [uuid]
-
# First build the Vala parts ...
libtracker_sparql_c_vapi = files('libtracker-sparql-intermediate-c.vapi')
libtracker_sparql_c_vapi_dep = meson.get_compiler('vala').find_library('libtracker-sparql-intermediate-c',
dirs: meson.current_source_dir())
@@ -32,7 +30,7 @@ libtracker_sparql_intermediate_vala = static_library('tracker-sparql-intermediat
'--target-glib', glib_required,
libtracker_sparql_c_vapi
],
- dependencies: [tracker_common_dep] + tracker_sparql_intermediate_dependencies,
+ dependencies: [tracker_common_dep],
include_directories: [commoninc, configinc, srcinc],
)
@@ -86,7 +84,7 @@ tracker_sparql_intermediate_dep = declare_dependency(
link_with: [libtracker_sparql_intermediate_c, libtracker_sparql_intermediate_vala],
sources: tracker_sparql_generated_header,
include_directories: [srcinc, include_directories('.')],
- dependencies: [ tracker_sparql_intermediate_dependencies, libtracker_sparql_c_vapi_dep ],
+ dependencies: [ libtracker_sparql_c_vapi_dep ],
)
install_headers(
diff --git a/src/libtracker-sparql/tracker-utils.vala b/src/libtracker-sparql/tracker-utils.vala
index a4664abf0..2dd2484a0 100644
--- a/src/libtracker-sparql/tracker-utils.vala
+++ b/src/libtracker-sparql/tracker-utils.vala
@@ -95,12 +95,6 @@ namespace Tracker.Sparql {
return str.str;
}
- [CCode (cname = "uuid_generate")]
- private extern static void uuid_generate ([CCode (array_length = false)] uchar[] uuid);
-
- [CCode (cname = "uuid_unparse_lower")]
- private extern static void uuid_unparse_lower ([CCode (array_length = false)] uchar[] uuid, char*
out);
-
/**
* tracker_sparql_get_uuid_urn:
*
@@ -115,13 +109,7 @@ namespace Tracker.Sparql {
* Since: 0.10
*/
public string get_uuid_urn () {
- uchar[] base_uuid = new uchar[16];
- string lower = (string) new char[37];
-
- uuid_generate (base_uuid);
- uuid_unparse_lower (base_uuid, (char *) lower);
-
// generate uuid
- return "urn:uuid:%s".printf (lower);
+ return "urn:uuid:%s".printf (GLib.Uuid.string_random ());
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]