[PATCH] gnu: gobject-introspection: Update absolute-shlib-path.patch.

DoneSubmitted by Christopher Baines.
Details
2 participants
  • Christopher Baines
  • Marius Bakke
Owner
unassigned
Severity
normal
C
C
Christopher Baines wrote on 7 Jul 2019 12:48
(address . guix-patches@gnu.org)
20190707104803.23662-1-mail@cbaines.net
Incorporate some changes from nixpkgs to the gobject-introspection package
patches. This is motivated by looking at issues with libsoup and lollypop.
This changes means that the share/gir-1.0/Soup-2.4.gir file within libsoup
references libsoup-2.4.so.1 with an absolute filename, whereas previously, the
filename wasn't absolute.

* gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch:
Incorporate changes from nixpkgs.
---
...ct-introspection-absolute-shlib-path.patch | 141 +++++++++++++++++-
1 file changed, 137 insertions(+), 4 deletions(-)

Toggle diff (158 lines)
diff --git a/gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch b/gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch
index d00cc5a420..3c0bb1c6cf 100644
--- a/gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch
+++ b/gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch
@@ -2,10 +2,131 @@
 # add the full path.
 #
 # This patch was provided by Luca Bruno <lucabru@src.gnome.org>  for 
-# 'gobject-introspection' 1.40.0 in Nix. 
---- ./giscanner/utils.py.orig	2014-08-14 22:05:05.055334080 +0200
-+++ ./giscanner/utils.py	2014-08-14 22:05:24.687497334 +0200
-@@ -110,17 +110,11 @@
+# 'gobject-introspection' 1.40.0 in Nix.
+#
+# It has since been updated to work with newer versions of
+# gobject-introspection.
+--- a/giscanner/scannermain.py
++++ b/giscanner/scannermain.py
+@@ -95,6 +95,39 @@ def get_windows_option_group(parser):
+     return group
+ 
+ 
++def _get_default_fallback_libpath():
++    # Newer multiple-output-optimized stdenv has an environment variable
++    # $outputLib which in turn specifies another variable which then is used as
++    # the destination for the library contents (${!outputLib}/lib).
++    store_path = os.environ.get(os.environ.get("outputLib")) if "outputLib" in os.environ else None
++    if store_path is None:
++        outputs = os.environ.get("outputs", "out").split()
++        if "lib" in outputs:
++            # For multiple output derivations let's try whether there is a $lib
++            # environment variable and use that as the base store path.
++            store_path = os.environ.get("lib")
++        elif "out" in outputs:
++            # Otherwise we have a single output derivation, so the libraries
++            # most certainly will end up in "$out/lib".
++            store_path = os.environ.get("out")
++
++    if store_path is not None:
++        # Even if we have a $lib as output, there still should be a $lib/lib
++        # directory.
++        return os.path.join(store_path, 'lib')
++    else:
++        # If we haven't found a possible scenario, let's return an empty string
++        # so that the shared library won't be prepended with a path.
++        #
++        # Note that this doesn't mean that all hope is lost, because after all
++        # we can still use --fallback-library-path to set one.
++        #
++        # Also, we're not returning None, because that would make it very
++        # difficult to disable adding fallback paths altogether using something
++        # like: --fallback-library-path=""
++        return ""
++
++
+ def _get_option_parser():
+     parser = optparse.OptionParser('%prog [options] sources',
+                                    version='%prog ' + giscanner.__version__)
+@@ -205,6 +238,10 @@ match the namespace prefix.""")
+     parser.add_option("", "--filelist",
+                       action="store", dest="filelist", default=[],
+                       help="file containing headers and sources to be scanned")
++    parser.add_option("", "--fallback-library-path",
++                      action="store", dest="fallback_libpath",
++                      default=_get_default_fallback_libpath(),
++                      help="Path to prepend to unknown shared libraries")
+ 
+     group = get_preprocessor_option_group(parser)
+     parser.add_option_group(group)
+--- a/giscanner/shlibs.py
++++ b/giscanner/shlibs.py
+@@ -57,6 +57,12 @@ def _ldd_library_pattern(library_name):
+     $""" % re.escape(library_name), re.VERBOSE)
+ 
+ 
++def _ldd_library_guix_pattern(library_name):
++    store_dir = re.escape('/gnu/store')
++    pattern = r'(%s(?:/[^/]*)+lib%s[^A-Za-z0-9_-][^\s\(\)]*)'
++    return re.compile(pattern % (store_dir, re.escape(library_name)))
++
++
+ # This is a what we do for non-la files. We assume that we are on an
+ # ELF-like system where ldd exists and the soname extracted with ldd is
+ # a filename that can be opened with dlopen().
+@@ -106,7 +112,8 @@ def _resolve_non_libtool(options, binary, libraries):
+             output = output.decode("utf-8", "replace")
+ 
+         shlibs = resolve_from_ldd_output(libraries, output)
+-        return list(map(sanitize_shlib_path, shlibs))
++        fallback_libpath = options.fallback_libpath or "";
++        return list(map(lambda p: os.path.join(fallback_libpath, p), map(sanitize_shlib_path, shlibs)))
+ 
+ 
+ def sanitize_shlib_path(lib):
+@@ -115,19 +122,18 @@ def sanitize_shlib_path(lib):
+     # In case we get relative paths on macOS (like @rpath) then we fall
+     # back to the basename as well:
+     # https://gitlab.gnome.org/GNOME/gobject-introspection/issues/222
+-    if sys.platform == "darwin":
+-        if not os.path.isabs(lib):
+-            return os.path.basename(lib)
+-        return lib
+-    else:
++
++    # Always use absolute paths if available
++    if not os.path.isabs(lib):
+         return os.path.basename(lib)
++    return lib
+ 
+ 
+ def resolve_from_ldd_output(libraries, output):
+     patterns = {}
+     for library in libraries:
+         if not os.path.isfile(library):
+-            patterns[library] = _ldd_library_pattern(library)
++            patterns[library] = (_ldd_library_pattern(library), _ldd_library_guix_pattern(library))
+     if len(patterns) == 0:
+         return []
+ 
+@@ -139,8 +145,11 @@ def resolve_from_ldd_output(libraries, output):
+         if line.endswith(':'):
+             continue
+         for word in line.split():
+-            for library, pattern in patterns.items():
+-                m = pattern.match(word)
++            for library, (pattern, guix_pattern) in patterns.items():
++                if line.find('/gnu/store') != -1:
++                    m = guix_pattern.match(word)
++                else:
++                    m = pattern.match(word)
+                 if m:
+                     del patterns[library]
+                     shlibs.append(m.group())
+
+--- a/giscanner/utils.py
++++ b/giscanner/utils.py
+@@ -111,17 +111,11 @@ def extract_libtool_shlib(la_file):
      if dlname is None:
          return None
  
@@ -28,3 +149,15 @@
  
  
  def extract_libtool(la_file):
+--- a/tests/scanner/test_shlibs.py
++++ b/tests/scanner/test_shlibs.py
+@@ -40,6 +64,7 @@ class TestLddParser(unittest.TestCase):
+ 
+         self.assertEqual(
+             sanitize_shlib_path('/foo/bar'),
+-            '/foo/bar' if sys.platform == 'darwin' else 'bar')
++            # Always use an absolute filename for Guix
++            '/foo/bar')
+ 
+     def test_unresolved_library(self):
+output = ''
-- 
2.22.0
C
C
Christopher Baines wrote on 8 Jul 2019 09:46
(address . 36535-done@debbugs.gnu.org)
87d0il9deh.fsf@cbaines.net
Christopher Baines <mail@cbaines.net> writes:

Toggle quote (13 lines)
> Incorporate some changes from nixpkgs to the gobject-introspection package
> patches. This is motivated by looking at issues with libsoup and lollypop.
> This changes means that the share/gir-1.0/Soup-2.4.gir file within libsoup
> references libsoup-2.4.so.1 with an absolute filename, whereas previously, the
> filename wasn't absolute.
>
> * gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch:
> Incorporate changes from nixpkgs.
> ---
> ...ct-introspection-absolute-shlib-path.patch | 141 +++++++++++++++++-
> 1 file changed, 137 insertions(+), 4 deletions(-)
>

I've pushed this as [1] to core-updates now, as I wanted to get it in
before the freeze.

1: 8747477deb765571c300d3eb9a4012a3c36cf7f7
-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAl0i9OZfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE
9XdBZQ/+Jfyw4pkvn02+DSf0SoEdD4OCoR+TpJK6S8VHCUOWuYQH5WSl8YXv5sX7
5/AvVgbwkCGIFR0jobUx2qCKvO0dIPizbDfEoAIDymZFdRU04e2hY0ow1MU4w5pR
c7x22iO86wR8NUqJ/Ff+/GMGPcnj0I8brczEN6gccjf8v4GGKgBpcd1mRKpr9tZv
dpzfiFniQzM+wiSIQyM+zqAWdG77n2s/XiMOiwTkpIq3NmIbgdeyT8+L42KQTnBO
kiBnZbsXPXzV+U1Nn+2FItM9Su+wJTGXO+FGFGcI67JGALB7+ResaWkFl8f5oOog
piqTfwMdo1HRBUiitXQVMG1iqpHg3AyZO7uf4EpeO5kkxld1K9wvXpdCHvt46LiT
lBPkZw3glUC6k/oJTklKJkUVMkuVFGfz5EdEVYR11w/Gj0+7W1tLXFF4bbjdHDrc
7QmAdfQEO52QQdS3eTUQGeyfe4mJPiX+4eE6XRKj2nciGosh55SoanGGdIVCcjRY
qeLI9q5qX2nLSslajPzttWMBAIh3M/AxWtBfyO4/RSa4t4QHvvzEd8ThYQnomgUt
TU4rjygkgkhQGZr3I1k0OxZ4HIq/iPcOwdmsWWlKyCK0mL+3yFPjCnbG0meyREHV
d7IkHqDOptfEKT5riyAoajPoaLVpQZHGLpv42RwO/U5lO2C2V0g=
=zjdF
-----END PGP SIGNATURE-----

Closed
M
M
Marius Bakke wrote on 8 Jul 2019 16:21
Re: bug#36535: [PATCH] gnu: gobject-introspection: Update absolute-shlib-path.patch.
875zocr4hl.fsf@devup.no
Hi Chris,

Christopher Baines <mail@cbaines.net> writes:

Toggle quote (18 lines)
> Christopher Baines <mail@cbaines.net> writes:
>
>> Incorporate some changes from nixpkgs to the gobject-introspection package
>> patches. This is motivated by looking at issues with libsoup and lollypop.
>> This changes means that the share/gir-1.0/Soup-2.4.gir file within libsoup
>> references libsoup-2.4.so.1 with an absolute filename, whereas previously, the
>> filename wasn't absolute.
>>
>> * gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch:
>> Incorporate changes from nixpkgs.
>> ---
>> ...ct-introspection-absolute-shlib-path.patch | 141 +++++++++++++++++-
>> 1 file changed, 137 insertions(+), 4 deletions(-)
>>
>
> I've pushed this as [1] to core-updates now, as I wanted to get it in
> before the freeze.

Thank you for addressing this. IIUC previously lollypop failed to
retain a reference to libsoup-2.4.so.1, whereas with this patch it does?

A few comments about the patch:

Toggle quote (30 lines)
> diff --git a/gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch b/gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch
> index d00cc5a420..3c0bb1c6cf 100644
> --- a/gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch
> +++ b/gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch
> @@ -2,10 +2,131 @@
> # add the full path.
> #
> # This patch was provided by Luca Bruno <lucabru@src.gnome.org> for
> -# 'gobject-introspection' 1.40.0 in Nix.
> ---- ./giscanner/utils.py.orig 2014-08-14 22:05:05.055334080 +0200
> -+++ ./giscanner/utils.py 2014-08-14 22:05:24.687497334 +0200
> -@@ -110,17 +110,11 @@
> +# 'gobject-introspection' 1.40.0 in Nix.
> +#
> +# It has since been updated to work with newer versions of
> +# gobject-introspection.
> +--- a/giscanner/scannermain.py
> ++++ b/giscanner/scannermain.py
> +@@ -95,6 +95,39 @@ def get_windows_option_group(parser):
> + return group
> +
> +
> ++def _get_default_fallback_libpath():
> ++ # Newer multiple-output-optimized stdenv has an environment variable
> ++ # $outputLib which in turn specifies another variable which then is used as
> ++ # the destination for the library contents (${!outputLib}/lib).
> ++ store_path = os.environ.get(os.environ.get("outputLib")) if "outputLib" in os.environ else None
> ++ if store_path is None:
> ++ outputs = os.environ.get("outputs", "out").split()

gnu-build-system does not currently export an "outputs" variable.
Perhaps it should?

Toggle quote (9 lines)
> ++ if "lib" in outputs:
> ++ # For multiple output derivations let's try whether there is a $lib
> ++ # environment variable and use that as the base store path.
> ++ store_path = os.environ.get("lib")
> ++ elif "out" in outputs:
> ++ # Otherwise we have a single output derivation, so the libraries
> ++ # most certainly will end up in "$out/lib".
> ++ store_path = os.environ.get("out")

Consequently, this is the only ever matching case, and "lib" outputs are
ignored, counter to what one might expect from glancing over this patch.

That is, unless one sets an "outputs" or "outputLib" variable in a
package recipe, so maybe we don't have to do anything here.

Toggle quote (41 lines)
> ++
> ++ if store_path is not None:
> ++ # Even if we have a $lib as output, there still should be a $lib/lib
> ++ # directory.
> ++ return os.path.join(store_path, 'lib')
> ++ else:
> ++ # If we haven't found a possible scenario, let's return an empty string
> ++ # so that the shared library won't be prepended with a path.
> ++ #
> ++ # Note that this doesn't mean that all hope is lost, because after all
> ++ # we can still use --fallback-library-path to set one.
> ++ #
> ++ # Also, we're not returning None, because that would make it very
> ++ # difficult to disable adding fallback paths altogether using something
> ++ # like: --fallback-library-path=""
> ++ return ""
> ++
> ++
> + def _get_option_parser():
> + parser = optparse.OptionParser('%prog [options] sources',
> + version='%prog ' + giscanner.__version__)
> +@@ -205,6 +238,10 @@ match the namespace prefix.""")
> + parser.add_option("", "--filelist",
> + action="store", dest="filelist", default=[],
> + help="file containing headers and sources to be scanned")
> ++ parser.add_option("", "--fallback-library-path",
> ++ action="store", dest="fallback_libpath",
> ++ default=_get_default_fallback_libpath(),
> ++ help="Path to prepend to unknown shared libraries")
> +
> + group = get_preprocessor_option_group(parser)
> + parser.add_option_group(group)
> +--- a/giscanner/shlibs.py
> ++++ b/giscanner/shlibs.py
> +@@ -57,6 +57,12 @@ def _ldd_library_pattern(library_name):
> + $""" % re.escape(library_name), re.VERBOSE)
> +
> +
> ++def _ldd_library_guix_pattern(library_name):
> ++ store_dir = re.escape('/gnu/store')

Here we should use:

os.environ.get("NIX_STORE") if "NIX_STORE" in os.environ else "/gnu/store"

So that it works for non-default store prefixes.

Toggle quote (51 lines)
> ++ pattern = r'(%s(?:/[^/]*)+lib%s[^A-Za-z0-9_-][^\s\(\)]*)'
> ++ return re.compile(pattern % (store_dir, re.escape(library_name)))
> ++
> ++
> + # This is a what we do for non-la files. We assume that we are on an
> + # ELF-like system where ldd exists and the soname extracted with ldd is
> + # a filename that can be opened with dlopen().
> +@@ -106,7 +112,8 @@ def _resolve_non_libtool(options, binary, libraries):
> + output = output.decode("utf-8", "replace")
> +
> + shlibs = resolve_from_ldd_output(libraries, output)
> +- return list(map(sanitize_shlib_path, shlibs))
> ++ fallback_libpath = options.fallback_libpath or "";
> ++ return list(map(lambda p: os.path.join(fallback_libpath, p), map(sanitize_shlib_path, shlibs)))
> +
> +
> + def sanitize_shlib_path(lib):
> +@@ -115,19 +122,18 @@ def sanitize_shlib_path(lib):
> + # In case we get relative paths on macOS (like @rpath) then we fall
> + # back to the basename as well:
> + # https://gitlab.gnome.org/GNOME/gobject-introspection/issues/222
> +- if sys.platform == "darwin":
> +- if not os.path.isabs(lib):
> +- return os.path.basename(lib)
> +- return lib
> +- else:
> ++
> ++ # Always use absolute paths if available
> ++ if not os.path.isabs(lib):
> + return os.path.basename(lib)
> ++ return lib
> +
> +
> + def resolve_from_ldd_output(libraries, output):
> + patterns = {}
> + for library in libraries:
> + if not os.path.isfile(library):
> +- patterns[library] = _ldd_library_pattern(library)
> ++ patterns[library] = (_ldd_library_pattern(library), _ldd_library_guix_pattern(library))
> + if len(patterns) == 0:
> + return []
> +
> +@@ -139,8 +145,11 @@ def resolve_from_ldd_output(libraries, output):
> + if line.endswith(':'):
> + continue
> + for word in line.split():
> +- for library, pattern in patterns.items():
> +- m = pattern.match(word)
> ++ for library, (pattern, guix_pattern) in patterns.items():
> ++ if line.find('/gnu/store') != -1:

Use $NIX_STORE here, too.

Other than that LGTM.
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAl0jUYYACgkQoqBt8qM6
VPoxlwgAvgaRHOLYSc/d0jreL57XpLIli70duhyKOFcLJN7ylPdNIUbPF29US5Z0
Yswa0mvyZo4VOEIobCnfPiJrf/dmpDCYOTepANaz9ybqnuwPlkriq7xEvOxlz8L7
qhkTttqVZoFK6OVkRBA1MM3LEmXf49UKiVLH19wjSH/T+eNijULZzvYF5kdH4Sc0
OioafwMLlqpe3KkM5QJxByV/pEpGmbMrnhhUX089m8Cq4lAV3Ml3+eRbKAUNG24j
aqLqPaE9MqqymINk0N7jyy927uRhNBm6brYOoB4geyQ+HpqlZAz3AhDpASOMsOP/
6y6NN48sGwU5ZrYoMZP8Jue9dX0xBw==
=yx8y
-----END PGP SIGNATURE-----

Closed
C
C
Christopher Baines wrote on 8 Jul 2019 17:59
(name . Marius Bakke)(address . mbakke@fastmail.com)(address . 36535@debbugs.gnu.org)
87bly4a566.fsf@cbaines.net
Marius Bakke <mbakke@fastmail.com> writes:

Toggle quote (25 lines)
> Hi Chris,
>
> Christopher Baines <mail@cbaines.net> writes:
>
>> Christopher Baines <mail@cbaines.net> writes:
>>
>>> Incorporate some changes from nixpkgs to the gobject-introspection package
>>> patches. This is motivated by looking at issues with libsoup and lollypop.
>>> This changes means that the share/gir-1.0/Soup-2.4.gir file within libsoup
>>> references libsoup-2.4.so.1 with an absolute filename, whereas previously, the
>>> filename wasn't absolute.
>>>
>>> * gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch:
>>> Incorporate changes from nixpkgs.
>>> ---
>>> ...ct-introspection-absolute-shlib-path.patch | 141 +++++++++++++++++-
>>> 1 file changed, 137 insertions(+), 4 deletions(-)
>>>
>>
>> I've pushed this as [1] to core-updates now, as I wanted to get it in
>> before the freeze.
>
> Thank you for addressing this. IIUC previously lollypop failed to
> retain a reference to libsoup-2.4.so.1, whereas with this patch it does?

Not quite... I think lollypop was reading the typelib in libsoup, but
the shared library was just referenced by filename, not the absolute
filename, and I think this was causing issues when trying to use libsoup
from lollypop.

On master:

grep shared-library /gnu/store/bafaiiblr2vmmf1zvidkw1137ndqnqg2-libsoup-2.66.2/share/gir-1.0/Soup-2.4.gir
shared-library="libsoup-2.4.so.1"

On core-updates:

grep shared-library /gnu/store/b1ykh6xj11v7zav4r68v8qflk31cnddm-libsoup-2.66.2/share/gir-1.0/Soup-2.4.gir
shared-library="/gnu/store/b1ykh6xj11v7zav4r68v8qflk31cnddm-libsoup-2.66.2/lib/libsoup-2.4.so.1"

Toggle quote (35 lines)
> A few comments about the patch:
>
>> diff --git a/gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch b/gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch
>> index d00cc5a420..3c0bb1c6cf 100644
>> --- a/gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch
>> +++ b/gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch
>> @@ -2,10 +2,131 @@
>> # add the full path.
>> #
>> # This patch was provided by Luca Bruno <lucabru@src.gnome.org> for
>> -# 'gobject-introspection' 1.40.0 in Nix.
>> ---- ./giscanner/utils.py.orig 2014-08-14 22:05:05.055334080 +0200
>> -+++ ./giscanner/utils.py 2014-08-14 22:05:24.687497334 +0200
>> -@@ -110,17 +110,11 @@
>> +# 'gobject-introspection' 1.40.0 in Nix.
>> +#
>> +# It has since been updated to work with newer versions of
>> +# gobject-introspection.
>> +--- a/giscanner/scannermain.py
>> ++++ b/giscanner/scannermain.py
>> +@@ -95,6 +95,39 @@ def get_windows_option_group(parser):
>> + return group
>> +
>> +
>> ++def _get_default_fallback_libpath():
>> ++ # Newer multiple-output-optimized stdenv has an environment variable
>> ++ # $outputLib which in turn specifies another variable which then is used as
>> ++ # the destination for the library contents (${!outputLib}/lib).
>> ++ store_path = os.environ.get(os.environ.get("outputLib")) if "outputLib" in os.environ else None
>> ++ if store_path is None:
>> ++ outputs = os.environ.get("outputs", "out").split()
>
> gnu-build-system does not currently export an "outputs" variable.
> Perhaps it should?

Ah, I didn't realise this part of the patch was as Nix specific as it
is...

At least for the change I was trying to affect, this seems to be
probably redundant, or somehow doing the job. Maybe this part of the
patch relating to the fallback_libpath should be removed.

Toggle quote (62 lines)
>> ++ if "lib" in outputs:
>> ++ # For multiple output derivations let's try whether there is a $lib
>> ++ # environment variable and use that as the base store path.
>> ++ store_path = os.environ.get("lib")
>> ++ elif "out" in outputs:
>> ++ # Otherwise we have a single output derivation, so the libraries
>> ++ # most certainly will end up in "$out/lib".
>> ++ store_path = os.environ.get("out")
>
> Consequently, this is the only ever matching case, and "lib" outputs are
> ignored, counter to what one might expect from glancing over this patch.
>
> That is, unless one sets an "outputs" or "outputLib" variable in a
> package recipe, so maybe we don't have to do anything here.
>
>> ++
>> ++ if store_path is not None:
>> ++ # Even if we have a $lib as output, there still should be a $lib/lib
>> ++ # directory.
>> ++ return os.path.join(store_path, 'lib')
>> ++ else:
>> ++ # If we haven't found a possible scenario, let's return an empty string
>> ++ # so that the shared library won't be prepended with a path.
>> ++ #
>> ++ # Note that this doesn't mean that all hope is lost, because after all
>> ++ # we can still use --fallback-library-path to set one.
>> ++ #
>> ++ # Also, we're not returning None, because that would make it very
>> ++ # difficult to disable adding fallback paths altogether using something
>> ++ # like: --fallback-library-path=""
>> ++ return ""
>> ++
>> ++
>> + def _get_option_parser():
>> + parser = optparse.OptionParser('%prog [options] sources',
>> + version='%prog ' + giscanner.__version__)
>> +@@ -205,6 +238,10 @@ match the namespace prefix.""")
>> + parser.add_option("", "--filelist",
>> + action="store", dest="filelist", default=[],
>> + help="file containing headers and sources to be scanned")
>> ++ parser.add_option("", "--fallback-library-path",
>> ++ action="store", dest="fallback_libpath",
>> ++ default=_get_default_fallback_libpath(),
>> ++ help="Path to prepend to unknown shared libraries")
>> +
>> + group = get_preprocessor_option_group(parser)
>> + parser.add_option_group(group)
>> +--- a/giscanner/shlibs.py
>> ++++ b/giscanner/shlibs.py
>> +@@ -57,6 +57,12 @@ def _ldd_library_pattern(library_name):
>> + $""" % re.escape(library_name), re.VERBOSE)
>> +
>> +
>> ++def _ldd_library_guix_pattern(library_name):
>> ++ store_dir = re.escape('/gnu/store')
>
> Here we should use:
>
> os.environ.get("NIX_STORE") if "NIX_STORE" in os.environ else "/gnu/store"
>
> So that it works for non-default store prefixes.

Given NIX_STORE is set at build time, and this code is mostly used at
build time, then that would work.

Before I was thinking about how to actually put the store path in the
code at build time, but that's probably not necessary.

Toggle quote (54 lines)
>> ++ pattern = r'(%s(?:/[^/]*)+lib%s[^A-Za-z0-9_-][^\s\(\)]*)'
>> ++ return re.compile(pattern % (store_dir, re.escape(library_name)))
>> ++
>> ++
>> + # This is a what we do for non-la files. We assume that we are on an
>> + # ELF-like system where ldd exists and the soname extracted with ldd is
>> + # a filename that can be opened with dlopen().
>> +@@ -106,7 +112,8 @@ def _resolve_non_libtool(options, binary, libraries):
>> + output = output.decode("utf-8", "replace")
>> +
>> + shlibs = resolve_from_ldd_output(libraries, output)
>> +- return list(map(sanitize_shlib_path, shlibs))
>> ++ fallback_libpath = options.fallback_libpath or "";
>> ++ return list(map(lambda p: os.path.join(fallback_libpath, p), map(sanitize_shlib_path, shlibs)))
>> +
>> +
>> + def sanitize_shlib_path(lib):
>> +@@ -115,19 +122,18 @@ def sanitize_shlib_path(lib):
>> + # In case we get relative paths on macOS (like @rpath) then we fall
>> + # back to the basename as well:
>> + # https://gitlab.gnome.org/GNOME/gobject-introspection/issues/222
>> +- if sys.platform == "darwin":
>> +- if not os.path.isabs(lib):
>> +- return os.path.basename(lib)
>> +- return lib
>> +- else:
>> ++
>> ++ # Always use absolute paths if available
>> ++ if not os.path.isabs(lib):
>> + return os.path.basename(lib)
>> ++ return lib
>> +
>> +
>> + def resolve_from_ldd_output(libraries, output):
>> + patterns = {}
>> + for library in libraries:
>> + if not os.path.isfile(library):
>> +- patterns[library] = _ldd_library_pattern(library)
>> ++ patterns[library] = (_ldd_library_pattern(library), _ldd_library_guix_pattern(library))
>> + if len(patterns) == 0:
>> + return []
>> +
>> +@@ -139,8 +145,11 @@ def resolve_from_ldd_output(libraries, output):
>> + if line.endswith(':'):
>> + continue
>> + for word in line.split():
>> +- for library, pattern in patterns.items():
>> +- m = pattern.match(word)
>> ++ for library, (pattern, guix_pattern) in patterns.items():
>> ++ if line.find('/gnu/store') != -1:
>
> Use $NIX_STORE here, too.
>
> Other than that LGTM.
-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAl0jaFFfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE
9XcFcRAAltWo2Jsf7FqUhdceW/U47N1X7pCQLFsYD5xD0z4tRKGOwOiS3kelqb7f
RAAA8cjOqOYN1t0uFamcL82EkZ+RWAj0CJQn4cP81S5p/YrhwWXbMVH4CX2XrX44
okFdpyvkEnRxZ1O30VdlMrtTdgWxG/qQkK/9ZFgLCvxn2Qnw6zIpEuZnm8rrIBft
WCz3fmFzd69NN2JM60MOVyta0i6zI4cFOL0i+LqtZCIQGurh3nMvAhN+GE+9/uQ2
OdrZTRN6PNny6rcpN4ZOZ6NE10s5uBHMw9MMUN9A2Lj+1BqAv2nBSzqvmZrmfkGH
6O6e13Y19RYPaNIXPH4W3KaycDRYu2xYhd018PVmBZ1kA4A7P5hll7Vgwv70vH4n
wkUDpeKEjl9F7SMnsv28vyDZyV+FiY7rsnXyq6N08+DHH9BJllwgfkqdx5ktRgB+
54WCETrkG5cZNQ1lqniySXVQIsyEAYpwBaQBOhKILx+zuA4RWTuy6kitwNYWQ0FA
eLibQY8UL7iPo38ZuVHuWxIn3ntZkxhJ6qv5kECG+055FF2ZKSorVu9Y3q4XVkRu
naWHbTTD6DGOwZ/+Z24/3FL78QN9x8xkfu/4R5Ou5/dAvwgpQO0rbD4sqYaPEnsm
DFRA/jzykptvEawfQzjxuFaYxqLeeAefx01G587HPDk159H7dPE=
=/I0h
-----END PGP SIGNATURE-----

M
M
Marius Bakke wrote on 8 Jul 2019 18:29
(name . Christopher Baines)(address . mail@cbaines.net)(address . 36535@debbugs.gnu.org)
87zhlopjzv.fsf@devup.no
Christopher Baines <mail@cbaines.net> writes:

Toggle quote (32 lines)
> Marius Bakke <mbakke@fastmail.com> writes:
>
>> Hi Chris,
>>
>> Christopher Baines <mail@cbaines.net> writes:
>>
>>> Christopher Baines <mail@cbaines.net> writes:
>>>
>>>> Incorporate some changes from nixpkgs to the gobject-introspection package
>>>> patches. This is motivated by looking at issues with libsoup and lollypop.
>>>> This changes means that the share/gir-1.0/Soup-2.4.gir file within libsoup
>>>> references libsoup-2.4.so.1 with an absolute filename, whereas previously, the
>>>> filename wasn't absolute.
>>>>
>>>> * gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch:
>>>> Incorporate changes from nixpkgs.
>>>> ---
>>>> ...ct-introspection-absolute-shlib-path.patch | 141 +++++++++++++++++-
>>>> 1 file changed, 137 insertions(+), 4 deletions(-)
>>>>
>>>
>>> I've pushed this as [1] to core-updates now, as I wanted to get it in
>>> before the freeze.
>>
>> Thank you for addressing this. IIUC previously lollypop failed to
>> retain a reference to libsoup-2.4.so.1, whereas with this patch it does?
>
> Not quite... I think lollypop was reading the typelib in libsoup, but
> the shared library was just referenced by filename, not the absolute
> filename, and I think this was causing issues when trying to use libsoup
> from lollypop.

I see, thanks for explaining. In Guix, we usually resolve these
situations by native-search-paths, do you know if gobject-introspection
supports looking up the 'share/gir-1.0' directory from an environment
variable (similar to how GI_TYPELIB_PATH works today)? However...

Toggle quote (11 lines)
>
> On master:
>
> grep shared-library /gnu/store/bafaiiblr2vmmf1zvidkw1137ndqnqg2-libsoup-2.66.2/share/gir-1.0/Soup-2.4.gir
> shared-library="libsoup-2.4.so.1"
>
> On core-updates:
>
> grep shared-library /gnu/store/b1ykh6xj11v7zav4r68v8qflk31cnddm-libsoup-2.66.2/share/gir-1.0/Soup-2.4.gir
> shared-library="/gnu/store/b1ykh6xj11v7zav4r68v8qflk31cnddm-libsoup-2.66.2/lib/libsoup-2.4.so.1"

...this is even better, so I am mostly just curious :-)

Toggle quote (42 lines)
>> A few comments about the patch:
>>
>>> diff --git a/gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch b/gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch
>>> index d00cc5a420..3c0bb1c6cf 100644
>>> --- a/gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch
>>> +++ b/gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch
>>> @@ -2,10 +2,131 @@
>>> # add the full path.
>>> #
>>> # This patch was provided by Luca Bruno <lucabru@src.gnome.org> for
>>> -# 'gobject-introspection' 1.40.0 in Nix.
>>> ---- ./giscanner/utils.py.orig 2014-08-14 22:05:05.055334080 +0200
>>> -+++ ./giscanner/utils.py 2014-08-14 22:05:24.687497334 +0200
>>> -@@ -110,17 +110,11 @@
>>> +# 'gobject-introspection' 1.40.0 in Nix.
>>> +#
>>> +# It has since been updated to work with newer versions of
>>> +# gobject-introspection.
>>> +--- a/giscanner/scannermain.py
>>> ++++ b/giscanner/scannermain.py
>>> +@@ -95,6 +95,39 @@ def get_windows_option_group(parser):
>>> + return group
>>> +
>>> +
>>> ++def _get_default_fallback_libpath():
>>> ++ # Newer multiple-output-optimized stdenv has an environment variable
>>> ++ # $outputLib which in turn specifies another variable which then is used as
>>> ++ # the destination for the library contents (${!outputLib}/lib).
>>> ++ store_path = os.environ.get(os.environ.get("outputLib")) if "outputLib" in os.environ else None
>>> ++ if store_path is None:
>>> ++ outputs = os.environ.get("outputs", "out").split()
>>
>> gnu-build-system does not currently export an "outputs" variable.
>> Perhaps it should?
>
> Ah, I didn't realise this part of the patch was as Nix specific as it
> is...
>
> At least for the change I was trying to affect, this seems to be
> probably redundant, or somehow doing the job. Maybe this part of the
> patch relating to the fallback_libpath should be removed.

I'd keep the "$outputs" logic, it sounds like a useful and easy change
to do in gnu-build-system, although maybe not for this 'core-updates'
round. We can use it in package recipes for fun and profit meanwhile.

However I doubt we'll ever use "outputLib", so it would be good to
remove that.

If you are updating the patch, could you also add a link to the upstream
patch, as well as one to this discussion?

Thank you!
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAl0jb4QACgkQoqBt8qM6
VPqcDAgAzh5OBm920W7x3miCb3EamzZSzWij+OMp0q+3vl0UU5bYaOQeUNlOJiZO
REkwR9cVwVobqiUAgBi5YOOsNa5tk6g/brC/1Pr4Z8QBtewmy6BR0hw5q40ywCaw
pf2Y4h2JR5rWBbMmoltN5ltJQv4kbbBAGZe0DQUDFNNhDFctTS/A9DXJB72bLPot
ag7xy6wYow2xUnYz7SAmfU1g835Mm9VhsaMHrvBL5/+nejHmt6dTarr+pszRqIRu
oEFznl+8MoK3z1W6R6GiYLezyR6RkMwOp1+H8gEVwJN1AWgiWgobKAbH4BjcWFxk
MFEZ8Mai3Pv7nr/BfxlzKWFOq+U3GQ==
=N53A
-----END PGP SIGNATURE-----

M
M
Marius Bakke wrote on 10 Jul 2019 19:35
(name . Christopher Baines)(address . mail@cbaines.net)(address . 36535@debbugs.gnu.org)
87tvbtn67a.fsf@devup.no
Marius Bakke <mbakke@fastmail.com> writes:

Toggle quote (39 lines)
> Christopher Baines <mail@cbaines.net> writes:
>
>> Marius Bakke <mbakke@fastmail.com> writes:
>>
>>> Hi Chris,
>>>
>>> Christopher Baines <mail@cbaines.net> writes:
>>>
>>>> Christopher Baines <mail@cbaines.net> writes:
>>>>
>>>>> Incorporate some changes from nixpkgs to the gobject-introspection package
>>>>> patches. This is motivated by looking at issues with libsoup and lollypop.
>>>>> This changes means that the share/gir-1.0/Soup-2.4.gir file within libsoup
>>>>> references libsoup-2.4.so.1 with an absolute filename, whereas previously, the
>>>>> filename wasn't absolute.
>>>>>
>>>>> * gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch:
>>>>> Incorporate changes from nixpkgs.
>>>>> ---
>>>>> ...ct-introspection-absolute-shlib-path.patch | 141 +++++++++++++++++-
>>>>> 1 file changed, 137 insertions(+), 4 deletions(-)
>>>>>
>>>>
>>>> I've pushed this as [1] to core-updates now, as I wanted to get it in
>>>> before the freeze.
>>>
>>> Thank you for addressing this. IIUC previously lollypop failed to
>>> retain a reference to libsoup-2.4.so.1, whereas with this patch it does?
>>
>> Not quite... I think lollypop was reading the typelib in libsoup, but
>> the shared library was just referenced by filename, not the absolute
>> filename, and I think this was causing issues when trying to use libsoup
>> from lollypop.
>
> I see, thanks for explaining. In Guix, we usually resolve these
> situations by native-search-paths, do you know if gobject-introspection
> supports looking up the 'share/gir-1.0' directory from an environment
> variable (similar to how GI_TYPELIB_PATH works today)? However...

Errh, ignore this, I need to study the GObject stuff one of these days...

Do you think you'll have time to update the patch within the coming
days? The only important part is the NIX_STORE bits; the rest can be
dealt with later.

TIA!
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAl0mIdkACgkQoqBt8qM6
VPpGzQf/eOscS/CyNZCfeOiA2+4+hRCC3Bo4MEv6wbG/7pyrPdqagRUxQIL7pa57
7fJJl2P2yb9gohelnLe5BlJSleiqGBcfSCpHzOATIR8z92nc1JTIRPg6XkC4+Ib0
fwYQ2tkgMkRIWp5BJLMWkSR1d3OVgniCQ0A+RX/S3A8yZW2b3q1MpRXVy6i/gfLS
T9vxP6IThfj5CL+NZ+jOkBxfiq80mYlWsmt2vH3P068ds3ZZ/pYyFNrII/JMLYNp
2cluEKRUCFr1HM22Pj3xFBQUHjfkSQvlXCwRCQg0vW9RTsRArPAjmIy7Ze6I+x+/
2/dmMahu9fZc+72TozU65yYhX55+rQ==
=mrFo
-----END PGP SIGNATURE-----

M
M
Marius Bakke wrote on 12 Jul 2019 20:44
(name . Christopher Baines)(address . mail@cbaines.net)(address . 36535@debbugs.gnu.org)
87zhljks93.fsf@devup.no
severity 36535 important

Toggle quote (22 lines)
>>>> ++def _get_default_fallback_libpath():
>>>> ++ # Newer multiple-output-optimized stdenv has an environment variable
>>>> ++ # $outputLib which in turn specifies another variable which then is used as
>>>> ++ # the destination for the library contents (${!outputLib}/lib).
>>>> ++ store_path = os.environ.get(os.environ.get("outputLib")) if "outputLib" in os.environ else None
>>>> ++ if store_path is None:
>>>> ++ outputs = os.environ.get("outputs", "out").split()
>>>
>>> gnu-build-system does not currently export an "outputs" variable.
>>> Perhaps it should?
>>
>> Ah, I didn't realise this part of the patch was as Nix specific as it
>> is...
>>
>> At least for the change I was trying to affect, this seems to be
>> probably redundant, or somehow doing the job. Maybe this part of the
>> patch relating to the fallback_libpath should be removed.
>
> I'd keep the "$outputs" logic, it sounds like a useful and easy change
> to do in gnu-build-system, although maybe not for this 'core-updates'
> round. We can use it in package recipes for fun and profit meanwhile.

We now have a user of the $outputs variable:


Incidentally, the package was broken because of the very same feature :-)

But we can not merge this with the hard-coded /gnu/store paths, as that
is likely to cause strange problems for users with a non-default store
prefix.

Unless someone steps up to fix it within a few days, I think we'll have
to revert it for now.
C
C
Christopher Baines wrote on 13 Jul 2019 01:22
(name . Marius Bakke)(address . mbakke@fastmail.com)(address . 36535@debbugs.gnu.org)
87v9w6zvl8.fsf@cbaines.net
Marius Bakke <mbakke@fastmail.com> writes:

Toggle quote (28 lines)
> severity 36535 important
>
>>>>> ++def _get_default_fallback_libpath():
>>>>> ++ # Newer multiple-output-optimized stdenv has an environment variable
>>>>> ++ # $outputLib which in turn specifies another variable which then is used as
>>>>> ++ # the destination for the library contents (${!outputLib}/lib).
>>>>> ++ store_path = os.environ.get(os.environ.get("outputLib")) if "outputLib" in os.environ else None
>>>>> ++ if store_path is None:
>>>>> ++ outputs = os.environ.get("outputs", "out").split()
>>>>
>>>> gnu-build-system does not currently export an "outputs" variable.
>>>> Perhaps it should?
>>>
>>> Ah, I didn't realise this part of the patch was as Nix specific as it
>>> is...
>>>
>>> At least for the change I was trying to affect, this seems to be
>>> probably redundant, or somehow doing the job. Maybe this part of the
>>> patch relating to the fallback_libpath should be removed.
>>
>> I'd keep the "$outputs" logic, it sounds like a useful and easy change
>> to do in gnu-build-system, although maybe not for this 'core-updates'
>> round. We can use it in package recipes for fun and profit meanwhile.
>
> We now have a user of the $outputs variable:
>
> https://git.savannah.gnu.org/cgit/guix.git/commit/?id=7555d539245ff3456848c02d61f9e601ee5af463

Ooh, interesting :)

Toggle quote (9 lines)
> Incidentally, then package was broken because of the very same feature :-)
>
> But we can not merge this with the hard-coded /gnu/store paths, as that
> is likely to cause strange problems for users with a non-default store
> prefix.
>
> Unless someone steps up to fix it within a few days, I think we'll have
> to revert it for now.

I have some time now to look at this, I'm currently building libsoup
with these changes to the patch.


modified gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch
@@ -61,12 +61,14 @@
parser.add_option_group(group)
--- a/giscanner/shlibs.py
+++ b/giscanner/shlibs.py
-@@ -57,6 +57,12 @@ def _ldd_library_pattern(library_name):
+@@ -57,6 +57,14 @@ def _ldd_library_pattern(library_name):
$""" % re.escape(library_name), re.VERBOSE)
+def _ldd_library_guix_pattern(library_name):
-+ store_dir = re.escape('/gnu/store')
++ store_dir = re.escape(
++ os.environ.get("NIX_STORE", default="/gnu/store")
++ )
+ pattern = r'(%s(?:/[^/]*)+lib%s[^A-Za-z0-9_-][^\s\(\)]*)'
+ return re.compile(pattern % (store_dir, re.escape(library_name)))
+
@@ -109,14 +111,15 @@
if len(patterns) == 0:
return []
-@@ -139,8 +145,11 @@ def resolve_from_ldd_output(libraries, output):
+@@ -139,8 +145,12 @@ def resolve_from_ldd_output(libraries, output):
if line.endswith(':'):
continue
for word in line.split():
- for library, pattern in patterns.items():
- m = pattern.match(word)
+ for library, (pattern, guix_pattern) in patterns.items():
-+ if line.find('/gnu/store') != -1:
++ store_dir = os.environ.get("NIX_STORE", default="/gnu/store")
++ if line.find(store_dir) != -1:
+ m = guix_pattern.match(word)
+ else:
+ m = pattern.match(word)
-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAl0pFlNfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE
9XdLag//dOnNp6O2zgepM3LtiryRdbIkyVslnNr9kWdZ0X463x1lZKoIQLFCji1q
BXsgRo7yNZ8eqaAOXSoLM4MQD8rk90/s1x5jGmUb0Cs1LfX2PHo14UWdPWTvhSxy
jTgRu71CFCFvhBuzxrEkhea+GHo7hQc3N63y+fVQhAGO6TLzBGhditWioQPSMF/3
Lnsku0Wt3EUfms3xIpdDA20lfEBL6dvGKWvWy1rYNFpSDUAQpComDBvp9allz/0D
WYs/Q23Hw7QD2SkvTzKUJtMhSbCskoEUAEj3IjDmrsEQdbevhDBisUzJXn9/zuls
ybf0B+lNSFEQJv1deJM4YOlPOFBTDWcZAwn+OzPbvhR87nmoqwHFZ79W7vXXeC0z
Alg8EDHW+segc+r3lOqF92RsAAnq4NhCzVDU2aI9SKKi4MzEFfrAAsbI1PkUp2DH
z0ZiJLP+b3wa3ygHOpBS1smy92OmK67yG9Wpkbq2fSE7PIYzC2Eah8ZFmmpgXZ8k
8OU9oHQdNM53Vs2CXx1LkyOcgGNyToHrnFiV6accdkl6/LqNwph6Mb5r6t/6pi20
dvZhAZx0r7BP7Fm+V9IVGnK9okyemggFpWTW27InGWbLfDd/7GaLdkBH1tHBw4Y4
ce5L8P/ajMXf+Ot44UjQ/QjTHRFh04jXLyFf7ezSlkYFIeMUB2Q=
=DfBw
-----END PGP SIGNATURE-----

C
C
Christopher Baines wrote on 13 Jul 2019 13:09
[PATCH] gnu: gobject-introspection: Remove hardcoded store from patch.
(name . Marius Bakke)(address . mbakke@fastmail.com)(address . 36535@debbugs.gnu.org)
20190713110950.13428-1-mail@cbaines.net
* gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch: Use
the NIX_STORE environment variable, rather than hardcoding the store
directory.
---
.../gobject-introspection-absolute-shlib-path.patch | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

Toggle diff (41 lines)
diff --git a/gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch b/gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch
index 3c0bb1c6cf..956fa617c3 100644
--- a/gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch
+++ b/gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch
@@ -61,12 +61,14 @@
      parser.add_option_group(group)
 --- a/giscanner/shlibs.py
 +++ b/giscanner/shlibs.py
-@@ -57,6 +57,12 @@ def _ldd_library_pattern(library_name):
+@@ -57,6 +57,14 @@ def _ldd_library_pattern(library_name):
      $""" % re.escape(library_name), re.VERBOSE)
  
  
 +def _ldd_library_guix_pattern(library_name):
-+    store_dir = re.escape('/gnu/store')
++    store_dir = re.escape(
++      os.environ.get("NIX_STORE", default="/gnu/store")
++    )
 +    pattern = r'(%s(?:/[^/]*)+lib%s[^A-Za-z0-9_-][^\s\(\)]*)'
 +    return re.compile(pattern % (store_dir, re.escape(library_name)))
 +
@@ -109,14 +111,15 @@
      if len(patterns) == 0:
          return []
  
-@@ -139,8 +145,11 @@ def resolve_from_ldd_output(libraries, output):
+@@ -139,8 +145,12 @@ def resolve_from_ldd_output(libraries, output):
          if line.endswith(':'):
              continue
          for word in line.split():
 -            for library, pattern in patterns.items():
 -                m = pattern.match(word)
 +            for library, (pattern, guix_pattern) in patterns.items():
-+                if line.find('/gnu/store') != -1:
++                store_dir = os.environ.get("NIX_STORE", default="/gnu/store")
++                if line.find(store_dir) != -1:
 +                    m = guix_pattern.match(word)
 +                else:
 +                    m = pattern.match(word)
-- 
2.22.0
C
C
Christopher Baines wrote on 13 Jul 2019 13:11
Re: [bug#36535] [PATCH] gnu: gobject-introspection: Update absolute-shlib-path.patch.
(name . Marius Bakke)(address . mbakke@fastmail.com)(address . 36535@debbugs.gnu.org)
87tvbqyysy.fsf@cbaines.net
Christopher Baines <mail@cbaines.net> writes:

Toggle quote (3 lines)
> I have some time now to look at this, I'm currently building libsoup
> with these changes to the patch.

I've now send a patch with these changes. I've managed to build libsoup
with it, and the .gir files look good.
-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAl0pvE1fFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE
9XcaXxAAlhYD8GGPYVERbMXkTXlEyrRW94KlemLdNUSxomFXuTtMyhmVQ/oTvT1c
MrDzVCH4yysv0MUSA+2h29wHC87Mklqs/4hwSOCU36IloJ+gyhkmWFlIi4qIydkN
HVhOaDXahaQLAnWrgmoTiSiELZ9bZjbWZVg/MAlso1Zg9rA4GhwOwwGWAyUIT2Fa
vn2CMfpduMr8JSb9b8/hsoq9rFuDjR7A777lbrvpwJQBzz2X54Pe4TYK5KHB4Mp6
+/ozi76NjcqOmeOMBVXlFd/a1nb44vyekUhoRqo29ZGdsRlvTh3rVK0aNrpSj4pz
703C02/LHn6YDbivW0X5C2Ocr8sQqJ1E+p3sldKPPASdz0I+5P9g6w6K+XO2mwPW
jc5aSPKHJsreoWL9NbyHakjnxeR52ar9Y2yenuxkpOo4aP0QwOywIQwisQjCqIHw
4TfO479YsfE9DshyM508bI7GoSq/oefrGTrwxoDfh/SuBBOSMztqAQ/gM+Aym568
Hdl1QfkJqfW9QjB8ceKI8T1BviCnDvvcnAbZHR5kVR+FV8BwQLcUP6nowzNMR8jb
7mFFJjIGfz3SS6fBTtCwq+XWtItsV2q1N2x1CDCtP1zVi7gfisP+PMlDsdrSptDV
7UPJ+FP8FY/2/3h9nyd6yzZK+5yqEdYR+QU8hSGOfkI5rDnrZ2s=
=LPCr
-----END PGP SIGNATURE-----

M
M
Marius Bakke wrote on 13 Jul 2019 18:46
(name . Christopher Baines)(address . mail@cbaines.net)(address . 36535@debbugs.gnu.org)
87tvbplw68.fsf@devup.no
Christopher Baines <mail@cbaines.net> writes:

Toggle quote (8 lines)
> Christopher Baines <mail@cbaines.net> writes:
>
>> I have some time now to look at this, I'm currently building libsoup
>> with these changes to the patch.
>
> I've now send a patch with these changes. I've managed to build libsoup
> with it, and the .gir files look good.

Thank you! The changes LGTM.
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAl0qCt8ACgkQoqBt8qM6
VPpAfAf/Uz2Sz5qrOm8ShcnPSlFJD8pn/UZlK11lpg7TBK9Rrx/4JCmUyID0jgTZ
nVHbGQOpHZ1lYJLSLwQhrCDl2OHAb8/dN0gsU660Q0zoGF7rdfp5mdhTwkrP7pnK
cTZ1B7um5IuyiinQLAr9VgK1z2NnaA/mwYC4xjF4XU4iq0NWQgX7WeJUu1vTCayy
c65MtTRW3Zanqu7JqBVOMz2bhWezXsfwwI3q/MjwWPH7L/i+upi8bmGUG2RcAuzZ
e+owoX1zrI3AA+r7cUqeYi84XTt/2EjwyovOB+kvZdZ4wnHwe/OpXY37s5Yvb/d2
DmO0cu5AK8z353TBdrIxvXsczUTxTg==
=v58H
-----END PGP SIGNATURE-----

C
C
Christopher Baines wrote on 14 Jul 2019 00:14
(name . Marius Bakke)(address . mbakke@fastmail.com)(address . 36535-done@debbugs.gnu.org)
87r26tzio5.fsf@cbaines.net
Marius Bakke <mbakke@fastmail.com> writes:

Toggle quote (12 lines)
> Christopher Baines <mail@cbaines.net> writes:
>
>> Christopher Baines <mail@cbaines.net> writes:
>>
>>> I have some time now to look at this, I'm currently building libsoup
>>> with these changes to the patch.
>>
>> I've now send a patch with these changes. I've managed to build libsoup
>> with it, and the .gir files look good.
>
> Thank you! The changes LGTM.

Great, I've pushed this to core-updates now.
-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAl0qV7pfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE
9XcQtA//VosNsVi3qknUbrW4g0bkLERoWG4po3XnfTxvyD/YZzpWYmz36LLxG0dh
JB+uyHPoyjxh167KwlzSdOzrn+2vH/VE8tQTIrQi66NBq2/M2nIX1lS8x+K4Ubo+
MLWh8cQ0qj/geT81ImVhNZVW9jG4ocDmtdCEsZkLhLYJES7KiKmsT1GXSNdN2sNB
hERgekVsANsIb2AVGFDNMcHmu+6aBv8fDeLAriry9efsiRlsGtcvHpfgLpgVAyw9
kWUkjT/MroKAbTTUgclTxIxhB9jZOFhaQMpRaRhbK5pN4D/nariMyIuM9hStaMj8
RFGLMWRfuC/hrDLo+GwkiaQxy+8/g/CRDcbRawO6FS+aOQjRlgc1ziFvAd0IEhBj
uE1dbX2uPNNZY72f+/m+oyoqcQnP1xqo0XfdHPIAFoKoAZuDKUfq0xEoVodgrT5V
XYKmVgR0lVt2x2OFtOErkcOwhR7TYLqDY9ylqBENaZXS8jlwBITaPCo4/JKXOCec
HfUH3Ji/AGXKSZvwLqr7nGYMv3M8bKjT69xKPWJ/kSdkxgCR0wYZvZRLV1ctqZnB
vjrlu8Oh9oYqTTIjjGw3VPbJBU+IWAoV3nq7cAU5brXAEC6kAca6v4qbB7YyvVD0
wdxCMC1/lz1NjkJGbOU+RmBslgIufxwBNviRMGgQ05LM8mEf1LY=
=dR/1
-----END PGP SIGNATURE-----

Closed
?
Your comment

This issue is archived.

To comment on this conversation send email to 36535@debbugs.gnu.org