Skip to contentSkip to conversation

libsoup:add a new routine & build as native package

PATCH In review Jiang Lu 4 participants 7 messages Mar 19, 2019 – Mar 20, 2019

lore
Share & tools
lore

Jiang Lu

author
#0 lore raw

Hi all,

This rr including 2 patch:
1.add a new routine for libsoup with name soup_uri_to_string_with_password() and make libsoup compiled as a native package.
2.make glib-networking compiled as a native package.

Make this change for ostree utilies, which needs libsoup when building ostree image on host.

Thanks
Jiang Lu

author
#1 lore raw

PATCH 1/2 libsoup:add soup_uri_to_string_with_password

The existed soup_uri_to_string does not have password, add a function to support it.

Besides, allow libsoup compiled as a native package and add glib-networking into dependency list.

---
 ...add-soup_uri_to_string_with_password.patch | 67 +++++++++++++++++++
 .../libsoup/libsoup-2.4_2.64.2.bb             |  5 +-
 2 files changed, 71 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-support/libsoup/libsoup-2.4/0001-add-soup_uri_to_string_with_password.patch
meta/recipes-support/libsoup/libsoup-2.4/0001-add-soup_uri_to_string_with_password.patch new file +67 -0
new file mode 100644
index 0000000000..c679d6b9e5
@@ -0,0 +1,67 @@
+From 82c2f059bc7c491c8c4c728408eb913bfc4a6f0a Mon Sep 17 00:00:00 2001
+From: Hongxu Jia <[email protected]>
+Date: Wed, 6 Jun 2018 22:37:30 +0800
+Subject: [PATCH] add soup_uri_to_string_with_password
+
+The existed soup_uri_to_string does not have password, add a
+function to support it.
+
+Upstream-Status: Pending
+
+Signed-off-by: Hongxu Jia <[email protected]>
+---
+ libsoup/soup-uri.c | 21 +++++++++++++++++++++
+ libsoup/soup-uri.h |  5 +++++
+ 2 files changed, 26 insertions(+)
+
+diff --git a/libsoup/soup-uri.c b/libsoup/soup-uri.c
+index 3eafd87..8421f1c 100644
+--- a/libsoup/soup-uri.c
++++ b/libsoup/soup-uri.c
+@@ -619,6 +619,27 @@ soup_uri_to_string (SoupURI *uri, gboolean just_path_and_query)
+ }
+ 
+ /**
++ * soup_uri_to_string_with_password:
++ * @uri: a #SoupURI
++ * @just_path_and_query: if %TRUE, output just the path and query portions
++ *
++ * Returns a string representing @uri.
++ *
++ * If @just_path_and_query is %TRUE, this concatenates the path and query
++ * together. That is, it constructs the string that would be needed in
++ * the Request-Line of an HTTP request for @uri.
++ *
++ * Note that the output will contain a password, if @uri does.
++ *
++ * Return value: a string representing @uri, which the caller must free.
++ **/
++char *
++soup_uri_to_string_with_password (SoupURI *uri, gboolean just_path_and_query)
++{
++	return soup_uri_to_string_internal (uri, just_path_and_query, TRUE, FALSE);
++}
++
++/**
+  * soup_uri_copy:
+  * @uri: a #SoupURI
+  *
+diff --git a/libsoup/soup-uri.h b/libsoup/soup-uri.h
+index b9360c6..af702d3 100644
+--- a/libsoup/soup-uri.h
++++ b/libsoup/soup-uri.h
+@@ -57,6 +57,11 @@ char   	   *soup_uri_to_string             (SoupURI    *uri,
+ 					    gboolean    just_path_and_query);
+ 
+ SOUP_AVAILABLE_IN_2_4
++char   	   *soup_uri_to_string_with_password             (SoupURI    *uri,
++					    gboolean    just_path_and_query);
++
++
++SOUP_AVAILABLE_IN_2_4
+ SoupURI	   *soup_uri_copy                  (SoupURI    *uri);
+ 
+ SOUP_AVAILABLE_IN_2_4
+-- 
+2.7.4
+
meta/recipes-support/libsoup/libsoup-2.4_2.64.2.bb +4 -1
index ae7c1a6863..c2284c0458 100644
@@ -11,6 +11,7 @@ SHRT_VER = "${@d.getVar('PV').split('.')[0]}.${@d.getVar('PV').split('.')[1]}"
 
 SRC_URI = "${GNOME_MIRROR}/libsoup/${SHRT_VER}/libsoup-${PV}.tar.xz \
            file://0001-Do-not-enforce-no-introspection-when-cross-building.patch \
+           file://0001-add-soup_uri_to_string_with_password.patch \
            "
 SRC_URI[md5sum] = "cac755dc6c6acd6e0c70007f547548f5"
 SRC_URI[sha256sum] = "75ddc194a5b1d6f25033bb9d355f04bfe5c03e0e1c71ed0774104457b3a786c6"
@@ -48,4 +49,6 @@ EXTRA_OEMESON_append_class-target = " ${@bb.utils.contains('GTKDOC_ENABLED', 'Tr
 DEBIAN_NOAUTONAME_${PN} = "1"
 
 # glib-networking is needed for SSL, proxies, etc.
-RRECOMMENDS_${PN} = "glib-networking"
+DEPENDS += "glib-networking"
+
+BBCLASSEXTEND = "native"
Signature · 1 line
2.17.1
author
#2 lore raw

PATCH 2/2 glib-networking:enable glib-networking complie as native package

In reply to Jiang Lu

Enable glib-networking compile as a native package, for it is depended by libsoup.

---
 .../glib-networking/glib-networking_2.58.0.bb | 31 +++++++++++++++++++
 1 file changed, 31 insertions(+)
meta/recipes-core/glib-networking/glib-networking_2.58.0.bb +31 -0
index f3190e1cae..35b4a3fa76 100644
@@ -29,3 +29,34 @@ FILES_${PN} += "\
                 "
 FILES_${PN}-dev += "${libdir}/gio/modules/libgio*.la"
 FILES_${PN}-staticdev += "${libdir}/gio/modules/libgio*.a"
+
+# Make sure we compile with ca-certificates support enabled.
+PACKAGECONFIG_append = " ca-certificates"
+
+DEPENDS += "ca-certificates"
+RDEPENDS_${PN} += "ca-certificates"
+
+# We need native version for ostree-/flatpak-native.
+BBCLASSEXTEND = "native"
+# OE-core's relocatable.bbclass assumes that every package which
+# ends up creating a ${libdir}/pkgconfig directory in its sysroot
+# will always also install .pc-files there and tries to uncondi-
+# tionally update paths in those files using globbing that fails
+# if no such files are present. This presumption is not true for
+# glib-networking which happens to create a directory by dereferencing
+# a GIO pkgconfig variable which in turn is defined relative to
+# the pkgconfig directory (${pcfiledir}/../...), causing pkgconfig
+# to get created.
+#
+# Could be worked around in the upatream recipe but since that
+# does not provide/create native versions of the package and since
+# this problem is related to native packages, we work around it here.
+#
+do_install_append_class-native () {
+    for _pc in ${D}${libdir}/pkgconfig/*.pc; do
+        case $_pc in
+            *'*.pc') rm -fr ${D}${libdir}/pkgconfig;;
+            *.pc)    break;;
+        esac
+    done
+}
Signature · 1 line
2.17.1
#3 lore raw

Re: [oe-core 2/2] glib-networking:enable glib-networking complie as native package

Quoted 44 lines · Jiang Lu

Enable glib-networking compile as a native package, for it is depended by
libsoup.

---
 .../glib-networking/glib-networking_2.58.0.bb | 31
+++++++++++++++++++
 1 file changed, 31 insertions(+)
(quoted diff) +0 -0

networking_2.58.0.bb b/meta/recipes-core/glib-networking/glib- networking_2.58.0.bb
index f3190e1cae..35b4a3fa76 100644

meta/recipes-core/glib-networking/glib-networking_2.58.0.bb +15 -0
@@ -29,3 +29,34 @@ FILES_${PN} += "\
                 "
 FILES_${PN}-dev += "${libdir}/gio/modules/libgio*.la"
 FILES_${PN}-staticdev += "${libdir}/gio/modules/libgio*.a"
+
+# Make sure we compile with ca-certificates support enabled.
+PACKAGECONFIG_append = " ca-certificates"
+
+DEPENDS += "ca-certificates"
+RDEPENDS_${PN} += "ca-certificates"
+
+# We need native version for ostree-/flatpak-native.
+BBCLASSEXTEND = "native"
+# OE-core's relocatable.bbclass assumes that every package which
+# ends up creating a ${libdir}/pkgconfig directory in its sysroot
+# will always also install .pc-files there and tries to uncondi-
+# tionally update paths in those files using globbing that fails
+# if no such files are present. This presumption is not true for
+# glib-networking which happens to create a directory by

dereferencing

meta/recipes-core/glib-networking/glib-networking_2.58.0.bb +7 -0
+# a GIO pkgconfig variable which in turn is defined relative to
+# the pkgconfig directory (${pcfiledir}/../...), causing pkgconfig
+# to get created.
+#
+# Could be worked around in the upatream recipe but since that
+# does not provide/create native versions of the package and since
+# this problem is related to native packages, we work around it

here.

meta/recipes-core/glib-networking/glib-networking_2.58.0.bb FILES_${PN} += "\ · line 62

Quoted 9 lines
meta/recipes-core/glib-networking/glib-networking_2.58.0.bb +9 -0
+#
+do_install_append_class-native () {
+    for _pc in ${D}${libdir}/pkgconfig/*.pc; do
+        case $_pc in
+            *'*.pc') rm -fr ${D}${libdir}/pkgconfig;;
+            *.pc)    break;;
+        esac
+    done
+}

This reads as if there is a bbappend in some layer which is now being dumped verbatim into the upstream recipe with no thought as to what makes sense.

We don't do PACKAGECONFIG_append in recipes and we don't hack .pc files like this. The dependencies suggest we should also fix the PACKAGECONFIG DEPENDS/RDEPENDS too.

This needs more work.

Also, for the first patch, its unclear why we need/want the patch present there and the commit shortlog doesn't really describe the multiple things the patch is doing.

Cheers,

Richard

#4 lore raw

Re: [oe-core 2/2] glib-networking:enable glib-networking complie as native package

In reply to Jiang Lu
Quoted 35 lines

-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Jiang Lu
Sent: den 19 mars 2019 08:55
To: [email protected]; [email protected]
Subject: [OE-core] [oe-core 2/2] glib-networking:enable glib-networking complie as native package

Enable glib-networking compile as a native package, for it is depended by
libsoup.

---
 .../glib-networking/glib-networking_2.58.0.bb | 31 +++++++++++++++++++
 1 file changed, 31 insertions(+)
(quoted diff) +0 -0

networking_2.58.0.bb b/meta/recipes-core/glib-networking/glib- networking_2.58.0.bb
index f3190e1cae..35b4a3fa76 100644

meta/recipes-core/glib-networking/glib-networking_2.58.0.bb +8 -0
@@ -29,3 +29,34 @@ FILES_${PN} += "\
                 "
 FILES_${PN}-dev += "${libdir}/gio/modules/libgio*.la"
 FILES_${PN}-staticdev += "${libdir}/gio/modules/libgio*.a"
+
+# Make sure we compile with ca-certificates support enabled.
+PACKAGECONFIG_append = " ca-certificates"
+
+DEPENDS += "ca-certificates"
+RDEPENDS_${PN} += "ca-certificates"
+
+# We need native version for ostree-/flatpak-native.

meta/recipes-core/glib-networking/glib-networking_2.58.0.bb FILES_${PN} += "\ · line 49

Quoted 10 lines
meta/recipes-core/glib-networking/glib-networking_2.58.0.bb +10 -0
+BBCLASSEXTEND = "native"
+# OE-core's relocatable.bbclass assumes that every package which
+# ends up creating a ${libdir}/pkgconfig directory in its sysroot
+# will always also install .pc-files there and tries to uncondi-
+# tionally update paths in those files using globbing that fails
+# if no such files are present. This presumption is not true for
+# glib-networking which happens to create a directory by dereferencing
+# a GIO pkgconfig variable which in turn is defined relative to
+# the pkgconfig directory (${pcfiledir}/../...), causing pkgconfig
+# to get created.

How about fixing relocatable_native_pcfiles() in relocatable.bbclass instead so that it ignores empty pkgconfig directories?

meta/recipes-core/glib-networking/glib-networking_2.58.0.bb FILES_${PN} += "\ · line 61

Quoted 12 lines
meta/recipes-core/glib-networking/glib-networking_2.58.0.bb +12 -0
+#
+# Could be worked around in the upatream recipe but since that
+# does not provide/create native versions of the package and since
+# this problem is related to native packages, we work around it here.
+#
+do_install_append_class-native () {
+    for _pc in ${D}${libdir}/pkgconfig/*.pc; do
+        case $_pc in
+            *'*.pc') rm -fr ${D}${libdir}/pkgconfig;;
+            *.pc)    break;;
+        esac
+    done

Why complicate things? Just remove the directory if it exists and is empty:

	rmdir ${D}${libdir}/pkgconfig 2>/dev/null || :
Quoted 3 lines
meta/recipes-core/glib-networking/glib-networking_2.58.0.bb +1 -1
+}
--

2.17.1

//Peter

#5 lore raw

Re: [oe-core 2/2] glib-networking:enable glib-networking complie as native package

Quoted 8 lines · Peter Kjellerstedt

meta/recipes-core/glib-networking/glib-networking_2.58.0.bb FILES_${PN} += "\ · line 61

Quoted 7 lines
meta/recipes-core/glib-networking/glib-networking_2.58.0.bb +7 -0
+do_install_append_class-native () {
+    for _pc in ${D}${libdir}/pkgconfig/*.pc; do
+        case $_pc in
+            *'*.pc') rm -fr ${D}${libdir}/pkgconfig;;
+            *.pc)    break;;
+        esac
+    done
Quoted 4 lines

Why complicate things? Just remove the directory if it exists and is empty:

        rmdir ${D}${libdir}/pkgconfig 2>/dev/null || :

Bikeshed! Or

rmdir --ignore-fail-on-non-empty ${D}${libdir}/pkgconfig

Ross

author
#6 lore raw

Re: [oe-core 2/2] glib-networking:enable glib-networking complie as native package

In reply to Peter Kjellerstedt
Quoted 39 lines · Peter Kjellerstedt
Quoted 39 lines

-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Jiang Lu
Sent: den 19 mars 2019 08:55
To: [email protected]; [email protected]
Subject: [OE-core] [oe-core 2/2] glib-networking:enable glib-networking complie as native package

Enable glib-networking compile as a native package, for it is depended by
libsoup.

---
  .../glib-networking/glib-networking_2.58.0.bb | 31 +++++++++++++++++++
  1 file changed, 31 insertions(+)
(quoted diff) +0 -0

networking_2.58.0.bb b/meta/recipes-core/glib-networking/glib- networking_2.58.0.bb
index f3190e1cae..35b4a3fa76 100644

meta/recipes-core/glib-networking/glib-networking_2.58.0.bb +12 -0
@@ -29,3 +29,34 @@ FILES_${PN} += "\
                  "
  FILES_${PN}-dev += "${libdir}/gio/modules/libgio*.la"
  FILES_${PN}-staticdev += "${libdir}/gio/modules/libgio*.a"
+
+# Make sure we compile with ca-certificates support enabled.
+PACKAGECONFIG_append = " ca-certificates"
+
+DEPENDS += "ca-certificates"
+RDEPENDS_${PN} += "ca-certificates"
+
+# We need native version for ostree-/flatpak-native.
+BBCLASSEXTEND = "native"
+# OE-core's relocatable.bbclass assumes that every package which
+# ends up creating a ${libdir}/pkgconfig directory in its sysroot
+# will always also install .pc-files there and tries to uncondi-
Quoted 8 lines

meta/recipes-core/glib-networking/glib-networking_2.58.0.bb FILES_${PN} += "\ · line 49

Quoted 6 lines
meta/recipes-core/glib-networking/glib-networking_2.58.0.bb +6 -0
+# tionally update paths in those files using globbing that fails
+# if no such files are present. This presumption is not true for
+# glib-networking which happens to create a directory by dereferencing
+# a GIO pkgconfig variable which in turn is defined relative to
+# the pkgconfig directory (${pcfiledir}/../...), causing pkgconfig
+# to get created.

How about fixing relocatable_native_pcfiles() in relocatable.bbclass instead so that it ignores empty pkgconfig directories?

Thanks,

I prefer add a .pc file existence checking in relocatable_native_pcfiles()

-       if [ -d ${SYSROOT_DESTDIR}${libdir}/pkgconfig ]; then
+       filecnt=ls -l ${SYSROOT_DESTDIR}${libdir}/pkgconfig/*.pc 2>/dev/null | wc -l +       if [ $filecnt -gt 0 ]; then

Thanks

Jiang Lu

Quoted 24 lines

meta/recipes-core/glib-networking/glib-networking_2.58.0.bb FILES_${PN} += "\ · line 61

Quoted 13 lines
meta/recipes-core/glib-networking/glib-networking_2.58.0.bb +12 -0
+#
+# Could be worked around in the upatream recipe but since that
+# does not provide/create native versions of the package and since
+# this problem is related to native packages, we work around it here.
+#
+do_install_append_class-native () {
+    for _pc in ${D}${libdir}/pkgconfig/*.pc; do
+        case $_pc in
+            *'*.pc') rm -fr ${D}${libdir}/pkgconfig;;
+            *.pc)    break;;
+        esac
+    done

Why complicate things? Just remove the directory if it exists and is empty:

	rmdir ${D}${libdir}/pkgconfig 2>/dev/null || :
Quoted 3 lines
meta/recipes-core/glib-networking/glib-networking_2.58.0.bb +1 -1
+}
--

2.17.1

//Peter