no-uuid.patch (3825B)
1 diff --git a/libappstream-glib/appstream-glib.pc.in b/libappstream-glib/appstream-glib.pc.in 2 index 872d30d..60abcf6 100644 3 --- a/libappstream-glib/appstream-glib.pc.in 4 +++ b/libappstream-glib/appstream-glib.pc.in 5 @@ -6,7 +6,7 @@ includedir=@includedir@ 6 Name: appstream-glib 7 Description: Objects and helper methods to help reading and writing AppStream metadata 8 Version: @VERSION@ 9 -Requires.private: libarchive uuid 10 +Requires.private: libarchive 11 Requires: glib-2.0, gobject-2.0, gdk-pixbuf-2.0 12 Libs: -L${libdir} -lappstream-glib 13 Cflags: -I${includedir}/libappstream-glib 14 diff --git a/libappstream-glib/as-utils.c b/libappstream-glib/as-utils.c 15 index 007a86b..35fd9d0 100644 16 --- a/libappstream-glib/as-utils.c 17 +++ b/libappstream-glib/as-utils.c 18 @@ -23,13 +23,6 @@ 19 #include <archive.h> 20 #include <libsoup/soup.h> 21 #include <stdlib.h> 22 -#ifndef _WIN32 23 -#ifdef __APPLE__ 24 -#include <uuid/uuid.h> 25 -#else 26 -#include <uuid.h> 27 -#endif 28 -#endif 29 30 #ifdef HAVE_RPM 31 #include <rpm/rpmlib.h> 32 @@ -1531,53 +1524,7 @@ as_utils_guid_from_data (const gchar *namespace_id, 33 gsize data_len, 34 GError **error) 35 { 36 -#ifdef _WIN32 37 - g_set_error_literal (error, 38 - AS_UTILS_ERROR, 39 - AS_UTILS_ERROR_FAILED, 40 - "not supported"); 41 return FALSE; 42 -#else 43 - gchar guid_new[37]; /* 36 plus NUL */ 44 - gsize digestlen = 20; 45 - guint8 hash[20]; 46 - gint rc; 47 - uuid_t uu_namespace; 48 - uuid_t uu_new; 49 - g_autoptr(GChecksum) csum = NULL; 50 - 51 - g_return_val_if_fail (namespace_id != NULL, FALSE); 52 - g_return_val_if_fail (data != NULL, FALSE); 53 - g_return_val_if_fail (data_len != 0, FALSE); 54 - 55 - /* convert the namespace to binary */ 56 - rc = uuid_parse (namespace_id, uu_namespace); 57 - if (rc != 0) { 58 - g_set_error (error, 59 - AS_UTILS_ERROR, 60 - AS_UTILS_ERROR_FAILED, 61 - "namespace '%s' is invalid", 62 - namespace_id); 63 - return FALSE; 64 - } 65 - 66 - /* hash the namespace and then the string */ 67 - csum = g_checksum_new (G_CHECKSUM_SHA1); 68 - g_checksum_update (csum, (guchar *) uu_namespace, 16); 69 - g_checksum_update (csum, (guchar *) data, (gssize) data_len); 70 - g_checksum_get_digest (csum, hash, &digestlen); 71 - 72 - /* copy most parts of the hash 1:1 */ 73 - memcpy (uu_new, hash, 16); 74 - 75 - /* set specific bits according to Section 4.1.3 */ 76 - uu_new[6] = (guint8) ((uu_new[6] & 0x0f) | (5 << 4)); 77 - uu_new[8] = (guint8) ((uu_new[8] & 0x3f) | 0x80); 78 - 79 - /* return as a string */ 80 - uuid_unparse (uu_new, guid_new); 81 - return g_strdup (guid_new); 82 -#endif 83 } 84 85 /** 86 @@ -1593,20 +1540,7 @@ as_utils_guid_from_data (const gchar *namespace_id, 87 gboolean 88 as_utils_guid_is_valid (const gchar *guid) 89 { 90 -#ifdef _WIN32 91 - /* XXX Ideally we should set a GError but this was already a public 92 - * API, and it doesn't have such parameter. 93 - */ 94 - g_printerr ("%s: not supported\n", G_STRFUNC); 95 return FALSE; 96 -#else 97 - gint rc; 98 - uuid_t uu; 99 - if (guid == NULL) 100 - return FALSE; 101 - rc = uuid_parse (guid, uu); 102 - return rc == 0; 103 -#endif 104 } 105 106 /** 107 diff --git a/libappstream-glib/meson.build b/libappstream-glib/meson.build 108 index 715123d..f5beaae 100644 109 --- a/libappstream-glib/meson.build 110 +++ b/libappstream-glib/meson.build 111 @@ -16,7 +16,7 @@ if platform_win32 112 elif platform_osx 113 deps += [giounix] 114 else 115 - deps += [giounix, uuid] 116 + deps += [giounix] 117 endif 118 119 if get_option('dep11') 120 @@ -158,9 +158,6 @@ pkg_req_private = [ 121 'libarchive' 122 ] 123 124 -if not platform_win32 125 - pkg_req_private += ['uuid'] 126 -endif 127 128 pkgg.generate( 129 version : as_version, 130 diff --git a/meson.build b/meson.build 131 index 331dd7a..5ca8750 100644 132 --- a/meson.build 133 +++ b/meson.build 134 @@ -69,7 +69,6 @@ elif platform_osx 135 giounix = dependency('gio-unix-2.0', version : glib_ver) 136 else 137 giounix = dependency('gio-unix-2.0', version : glib_ver) 138 - uuid = dependency('uuid') 139 endif 140 libarchive = dependency('libarchive') 141 soup = dependency('libsoup-2.4', version : '>= 2.51.92')