From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:38768) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hk4jH-0002Ba-MM for guix-patches@gnu.org; Sun, 07 Jul 2019 06:49:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hk4jF-0005bC-R4 for guix-patches@gnu.org; Sun, 07 Jul 2019 06:49:11 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:47359) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hk4j7-0005Xc-SM for guix-patches@gnu.org; Sun, 07 Jul 2019 06:49:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hk4j7-0004g7-Pd for guix-patches@gnu.org; Sun, 07 Jul 2019 06:49:01 -0400 Subject: [bug#36535] [PATCH] gnu: gobject-introspection: Update absolute-shlib-path.patch. Resent-Message-ID: Received: from eggs.gnu.org ([2001:470:142:3::10]:38606) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hk4iT-00027Q-2V for guix-patches@gnu.org; Sun, 07 Jul 2019 06:48:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hk4iO-0005Au-BL for guix-patches@gnu.org; Sun, 07 Jul 2019 06:48:18 -0400 Received: from mira.cbaines.net ([212.71.252.8]:35216) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hk4iO-00056p-2R for guix-patches@gnu.org; Sun, 07 Jul 2019 06:48:16 -0400 Received: from localhost (cpc102582-walt20-2-0-cust14.13-2.cable.virginm.net [86.27.34.15]) by mira.cbaines.net (Postfix) with ESMTPSA id CF5E3163F3 for ; Sun, 7 Jul 2019 11:48:03 +0100 (BST) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id d4936012 for ; Sun, 7 Jul 2019 10:48:03 +0000 (UTC) From: Christopher Baines Date: Sun, 7 Jul 2019 11:48:03 +0100 Message-Id: <20190707104803.23662-1-mail@cbaines.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 36535@debbugs.gnu.org Incorporate some changes from nixpkgs to the gobject-introspection packag= e patches. This is motivated by looking at issues with libsoup and lollypo= p. This changes means that the share/gir-1.0/Soup-2.4.gir file within libsou= p 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(-) diff --git a/gnu/packages/patches/gobject-introspection-absolute-shlib-pa= th.patch b/gnu/packages/patches/gobject-introspection-absolute-shlib-path= .patch index d00cc5a420..3c0bb1c6cf 100644 --- a/gnu/packages/patches/gobject-introspection-absolute-shlib-path.patc= h +++ b/gnu/packages/patches/gobject-introspection-absolute-shlib-path.patc= h @@ -2,10 +2,131 @@ # add the full path. # # This patch was provided by Luca Bruno for=20 -# 'gobject-introspection' 1.40.0 in Nix.=20 ---- ./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 +=20 +=20 ++def _get_default_fallback_libpath(): ++ # Newer multiple-output-optimized stdenv has an environment variabl= e ++ # $outputLib which in turn specifies another variable which then is= used as ++ # the destination for the library contents (${!outputLib}/lib). ++ store_path =3D os.environ.get(os.environ.get("outputLib")) if "outp= utLib" in os.environ else None ++ if store_path is None: ++ outputs =3D os.environ.get("outputs", "out").split() ++ if "lib" in outputs: ++ # For multiple output derivations let's try whether there i= s a $lib ++ # environment variable and use that as the base store path. ++ store_path =3D os.environ.get("lib") ++ elif "out" in outputs: ++ # Otherwise we have a single output derivation, so the libr= aries ++ # most certainly will end up in "$out/lib". ++ store_path =3D os.environ.get("out") ++ ++ if store_path is not None: ++ # Even if we have a $lib as output, there still should be a $li= b/lib ++ # directory. ++ return os.path.join(store_path, 'lib') ++ else: ++ # If we haven't found a possible scenario, let's return an empt= y 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 af= ter all ++ # we can still use --fallback-library-path to set one. ++ # ++ # Also, we're not returning None, because that would make it ve= ry ++ # difficult to disable adding fallback paths altogether using s= omething ++ # like: --fallback-library-path=3D"" ++ return "" ++ ++ + def _get_option_parser(): + parser =3D optparse.OptionParser('%prog [options] sources', + version=3D'%prog ' + giscanner.__ver= sion__) +@@ -205,6 +238,10 @@ match the namespace prefix.""") + parser.add_option("", "--filelist", + action=3D"store", dest=3D"filelist", default=3D[]= , + help=3D"file containing headers and sources to be= scanned") ++ parser.add_option("", "--fallback-library-path", ++ action=3D"store", dest=3D"fallback_libpath", ++ default=3D_get_default_fallback_libpath(), ++ help=3D"Path to prepend to unknown shared librari= es") +=20 + group =3D 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) +=20 +=20 ++def _ldd_library_guix_pattern(library_name): ++ store_dir =3D re.escape('/gnu/store') ++ pattern =3D 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 =3D output.decode("utf-8", "replace") +=20 + shlibs =3D resolve_from_ldd_output(libraries, output) +- return list(map(sanitize_shlib_path, shlibs)) ++ fallback_libpath =3D options.fallback_libpath or ""; ++ return list(map(lambda p: os.path.join(fallback_libpath, p), ma= p(sanitize_shlib_path, shlibs))) +=20 +=20 + 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 =3D=3D "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 +=20 +=20 + def resolve_from_ldd_output(libraries, output): + patterns =3D {} + for library in libraries: + if not os.path.isfile(library): +- patterns[library] =3D _ldd_library_pattern(library) ++ patterns[library] =3D (_ldd_library_pattern(library), _ldd_= library_guix_pattern(library)) + if len(patterns) =3D=3D 0: + return [] +=20 +@@ -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 =3D pattern.match(word) ++ for library, (pattern, guix_pattern) in patterns.items(): ++ if line.find('/gnu/store') !=3D -1: ++ m =3D guix_pattern.match(word) ++ else: ++ m =3D 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 =20 @@ -28,3 +149,15 @@ =20 =20 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): +=20 + self.assertEqual( + sanitize_shlib_path('/foo/bar'), +- '/foo/bar' if sys.platform =3D=3D 'darwin' else 'bar') ++ # Always use an absolute filename for Guix ++ '/foo/bar') +=20 + def test_unresolved_library(self): +output =3D '' --=20 2.22.0