Accepting request 1069617 from home:iznogood:branches:Application:Geo

- Update to version 2.7.0:
  + Multiple config files named *.conf are now read from the config
    directory at @sysconfdir@/geoclue/conf.d.
  + HTTP requests are now made via libsoup3.0 instead of
    libsoup2.4.
  + A static location can now be set in @sysconfdir@/geolocation
    for immobile systems.
  + Web source requests are now submitted with combined WiFi and
    3GPP tower data.
  + Web source now checks connectivity in a way that allows
    location and submission servers running on localhost.
  + Web source submissions are now made using /v2/geosubmit API.
  + Web source cell tower submissions now have the correct radio
    type.
  + Web source requests now submit the BSS age property.
  + Web source submissions now contain the location speed.
  + Web source cache now respects WiFi signal tolerance strictly.
  + NMEA source now supports both '\n' and '\r' NMEA delimiters.
  + NMEA source can now be made the Web source submit source.
  + ModemManager now use signaled calls to get cached location
    information to avoid performing explicit modem query.
  + Location description now contains information about its source.
  + GSettings backend no longer complains about being run from a
    read-only filesystem.
  + Many small improvements and fixes, some memory safety related.
- Drop 129.patch: Fixed upstream.

OBS-URL: https://build.opensuse.org/request/show/1069617
OBS-URL: https://build.opensuse.org/package/show/Application:Geo/geoclue2?expand=0&rev=99
This commit is contained in:
Luciano Santos 2023-03-07 01:51:53 +00:00 committed by Git OBS Bridge
parent f4ae2bee0f
commit f9389eb7a3
5 changed files with 35 additions and 353 deletions

346
129.patch
View File

@ -1,346 +0,0 @@
From 9c46c38096193988103bf4c2fa63d76b55e5b1d0 Mon Sep 17 00:00:00 2001
From: Carlos Garcia Campos <cgarcia@igalia.com>
Date: Tue, 23 Mar 2021 13:00:00 +0100
Subject: [PATCH 1/2] Add support for building with libsoup3
Remove soup2 build option, based on
https://gitlab.freedesktop.org/geoclue/geoclue/-/merge_requests/83
Original commit message:
Add soup2 build option, enabled by default. When disabled, libsoup3 will
be used instead.
---
src/gclue-mozilla.c | 20 ++++---
src/gclue-web-source.c | 120 ++++++++++++++++++++++-------------------
src/meson.build | 2 +-
3 files changed, 74 insertions(+), 68 deletions(-)
diff --git a/src/gclue-mozilla.c b/src/gclue-mozilla.c
index 8e602c1..3ee02c8 100644
--- a/src/gclue-mozilla.c
+++ b/src/gclue-mozilla.c
@@ -151,6 +151,7 @@ gclue_mozilla_create_query (GList *bss_list, /* As in Access Points */
guint n_non_ignored_bsss;
GList *iter;
gint64 mcc, mnc;
+ g_autoptr(GBytes) body = NULL;
builder = json_builder_new ();
json_builder_begin_object (builder);
@@ -238,11 +239,8 @@ gclue_mozilla_create_query (GList *bss_list, /* As in Access Points */
uri = get_url ();
ret = soup_message_new ("POST", uri);
- soup_message_set_request (ret,
- "application/json",
- SOUP_MEMORY_TAKE,
- data,
- data_len);
+ body = g_bytes_new_take (data, data_len);
+ soup_message_set_request_body_from_bytes (ret, "application/json", body);
g_debug ("Sending following request to '%s':\n%s", uri, data);
return ret;
@@ -322,6 +320,7 @@ gclue_mozilla_create_submit_query (GClueLocation *location,
GError **error)
{
SoupMessage *ret = NULL;
+ SoupMessageHeaders *request_headers;
JsonBuilder *builder;
JsonGenerator *generator;
JsonNode *root_node;
@@ -332,6 +331,7 @@ gclue_mozilla_create_submit_query (GClueLocation *location,
gdouble lat, lon, accuracy, altitude;
GDateTime *datetime;
gint64 mcc, mnc;
+ g_autoptr(GBytes) body = NULL;
url = get_submit_config (&nick);
if (url == NULL)
@@ -448,15 +448,13 @@ gclue_mozilla_create_submit_query (GClueLocation *location,
g_object_unref (generator);
ret = soup_message_new ("POST", url);
+ request_headers = soup_message_get_request_headers (ret);
if (nick != NULL && nick[0] != '\0')
- soup_message_headers_append (ret->request_headers,
+ soup_message_headers_append (request_headers,
"X-Nickname",
nick);
- soup_message_set_request (ret,
- "application/json",
- SOUP_MEMORY_TAKE,
- data,
- data_len);
+ body = g_bytes_new_take (data, data_len);
+ soup_message_set_request_body_from_bytes (ret, "application/json", body);
g_debug ("Sending following request to '%s':\n%s", url, data);
out:
diff --git a/src/gclue-web-source.c b/src/gclue-web-source.c
index bfd70f7..2c98f99 100644
--- a/src/gclue-web-source.c
+++ b/src/gclue-web-source.c
@@ -59,9 +59,9 @@ G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GClueWebSource,
GCLUE_TYPE_LOCATION_SOURCE,
G_ADD_PRIVATE (GClueWebSource))
-static void refresh_callback (SoupSession *session,
- SoupMessage *query,
- gpointer user_data);
+static void refresh_callback (SoupSession *session,
+ GAsyncResult *result,
+ gpointer user_data);
static void
gclue_web_source_real_refresh_async (GClueWebSource *source,
@@ -103,44 +103,48 @@ gclue_web_source_real_refresh_async (GClueWebSource *source,
return;
}
- /* TODO handle cancellation */
- soup_session_queue_message (source->priv->soup_session,
- source->priv->query,
- refresh_callback,
- g_steal_pointer (&task));
+ soup_session_send_and_read_async (source->priv->soup_session,
+ source->priv->query,
+ G_PRIORITY_DEFAULT,
+ cancellable,
+ (GAsyncReadyCallback)refresh_callback,
+ g_steal_pointer (&task));
}
static void
-refresh_callback (SoupSession *session,
- SoupMessage *query,
- gpointer user_data)
+refresh_callback (SoupSession *session,
+ GAsyncResult *result,
+ gpointer user_data)
{
g_autoptr(GTask) task = g_steal_pointer (&user_data);
GClueWebSource *web;
+ g_autoptr(SoupMessage) query = NULL;
+ g_autoptr(GBytes) body = NULL;
g_autoptr(GError) local_error = NULL;
g_autofree char *contents = NULL;
g_autofree char *str = NULL;
g_autoptr(GClueLocation) location = NULL;
- SoupURI *uri;
+ GUri *uri;
- if (query->status_code == SOUP_STATUS_CANCELLED) {
- g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_CANCELLED,
- "Operation cancelled");
+ web = GCLUE_WEB_SOURCE (g_task_get_source_object (task));
+ query = g_steal_pointer (&web->priv->query);
+
+ body = soup_session_send_and_read_finish (session, result, &local_error);
+ if (!body) {
+ g_task_return_error (task, g_steal_pointer (&local_error));
return;
}
- web = GCLUE_WEB_SOURCE (g_task_get_source_object (task));
- web->priv->query = NULL;
-
- if (query->status_code != SOUP_STATUS_OK) {
+ if (soup_message_get_status (query) != SOUP_STATUS_OK) {
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
- "Failed to query location: %s", query->reason_phrase);
+ "Failed to query location: %s",
+ soup_message_get_reason_phrase (query));
return;
}
- contents = g_strndup (query->response_body->data, query->response_body->length);
+ contents = g_strndup (g_bytes_get_data (body, NULL), g_bytes_get_size (body));
uri = soup_message_get_uri (query);
- str = soup_uri_to_string (uri, FALSE);
+ str = g_uri_to_string (uri);
g_debug ("Got following response from '%s':\n%s", str, contents);
location = GCLUE_WEB_SOURCE_GET_CLASS (web)->parse_response (web, contents, &local_error);
if (local_error != NULL) {
@@ -253,15 +257,12 @@ gclue_web_source_finalize (GObject *gsource)
priv->connectivity_changed_id = 0;
}
- if (priv->query != NULL) {
- g_debug ("Cancelling query");
- soup_session_cancel_message (priv->soup_session,
- priv->query,
- SOUP_STATUS_CANCELLED);
- priv->query = NULL;
- }
+ g_clear_object (&priv->query);
- g_clear_object (&priv->soup_session);
+ if (priv->soup_session) {
+ soup_session_abort (priv->soup_session);
+ g_object_unref (priv->soup_session);
+ }
G_OBJECT_CLASS (gclue_web_source_parent_class)->finalize (gsource);
}
@@ -274,10 +275,8 @@ gclue_web_source_constructed (GObject *object)
G_OBJECT_CLASS (gclue_web_source_parent_class)->constructed (object);
- priv->soup_session = soup_session_new_with_options
- (SOUP_SESSION_REMOVE_FEATURE_BY_TYPE,
- SOUP_TYPE_PROXY_RESOLVER_DEFAULT,
- NULL);
+ priv->soup_session = soup_session_new ();
+ soup_session_remove_feature_by_type (priv->soup_session, G_TYPE_PROXY_RESOLVER);
monitor = g_network_monitor_get_default ();
priv->network_changed_id =
@@ -330,25 +329,33 @@ gclue_web_source_refresh (GClueWebSource *source)
}
static void
-submit_query_callback (SoupSession *session,
- SoupMessage *query,
- gpointer user_data)
+submit_query_callback (SoupSession *session,
+ GAsyncResult *result)
{
- SoupURI *uri;
- g_autofree char *str = NULL;
+ g_autoptr(GBytes) body = NULL;
+ g_autoptr(GError) local_error = NULL;
+ SoupMessage *query;
+ g_autofree char *uri_str = NULL;
+ gint status_code;
- uri = soup_message_get_uri (query);
- str = soup_uri_to_string (uri, FALSE);
- if (query->status_code != SOUP_STATUS_OK &&
- query->status_code != SOUP_STATUS_NO_CONTENT) {
+ query = soup_session_get_async_result_message (session, result);
+ uri_str = g_uri_to_string (soup_message_get_uri (query));
+
+ body = soup_session_send_and_read_finish (session, result, &local_error);
+ if (!body) {
g_warning ("Failed to submit location data to '%s': %s",
- str,
- query->reason_phrase);
- return;
- }
+ uri_str, local_error->message);
+ return;
+ }
- g_debug ("Successfully submitted location data to '%s'",
- str);
+ status_code = soup_message_get_status (query);
+ if (status_code != SOUP_STATUS_OK && status_code != SOUP_STATUS_NO_CONTENT) {
+ g_warning ("Failed to submit location data to '%s': %s",
+ uri_str, soup_message_get_reason_phrase (query));
+ return;
+ }
+
+ g_debug ("Successfully submitted location data to '%s'", uri_str);
}
#define SUBMISSION_ACCURACY_THRESHOLD 100
@@ -362,8 +369,8 @@ on_submit_source_location_notify (GObject *source_object,
GClueLocationSource *source = GCLUE_LOCATION_SOURCE (source_object);
GClueWebSource *web = GCLUE_WEB_SOURCE (user_data);
GClueLocation *location;
- SoupMessage *query;
- GError *error = NULL;
+ g_autoptr(SoupMessage) query = NULL;
+ g_autoptr(GError) error = NULL;
location = gclue_location_source_get_location (source);
if (location == NULL ||
@@ -386,16 +393,17 @@ on_submit_source_location_notify (GObject *source_object,
if (error != NULL) {
g_warning ("Failed to create submission query: %s",
error->message);
- g_error_free (error);
}
return;
}
- soup_session_queue_message (web->priv->soup_session,
- query,
- submit_query_callback,
- web);
+ soup_session_send_and_read_async (web->priv->soup_session,
+ query,
+ G_PRIORITY_DEFAULT,
+ NULL,
+ (GAsyncReadyCallback)submit_query_callback,
+ web);
}
/**
diff --git a/src/meson.build b/src/meson.build
index 13eb1ba..1c55b3b 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,5 +1,5 @@
geoclue_deps = base_deps + [ dependency('json-glib-1.0', version: '>= 0.14.0'),
- dependency('libsoup-2.4', version: '>= 2.42.0') ]
+ dependency('libsoup-3.0', version: '>= 3.0.0') ]
sources = [ libgeoclue_public_api_gen_sources[1],
geoclue_iface_sources,
--
GitLab
From c5ce6de3a2a4faaba38910a85348f05a8d1f6a70 Mon Sep 17 00:00:00 2001
From: Maximiliano Sandoval R <msandova@protonmail.com>
Date: Tue, 31 May 2022 16:03:43 +0200
Subject: [PATCH 2/2] ci: Switch to Ubuntu 22.04 & install libsoup3
---
.gitlab-ci.yml | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index bea3b69..b7a15cb 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,25 +4,26 @@ before_script:
- apt-get install --yes git gobject-introspection libmm-glib-dev wget valac
- apt-get install --yes libnotify-dev xsltproc gtk-doc-tools python3-pip
- apt-get install --yes ninja-build gettext modemmanager-dev
+ - DEBIAN_FRONTEND=noninteractive apt-get install --yes libsoup-3.0
- pip3 install meson==0.53.2
# Ubuntu 14.04 is not supported, see README for details
#
-ubuntu-18.04:
- image: ubuntu:bionic
+ubuntu-22.04:
+ image: ubuntu:22.04
artifacts:
when: always
- name: "bionic-${CI_COMMIT_REF_NAME}"
+ name: "jammy-${CI_COMMIT_REF_NAME}"
paths:
- "${CI_PROJECT_DIR}/build"
script: meson build && ninja -C build && ninja -C build test && ninja -C build install
-ubuntu-18.04-no-backend:
- image: ubuntu:bionic
+ubuntu-22.04-no-backend:
+ image: ubuntu:22.04
artifacts:
when: always
- name: "bionic-no-backend-${CI_COMMIT_REF_NAME}"
+ name: "jammy-no-backend-${CI_COMMIT_REF_NAME}"
paths:
- "${CI_PROJECT_DIR}/build"
script: meson -Denable-backend=false build && ninja -C build && ninja -C build test && ninja -C build install
--
GitLab

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:cdc9efcb98ce81284d7a6c3c899330481ffdca44bba3c18b9e530618298aa4a0
size 94890

3
geoclue-2.7.0.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1dce8e573cd338bc87a5bd725f89a6f543fac838e2a5d832515cb5ea0d86cf40
size 105353

View File

@ -1,3 +1,33 @@
-------------------------------------------------------------------
Mon Mar 6 11:59:58 UTC 2023 - Bjørn Lie <bjorn.lie@gmail.com>
- Update to version 2.7.0:
+ Multiple config files named *.conf are now read from the config
directory at @sysconfdir@/geoclue/conf.d.
+ HTTP requests are now made via libsoup3.0 instead of
libsoup2.4.
+ A static location can now be set in @sysconfdir@/geolocation
for immobile systems.
+ Web source requests are now submitted with combined WiFi and
3GPP tower data.
+ Web source now checks connectivity in a way that allows
location and submission servers running on localhost.
+ Web source submissions are now made using /v2/geosubmit API.
+ Web source cell tower submissions now have the correct radio
type.
+ Web source requests now submit the BSS age property.
+ Web source submissions now contain the location speed.
+ Web source cache now respects WiFi signal tolerance strictly.
+ NMEA source now supports both '\n' and '\r' NMEA delimiters.
+ NMEA source can now be made the Web source submit source.
+ ModemManager now use signaled calls to get cached location
information to avoid performing explicit modem query.
+ Location description now contains information about its source.
+ GSettings backend no longer complains about being run from a
read-only filesystem.
+ Many small improvements and fixes, some memory safety related.
- Drop 129.patch: Fixed upstream.
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Oct 5 13:46:12 UTC 2022 - Callum Farmer <gmbr3@opensuse.org> Wed Oct 5 13:46:12 UTC 2022 - Callum Farmer <gmbr3@opensuse.org>

View File

@ -1,7 +1,7 @@
# #
# spec file for package geoclue2 # spec file for package geoclue2
# #
# Copyright (c) 2022 SUSE LLC # Copyright (c) 2023 SUSE LLC
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -19,7 +19,7 @@
%define _name geoclue %define _name geoclue
Name: geoclue2 Name: geoclue2
Version: 2.6.0 Version: 2.7.0
Release: 0 Release: 0
Summary: GeoLocation Framework Summary: GeoLocation Framework
License: GPL-2.0-or-later License: GPL-2.0-or-later
@ -28,8 +28,6 @@ URL: https://gitlab.freedesktop.org/geoclue/geoclue
Source0: %{url}/-/archive/%{version}/geoclue-%{version}.tar.bz2 Source0: %{url}/-/archive/%{version}/geoclue-%{version}.tar.bz2
Source1: srvGeoClue.conf Source1: srvGeoClue.conf
Source99: geoclue2-rpmlintrc Source99: geoclue2-rpmlintrc
# PATCH-FIX-UPSTREAM 129.patch -- Port to use soup3
Patch0: https://gitlab.freedesktop.org/geoclue/geoclue/-/merge_requests/129.patch
BuildRequires: intltool >= 0.40.0 BuildRequires: intltool >= 0.40.0
BuildRequires: meson >= 0.47.2 BuildRequires: meson >= 0.47.2