[packages/geoclue] - enhanced gpsd patch to cover gpsd 3.18-3.19 - added nm patch (switch NetworkManager interface to l
qboosh
qboosh at pld-linux.org
Sat Oct 5 15:45:40 CEST 2019
commit f2294add01406e3b4c80cec20c05752b69f0e8e3
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Sat Oct 5 15:48:55 2019 +0200
- enhanced gpsd patch to cover gpsd 3.18-3.19
- added nm patch (switch NetworkManager interface to libnm to support NM 1.0-1.20)
- release 6
geoclue-gpsd.patch | 102 ++++++++++++++++++++++++++++++++++++++++
geoclue-nm.patch | 135 +++++++++++++++++++++++++++++++++++++++++++++++++++++
geoclue.spec | 20 ++++++--
3 files changed, 252 insertions(+), 5 deletions(-)
---
diff --git a/geoclue.spec b/geoclue.spec
index 3685775..58edad2 100644
--- a/geoclue.spec
+++ b/geoclue.spec
@@ -1,12 +1,15 @@
#
# Conditional build:
%bcond_without gps # GPS support via gpsd
+%bcond_with conic # Maemo LibConIC connectivity support
+%bcond_with connman # ConnMan connectivity support
+%bcond_without nm # NetworkManager connectivity support
Summary: A modular geoinformation service
Summary(pl.UTF-8): Modularna usługa geoinformacyjna
Name: geoclue
Version: 0.12.99
-Release: 5
+Release: 6
License: LGPL v2+
Group: Applications
Source0: http://freedesktop.org/~hadess/%{name}-%{version}.tar.gz
@@ -14,21 +17,26 @@ Source0: http://freedesktop.org/~hadess/%{name}-%{version}.tar.gz
Patch0: %{name}-libsoup.patch
Patch1: %{name}-gpsd.patch
Patch2: %{name}-format.patch
+Patch3: %{name}-nm.patch
URL: http://geoclue.freedesktop.org/
BuildRequires: GConf2-devel >= 2.0
+%{?with_nm:BuildRequires: NetworkManager-devel >= 1.0}
BuildRequires: autoconf >= 2.59
BuildRequires: automake >= 1:1.9
+%{?with_connman:BuildRequires: connman-devel}
BuildRequires: dbus-glib-devel >= 0.86
BuildRequires: docbook-dtd412-xml
BuildRequires: glib2-devel >= 1:2.26
-%{?with_gps:BuildRequires: gpsd-devel >= 3}
+%{?with_gps:BuildRequires: gpsd-devel >= 3.18}
BuildRequires: gtk+2-devel >= 1:2.0
BuildRequires: gtk-doc >= 1.0
BuildRequires: gypsy-devel >= 0.7.1
+%{?with_conic:BuildRequires: libconic-devel}
BuildRequires: libsoup-devel >= 2.4.0
BuildRequires: libtool
BuildRequires: libxml2-devel >= 2.0
BuildRequires: libxslt-progs
+BuildRequires: pkgconfig
Requires: %{name}-libs = %{version}-%{release}
Requires: dbus
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -104,7 +112,7 @@ Summary: gpsd provider for geoclue
Summary(pl.UTF-8): Interfejs geoclue do gpsd
Group: Applications
Requires: %{name} = %{version}-%{release}
-Requires: gpsd >= 3
+Requires: gpsd >= 3.18
%description gpsd
A gpsd provider for geoclue.
@@ -130,6 +138,7 @@ Interfejs geoclue do gypsy.
%patch0 -p1
%patch1 -p1
%patch2 -p1
+%patch3 -p1
%build
%{__gtkdocize}
@@ -140,10 +149,11 @@ Interfejs geoclue do gypsy.
%{__automake}
%configure \
--enable-gtk-doc \
- --disable-conic \
+ --enable-conic%{!?with_conic:=no} \
+ --enable-connman%{!?with_connman:=no} \
--enable-gpsd%{!?with_gps:=no} \
--enable-gypsy \
- --disable-networkmanager \
+ --enable-networkmanager%{!?with_nm:=no} \
--disable-silent-rules \
--enable-skyhook \
--with-html-dir=%{_gtkdocdir}
diff --git a/geoclue-gpsd.patch b/geoclue-gpsd.patch
index e5e6877..51a3b5e 100644
--- a/geoclue-gpsd.patch
+++ b/geoclue-gpsd.patch
@@ -58,3 +58,105 @@
}
}
return TRUE;
+--- geoclue-0.12.99/providers/gpsd/geoclue-gpsd.c.orig 2019-10-04 21:09:50.492270776 +0200
++++ geoclue-0.12.99/providers/gpsd/geoclue-gpsd.c 2019-10-05 15:21:29.244100259 +0200
+@@ -43,15 +43,6 @@
+
+ typedef struct gps_fix_t gps_fix;
+
+-/* only listing used tags */
+-typedef enum {
+- NMEA_NONE,
+- NMEA_GSA,
+- NMEA_GGA,
+- NMEA_GSV,
+- NMEA_RMC
+-} NmeaTag;
+-
+
+ typedef struct {
+ GcProvider parent;
+@@ -229,7 +220,7 @@
+ }
+
+ static void
+-geoclue_gpsd_update_position (GeoclueGpsd *gpsd, NmeaTag nmea_tag)
++geoclue_gpsd_update_position (GeoclueGpsd *gpsd)
+ {
+ gps_fix *fix = &gpsd->gpsdata->fix;
+ gps_fix *last_fix = gpsd->last_fix;
+@@ -280,7 +271,7 @@
+ }
+
+ static void
+-geoclue_gpsd_update_velocity (GeoclueGpsd *gpsd, NmeaTag nmea_tag)
++geoclue_gpsd_update_velocity (GeoclueGpsd *gpsd)
+ {
+ gps_fix *fix = &gpsd->gpsdata->fix;
+ gps_fix *last_fix = gpsd->last_fix;
+@@ -293,8 +284,7 @@
+ * couldn't think of an smart way to handle this, I don't think there is one
+ */
+
+- if (((gpsd->gpsdata->set & TRACK_SET) || (gpsd->gpsdata->set & SPEED_SET)) &&
+- nmea_tag == NMEA_RMC) {
++ if (((gpsd->gpsdata->set & TRACK_SET) || (gpsd->gpsdata->set & SPEED_SET))) {
+
+ gpsd->gpsdata->set &= ~(TRACK_SET | SPEED_SET);
+
+@@ -308,10 +298,7 @@
+ last_fix->track = fix->track;
+ last_fix->speed = fix->speed;
+ }
+- } else if ((gpsd->gpsdata->set & CLIMB_SET) &&
+- (nmea_tag == NMEA_GGA ||
+- nmea_tag == NMEA_GSA ||
+- nmea_tag == NMEA_GSV)) {
++ } else if ((gpsd->gpsdata->set & CLIMB_SET)) {
+
+ gpsd->gpsdata->set &= ~(CLIMB_SET);
+
+@@ -342,7 +329,7 @@
+ }
+
+ static void
+-geoclue_gpsd_update_status (GeoclueGpsd *gpsd, NmeaTag nmea_tag)
++geoclue_gpsd_update_status (GeoclueGpsd *gpsd)
+ {
+ GeoclueStatus status;
+
+@@ -367,22 +354,9 @@
+ static void
+ gpsd_raw_hook (struct gps_data_t *gpsdata, char *message, size_t len)
+ {
+- char *tag_str = gpsd->gpsdata->tag;
+- NmeaTag nmea_tag = NMEA_NONE;
+-
+- if (tag_str[0] == 'G' && tag_str[1] == 'S' && tag_str[2] == 'A') {
+- nmea_tag = NMEA_GSA;
+- } else if (tag_str[0] == 'G' && tag_str[1] == 'G' && tag_str[2] == 'A') {
+- nmea_tag = NMEA_GGA;
+- } else if (tag_str[0] == 'G' && tag_str[1] == 'S' && tag_str[2] == 'V') {
+- nmea_tag = NMEA_GSV;
+- } else if (tag_str[0] == 'R' && tag_str[1] == 'M' && tag_str[2] == 'C') {
+- nmea_tag = NMEA_RMC;
+- }
+-
+- geoclue_gpsd_update_status (gpsd, nmea_tag);
+- geoclue_gpsd_update_position (gpsd, nmea_tag);
+- geoclue_gpsd_update_velocity (gpsd, nmea_tag);
++ geoclue_gpsd_update_status (gpsd);
++ geoclue_gpsd_update_position (gpsd);
++ geoclue_gpsd_update_velocity (gpsd);
+ }
+
+ static void
+@@ -414,7 +388,7 @@
+ {
+ GeoclueGpsd *self = (GeoclueGpsd*)data;
+ if (self->gpsdata) {
+- if (gps_read(self->gpsdata) < 0) {
++ if (gps_read(self->gpsdata, NULL, 0) < 0) {
+ geoclue_gpsd_set_status (self, GEOCLUE_STATUS_ERROR);
+ geoclue_gpsd_stop_gpsd(self);
+ return FALSE;
diff --git a/geoclue-nm.patch b/geoclue-nm.patch
new file mode 100644
index 0000000..17e7270
--- /dev/null
+++ b/geoclue-nm.patch
@@ -0,0 +1,135 @@
+--- geoclue-0.12.99/configure.ac.orig 2019-10-02 16:24:07.407947415 +0200
++++ geoclue-0.12.99/configure.ac 2019-10-04 20:51:53.104774152 +0200
+@@ -146,7 +146,7 @@
+ if test "x$enable_networkmanager" != "xno"; then
+ PKG_CHECK_MODULES(NETWORK_MANAGER,
+ [
+- NetworkManager libnm-glib libnm-util
++ libnm
+ ], have_networkmanager="yes", have_networkmanager="no")
+
+ if test "x$have_networkmanager" = "xyes"; then
+--- geoclue-0.12.99/src/connectivity-networkmanager.h.orig 2012-07-31 18:47:05.000000000 +0200
++++ geoclue-0.12.99/src/connectivity-networkmanager.h 2019-10-04 21:12:16.438146786 +0200
+@@ -26,7 +26,7 @@
+ #define _CONNECTIVITY_NETWORKMANAGER_H
+
+ #include <glib-object.h>
+-#include <nm-client.h>
++#include <NetworkManager.h>
+ #include "connectivity.h"
+
+
+--- geoclue-0.12.99/src/connectivity-networkmanager.c.orig 2012-07-31 18:47:05.000000000 +0200
++++ geoclue-0.12.99/src/connectivity-networkmanager.c 2019-10-05 06:53:55.835747194 +0200
+@@ -34,10 +34,6 @@
+
+ #include <NetworkManager.h> /*for DBus strings */
+
+-#include <nm-client.h>
+-#include <nm-device-wifi.h>
+-#include <nm-setting-ip4-config.h>
+-
+ #if !defined(NM_CHECK_VERSION)
+ #define NM_CHECK_VERSION(x,y,z) 0
+ #endif
+@@ -106,7 +102,7 @@
+ char *ap_mac;
+ int strength;
+
+- ap_mac = g_strdup (nm_access_point_get_hw_address (ap));
++ ap_mac = g_strdup (nm_access_point_get_bssid (ap));
+ strength = nm_access_point_get_strength (ap);
+ g_hash_table_insert (ht, ap_mac, GINT_TO_POINTER (strength_to_dbm (strength)));
+ }
+@@ -161,39 +157,22 @@
+ return mac_strup (mac);
+ }
+
+-static gchar *
+-ip4_address_as_string (guint32 ip)
+-{
+- struct in_addr tmp_addr;
+- char buf[INET_ADDRSTRLEN+1];
+-
+- memset (&buf, '\0', sizeof (buf));
+- tmp_addr.s_addr = ip;
+-
+- if (inet_ntop (AF_INET, &tmp_addr, buf, INET_ADDRSTRLEN))
+- return g_strdup (buf);
+-
+- return NULL;
+-}
+-
+ static char *
+ get_router_mac (GeoclueConnectivity *iface)
+ {
+ GeoclueNetworkManager *self = GEOCLUE_NETWORKMANAGER (iface);
+ const GPtrArray *devices;
+- char *gateway, *mac;
++ char *mac;
++ const char *gateway = NULL;
+ guint i;
+
+ devices = nm_client_get_devices (self->client);
+ if (devices == NULL)
+ return NULL;
+
+- gateway = NULL;
+-
+ for (i = 0; i < devices->len; i++) {
+ NMDevice *device = g_ptr_array_index (devices, i);
+- NMIP4Config *cfg4;
+- GSList *iter;
++ NMIPConfig *cfg4;
+
+ if (nm_device_get_state (device) != NM_DEVICE_STATE_ACTIVATED)
+ continue;
+@@ -202,19 +181,12 @@
+ if (cfg4 == NULL)
+ continue;
+
+- for (iter = (GSList *) nm_ip4_config_get_addresses (cfg4); iter; iter = g_slist_next (iter)) {
+- NMIP4Address *addr = (NMIP4Address *) iter->data;
+-
+- gateway = ip4_address_as_string (nm_ip4_address_get_gateway (addr));
+- if (gateway != NULL)
+- break;
+- }
++ gateway = nm_ip_config_get_gateway (cfg4);
+ }
+ if (gateway == NULL)
+ return NULL;
+
+ mac = get_mac_for_gateway (gateway);
+- g_free (gateway);
+
+ return mac;
+ }
+@@ -235,7 +207,7 @@
+ strength = nm_access_point_get_strength (ap);
+ if (strength > self->ap_strength) {
+ g_free (self->cache_ap_mac);
+- self->cache_ap_mac = g_strdup (nm_access_point_get_hw_address (ap));
++ self->cache_ap_mac = g_strdup (nm_access_point_get_bssid (ap));
+ self->ap_strength = strength;
+ }
+ }
+@@ -317,7 +289,7 @@
+
+ old_status = self->status;
+
+- if (nm_client_get_manager_running (self->client)) {
++ if (nm_client_get_nm_running (self->client)) {
+ state = nm_client_get_state (self->client);
+ self->status = nmstate_to_geocluenetworkstatus (state);
+ cache_ap_mac (self);
+@@ -341,7 +313,7 @@
+ geoclue_networkmanager_init (GeoclueNetworkManager *self)
+ {
+ self->status = GEOCLUE_CONNECTIVITY_UNKNOWN;
+- self->client = nm_client_new ();
++ self->client = nm_client_new (NULL, NULL);
+ if (self->client == NULL) {
+ g_warning ("%s was unable to create a connection to NetworkManager",
+ G_OBJECT_TYPE_NAME (self));
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/geoclue.git/commitdiff/f2294add01406e3b4c80cec20c05752b69f0e8e3
More information about the pld-cvs-commit
mailing list