* [PR PATCH] libosmgpsmap: port to libsoup-3.0
@ 2024-04-21 10:59 sgn
2024-04-21 11:52 ` lemmi
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: sgn @ 2024-04-21 10:59 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1273 bytes --]
There is a new pull request by sgn against master on the void-packages repository
https://github.com/sgn/void-packages libosmgpsmap-libsoup-3.0
https://github.com/void-linux/void-packages/pull/49955
libosmgpsmap: port to libsoup-3.0
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**
<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- aarch64-musl
- armv7l
- armv6l-musl
-->
A patch file from https://github.com/void-linux/void-packages/pull/49955.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libosmgpsmap-libsoup-3.0-49955.patch --]
[-- Type: text/x-diff, Size: 14373 bytes --]
From 5279604b3ebfc9c87773229685083f20edc3fd63 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
<congdanhqx@gmail.com>
Date: Sun, 21 Apr 2024 17:55:00 +0700
Subject: [PATCH] libosmgpsmap: port to libsoup-3.0
---
srcpkgs/libosmgpsmap/patches/libsoup-3.patch | 278 +++++++++++++++++++
srcpkgs/libosmgpsmap/template | 10 +-
2 files changed, 285 insertions(+), 3 deletions(-)
create mode 100644 srcpkgs/libosmgpsmap/patches/libsoup-3.patch
diff --git a/srcpkgs/libosmgpsmap/patches/libsoup-3.patch b/srcpkgs/libosmgpsmap/patches/libsoup-3.patch
new file mode 100644
index 00000000000000..97dc4480f60016
--- /dev/null
+++ b/srcpkgs/libosmgpsmap/patches/libsoup-3.patch
@@ -0,0 +1,278 @@
+From a7965751821d5bb55f8fb37b4045295d0c44dd9b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?S=C3=A9bastien=20Noel?= <sebastien@twolife.be>
+Date: Wed, 15 Feb 2023 11:56:48 +0100
+Subject: [PATCH] Port to libsoup3
+
+---
+ .github/workflows/ci.yml | 2 +-
+ configure.ac | 2 +-
+ docs/reference/Makefile.am | 4 +--
+ examples/Makefile.am | 4 +--
+ osmgpsmap-1.0.pc.in | 2 +-
+ src/Makefile.am | 4 +--
+ src/osm-gps-map-widget.c | 74 +++++++++++++++++++++-----------------
+ 7 files changed, 50 insertions(+), 42 deletions(-)
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -25,7 +25,7 @@ AM_SILENT_RULES([yes])
+ PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.16])
+ PKG_CHECK_MODULES(GTK, [gtk+-3.0 >= 3.0])
+ PKG_CHECK_MODULES(CAIRO, [cairo >= 1.8])
+-PKG_CHECK_MODULES(SOUP24, [libsoup-2.4])
++PKG_CHECK_MODULES(SOUP30, [libsoup-3.0])
+
+ # The mapviewer demo also calls g_thread_init, so it needs to link against
+ # libgthread-2.0.
+--- a/docs/reference/Makefile.am
++++ b/docs/reference/Makefile.am
+@@ -71,12 +71,12 @@ AM_CFLAGS=-I$(top_srcdir) -I$(top_buildd
+ $(GLIB_CFLAGS) \
+ $(GTK_CFLAGS) \
+ $(CAIRO_CFLAGS) \
+- $(SOUP24_CFLAGS)
++ $(SOUP30_CFLAGS)
+ GTKDOC_LIBS=$(top_builddir)/src/libosmgpsmap-1.0.la \
+ $(GLIB_LIBS) \
+ $(GTK_LIBS) \
+ $(CAIRO_LIBS) \
+- $(SOUP24_LIBS)
++ $(SOUP30_LIBS)
+
+ # This includes the standard gtk-doc make rules, copied by gtkdocize.
+ include $(top_srcdir)/gtk-doc.make
+--- a/examples/Makefile.am
++++ b/examples/Makefile.am
+@@ -4,13 +4,13 @@ OSMGPSMAP_CFLAGS = \
+ $(GLIB_CFLAGS) \
+ $(GTK_CFLAGS) \
+ $(CAIRO_CFLAGS) \
+- $(SOUP24_CFLAGS)
++ $(SOUP30_CFLAGS)
+
+ OSMGPSMAP_LIBS = \
+ $(GLIB_LIBS) \
+ $(GTK_LIBS) \
+ $(CAIRO_LIBS) \
+- $(SOUP24_LIBS)
++ $(SOUP30_LIBS)
+
+ ## Demo Application
+ noinst_PROGRAMS = mapviewer polygon editable_track
+--- a/osmgpsmap-1.0.pc.in
++++ b/osmgpsmap-1.0.pc.in
+@@ -6,6 +6,6 @@ includedir=@includedir@
+ Name: @PACKAGE_NAME@
+ Description: Moving map widget using openstreet map data
+ Version: @PACKAGE_VERSION@
+-Requires: gtk+-3.0 libsoup-2.4
++Requires: gtk+-3.0 libsoup-3.0
+ Libs: -L${libdir} -losmgpsmap-1.0
+ Cflags: -I${includedir}/osmgpsmap-1.0
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -5,13 +5,13 @@ OSMGPSMAP_CFLAGS = \
+ $(GLIB_CFLAGS) \
+ $(GTK_CFLAGS) \
+ $(CAIRO_CFLAGS) \
+- $(SOUP24_CFLAGS)
++ $(SOUP30_CFLAGS)
+
+ OSMGPSMAP_LIBS = \
+ $(GLIB_LIBS) \
+ $(GTK_LIBS) \
+ $(CAIRO_LIBS) \
+- $(SOUP24_LIBS)
++ $(SOUP30_LIBS)
+
+ ## Shared library
+ libosmgpsmap_1_0_la_CFLAGS = \
+--- a/src/osm-gps-map-widget.c
++++ b/src/osm-gps-map-widget.c
+@@ -324,7 +324,7 @@ G_DEFINE_TYPE (OsmGpsMap, osm_gps_map, G
+ */
+ static gchar *replace_string(const gchar *src, const gchar *from, const gchar *to);
+ static gchar *replace_map_uri(OsmGpsMap *map, const gchar *uri, int zoom, int x, int y);
+-static void osm_gps_map_tile_download_complete (SoupSession *session, SoupMessage *msg, gpointer user_data);
++static void osm_gps_map_tile_download_complete (SoupSession *session, GAsyncResult *result, gpointer user_data);
+ static void osm_gps_map_download_tile (OsmGpsMap *map, int zoom, int x, int y, gboolean redraw);
+ static GdkPixbuf* osm_gps_map_render_tile_upscaled (OsmGpsMap *map, GdkPixbuf *tile, int tile_zoom, int zoom, int x, int y);
+
+@@ -740,12 +740,10 @@ osm_gps_map_blit_tile(OsmGpsMap *map, Gd
+ }
+ }
+
+-#define MSG_RESPONSE_BODY(a) ((a)->response_body->data)
+-#define MSG_RESPONSE_LEN(a) ((a)->response_body->length)
+ #define MSG_RESPONSE_LEN_FORMAT "%"G_GOFFSET_FORMAT
+
+ static void
+-osm_gps_map_tile_download_complete (SoupSession *session, SoupMessage *msg, gpointer user_data)
++osm_gps_map_tile_download_complete (SoupSession *session, GAsyncResult *result, gpointer user_data)
+ {
+ FILE *file;
+ OsmTileDownload *dl = (OsmTileDownload *)user_data;
+@@ -753,15 +751,23 @@ osm_gps_map_tile_download_complete (Soup
+ OsmGpsMapPrivate *priv = map->priv;
+ gboolean file_saved = FALSE;
+
+- if (SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) {
++ GError *error = NULL;
++ SoupMessage *msg = soup_session_get_async_result_message(session, result);
++ SoupStatus soup_status = soup_message_get_status(msg);
++ GBytes *body = soup_session_send_and_read_finish (session, result, &error);
++
++ GCancellable *cancellable = (GCancellable *)g_hash_table_lookup(priv->tile_queue, dl->uri);
++ g_object_unref (cancellable);
++
++ if (SOUP_STATUS_IS_SUCCESSFUL (soup_status)) {
+ /* save tile into cachedir if one has been specified */
+ if (priv->cache_dir) {
+ if (g_mkdir_with_parents(dl->folder,0700) == 0) {
+ file = g_fopen(dl->filename, "wb");
+ if (file != NULL) {
+- fwrite (MSG_RESPONSE_BODY(msg), 1, MSG_RESPONSE_LEN(msg), file);
++ fwrite (g_bytes_get_data(body, NULL), 1, g_bytes_get_size(body), file);
+ file_saved = TRUE;
+- g_debug("Wrote "MSG_RESPONSE_LEN_FORMAT" bytes to %s", MSG_RESPONSE_LEN(msg), dl->filename);
++ g_debug("Wrote "MSG_RESPONSE_LEN_FORMAT" bytes to %s", g_bytes_get_size(body), dl->filename);
+ fclose (file);
+
+ }
+@@ -786,7 +792,7 @@ osm_gps_map_tile_download_complete (Soup
+ /* parse file directly from memory */
+ if (extension) {
+ loader = gdk_pixbuf_loader_new_with_type (extension+1, NULL);
+- if (!gdk_pixbuf_loader_write (loader, (unsigned char*)MSG_RESPONSE_BODY(msg), MSG_RESPONSE_LEN(msg), NULL))
++ if (!gdk_pixbuf_loader_write (loader, (unsigned char*)g_bytes_get_data(body, NULL), g_bytes_get_size(body), NULL))
+ {
+ g_warning("Error: Decoding of image failed");
+ }
+@@ -824,21 +830,21 @@ osm_gps_map_tile_download_complete (Soup
+ g_free(dl->filename);
+ g_free(dl);
+ } else {
+- if ((msg->status_code == SOUP_STATUS_NOT_FOUND) || (msg->status_code == SOUP_STATUS_FORBIDDEN)) {
++ if ((soup_status == SOUP_STATUS_NOT_FOUND) || (soup_status == SOUP_STATUS_FORBIDDEN)) {
+ g_hash_table_insert(priv->missing_tiles, dl->uri, NULL);
+ g_hash_table_remove(priv->tile_queue, dl->uri);
+ g_object_notify(G_OBJECT(map), "tiles-queued");
+- } else if (msg->status_code == SOUP_STATUS_CANCELLED) {
++ } else if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+ /* called as application exit or after osm_gps_map_download_cancel_all */
+ g_hash_table_remove(priv->tile_queue, dl->uri);
+ g_object_notify(G_OBJECT(map), "tiles-queued");
+ } else {
+- g_warning("Error downloading tile: %d - %s", msg->status_code, msg->reason_phrase);
+- dl->ttl--;
+- if (dl->ttl) {
+- soup_session_requeue_message(session, msg);
+- return;
+- }
++ g_warning("Error downloading tile: %d - %s", soup_status, soup_status_get_phrase(soup_status));
++ //dl->ttl--;
++ //if (dl->ttl) {
++ // soup_session_requeue_message(session, msg);
++ // return;
++ //}
+
+ g_hash_table_remove(priv->tile_queue, dl->uri);
+ g_object_notify(G_OBJECT(map), "tiles-queued");
+@@ -888,21 +894,26 @@ osm_gps_map_download_tile (OsmGpsMap *ma
+ if (priv->is_google) {
+ //Set maps.google.com as the referrer
+ g_debug("Setting Google Referrer");
+- soup_message_headers_append(msg->request_headers, "Referer", "http://maps.google.com/");
++ soup_message_headers_append(soup_message_get_request_headers(msg), "Referer", "http://maps.google.com/");
+ //For google satelite also set the appropriate cookie value
+ if (priv->uri_format & URI_HAS_Q) {
+ const char *cookie = g_getenv("GOOGLE_COOKIE");
+ if (cookie) {
+ g_debug("Adding Google Cookie");
+- soup_message_headers_append(msg->request_headers, "Cookie", cookie);
++ soup_message_headers_append(soup_message_get_request_headers(msg), "Cookie", cookie);
+ }
+ }
+ }
+
+- g_hash_table_insert (priv->tile_queue, dl->uri, msg);
++ GCancellable *cancellable = g_cancellable_new ();
++ g_hash_table_insert (priv->tile_queue, dl->uri, cancellable);
+ g_object_notify (G_OBJECT (map), "tiles-queued");
+ /* the soup session unrefs the message when the download finishes */
+- soup_session_queue_message (priv->soup_session, msg, osm_gps_map_tile_download_complete, dl);
++ soup_session_send_and_read_async(priv->soup_session, msg,
++ G_PRIORITY_DEFAULT,
++ cancellable,
++ (GAsyncReadyCallback)osm_gps_map_tile_download_complete,
++ dl);
+ } else {
+ g_warning("Could not create soup message");
+ g_free(dl->uri);
+@@ -1686,11 +1697,8 @@ osm_gps_map_init (OsmGpsMap *object)
+ soup_session_async_new_with_options(SOUP_SESSION_USER_AGENT,
+ USER_AGENT, NULL);
+ #else
+- // lisoup since 2.42.0 has universal session, only methods can be sync/async
+- // and we use async
+- priv->soup_session =
+- soup_session_new_with_options(SOUP_SESSION_USER_AGENT,
+- USER_AGENT, NULL);
++ priv->soup_session = soup_session_new ();
++ soup_session_set_user_agent (priv->soup_session, USER_AGENT);
+ #endif
+
+ /* Hash table which maps tile d/l URIs to SoupMessage requests, the hashtable
+@@ -1922,10 +1930,10 @@ osm_gps_map_set_property (GObject *objec
+ g_debug("Setting proxy server: %s", priv->proxy_uri);
+
+ GValue val = {0};
+- SoupURI* uri = soup_uri_new(priv->proxy_uri);
+- g_value_init(&val, SOUP_TYPE_URI);
++ GUri* uri = g_uri_parse(priv->proxy_uri, SOUP_HTTP_URI_FLAGS, NULL);
++ g_value_init(&val, G_TYPE_URI);
+ g_value_take_boxed(&val, uri);
+- g_object_set_property(G_OBJECT(priv->soup_session),SOUP_SESSION_PROXY_URI,&val);
++ g_object_set_property(G_OBJECT(priv->soup_session),"proxy-resolver",&val);
+
+ } else {
+ g_free(priv->proxy_uri);
+@@ -1945,7 +1953,7 @@ osm_gps_map_set_property (GObject *objec
+ priv->user_agent = NULL;
+ g_value_set_string (&full_user_agent, USER_AGENT);
+ }
+- g_object_set_property(G_OBJECT(priv->soup_session),SOUP_SESSION_USER_AGENT, &full_user_agent);
++ g_object_set_property(G_OBJECT(priv->soup_session),"user-agent", &full_user_agent);
+ break;
+ case PROP_TILE_CACHE_DIR:
+ if ( g_value_get_string(value) ) {
+@@ -2987,9 +2995,9 @@ osm_gps_map_download_maps (OsmGpsMap *ma
+ }
+
+ static void
+-cancel_message (char *key, SoupMessage *value, SoupSession *user_data)
++cancel_message (char *key, GCancellable *cancellable, void *userdata)
+ {
+- soup_session_cancel_message (user_data, value, SOUP_STATUS_CANCELLED);
++ g_cancellable_cancel(cancellable);
+ }
+
+ /**
+@@ -2997,7 +3005,7 @@ cancel_message (char *key, SoupMessage *
+ * @map: a #OsmGpsMap widget
+ *
+ * Cancels all tiles currently being downloaded. Typically used if you wish to
+- * cacel a large number of tiles queued using osm_gps_map_download_maps()
++ * cancel a large number of tiles queued using osm_gps_map_download_maps()
+ *
+ * Since: 0.7.0
+ **/
+@@ -3005,7 +3013,7 @@ void
+ osm_gps_map_download_cancel_all (OsmGpsMap *map)
+ {
+ OsmGpsMapPrivate *priv = map->priv;
+- g_hash_table_foreach (priv->tile_queue, (GHFunc)cancel_message, priv->soup_session);
++ g_hash_table_foreach (priv->tile_queue, (GHFunc)cancel_message, NULL);
+ }
+
+ /**
diff --git a/srcpkgs/libosmgpsmap/template b/srcpkgs/libosmgpsmap/template
index f6ad04d57150fc..a1d7888b807a20 100644
--- a/srcpkgs/libosmgpsmap/template
+++ b/srcpkgs/libosmgpsmap/template
@@ -1,12 +1,12 @@
# Template file for 'libosmgpsmap'
pkgname=libosmgpsmap
version=1.2.0
-revision=2
+revision=3
build_style=gnu-configure
build_helper="gir"
configure_args="$(vopt_enable gir introspection)"
-hostmakedepends="pkg-config gtk-doc"
-makedepends="libsoup-devel gtk+3-devel cairo-devel"
+hostmakedepends="pkg-config gtk-doc automake libtool"
+makedepends="libsoup3-devel gtk+3-devel cairo-devel"
short_desc="Gtk+ Widget for Displaying OpenStreetMap tiles"
maintainer="lemmi <lemmi@nerd2nerd.org>"
license="GPL-2.0-or-later"
@@ -18,6 +18,10 @@ checksum=ddec11449f37b5dffb4bca134d024623897c6140af1f9981a8acc512dbf6a7a5
build_options="gir"
build_options_default="gir"
+pre_configure() {
+ autoreconf -fi
+}
+
libosmgpsmap-doc_package() {
depends="${sourcepkg}>=${version}_${revision}"
short_desc+=" - Documentation"
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: libosmgpsmap: port to libsoup-3.0
2024-04-21 10:59 [PR PATCH] libosmgpsmap: port to libsoup-3.0 sgn
@ 2024-04-21 11:52 ` lemmi
2024-05-03 7:55 ` sgn
2024-07-25 19:23 ` [PR PATCH] [Closed]: " lemmi
2 siblings, 0 replies; 4+ messages in thread
From: lemmi @ 2024-04-21 11:52 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 284 bytes --]
New comment by lemmi on void-packages repository
https://github.com/void-linux/void-packages/pull/49955#issuecomment-2068016242
Comment:
I think this is only used in `darktable`'s map feature. It'll take me a couple of days to test it. Feel free to ask me again, should I forget :)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: libosmgpsmap: port to libsoup-3.0
2024-04-21 10:59 [PR PATCH] libosmgpsmap: port to libsoup-3.0 sgn
2024-04-21 11:52 ` lemmi
@ 2024-05-03 7:55 ` sgn
2024-07-25 19:23 ` [PR PATCH] [Closed]: " lemmi
2 siblings, 0 replies; 4+ messages in thread
From: sgn @ 2024-05-03 7:55 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 150 bytes --]
New comment by sgn on void-packages repository
https://github.com/void-linux/void-packages/pull/49955#issuecomment-2092495592
Comment:
ping @lemmi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PR PATCH] [Closed]: libosmgpsmap: port to libsoup-3.0
2024-04-21 10:59 [PR PATCH] libosmgpsmap: port to libsoup-3.0 sgn
2024-04-21 11:52 ` lemmi
2024-05-03 7:55 ` sgn
@ 2024-07-25 19:23 ` lemmi
2 siblings, 0 replies; 4+ messages in thread
From: lemmi @ 2024-07-25 19:23 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1113 bytes --]
There's a closed pull request on the void-packages repository
libosmgpsmap: port to libsoup-3.0
https://github.com/void-linux/void-packages/pull/49955
Description:
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**
<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- aarch64-musl
- armv7l
- armv6l-musl
-->
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-07-25 19:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-21 10:59 [PR PATCH] libosmgpsmap: port to libsoup-3.0 sgn
2024-04-21 11:52 ` lemmi
2024-05-03 7:55 ` sgn
2024-07-25 19:23 ` [PR PATCH] [Closed]: " lemmi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).