From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:41044) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hkUXp-0006m9-3M for guix-patches@gnu.org; Mon, 08 Jul 2019 10:23:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hkUXm-0001vU-Bk for guix-patches@gnu.org; Mon, 08 Jul 2019 10:23:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:50466) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hkUXm-0001vM-5O for guix-patches@gnu.org; Mon, 08 Jul 2019 10:23:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hkUXl-0007d4-UG for guix-patches@gnu.org; Mon, 08 Jul 2019 10:23:01 -0400 Subject: [bug#36535] [PATCH] gnu: gobject-introspection: Update absolute-shlib-path.patch. Resent-Message-ID: From: Marius Bakke In-Reply-To: <87d0il9deh.fsf@cbaines.net> References: <20190707104803.23662-1-mail@cbaines.net> <87d0il9deh.fsf@cbaines.net> Date: Mon, 08 Jul 2019 16:21:58 +0200 Message-ID: <875zocr4hl.fsf@devup.no> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" 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: Christopher Baines , 36535-done@debbugs.gnu.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi Chris, Christopher Baines writes: > Christopher Baines writes: > >> Incorporate some changes from nixpkgs to the gobject-introspection packa= ge >> patches. This is motivated by looking at issues with libsoup and lollyp= op. >> This changes means that the share/gir-1.0/Soup-2.4.gir file within libso= up >> references libsoup-2.4.so.1 with an absolute filename, whereas previousl= y, 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: > diff --git a/gnu/packages/patches/gobject-introspection-absolute-shlib-pa= th.patch b/gnu/packages/patches/gobject-introspection-absolute-shlib-path.p= atch > 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 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 variable > ++ # $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() gnu-build-system does not currently export an "outputs" variable. Perhaps it should? > ++ 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") 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 $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') 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. > ++ 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: Use $NIX_STORE here, too. Other than that LGTM. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAl0jUYYACgkQoqBt8qM6 VPoxlwgAvgaRHOLYSc/d0jreL57XpLIli70duhyKOFcLJN7ylPdNIUbPF29US5Z0 Yswa0mvyZo4VOEIobCnfPiJrf/dmpDCYOTepANaz9ybqnuwPlkriq7xEvOxlz8L7 qhkTttqVZoFK6OVkRBA1MM3LEmXf49UKiVLH19wjSH/T+eNijULZzvYF5kdH4Sc0 OioafwMLlqpe3KkM5QJxByV/pEpGmbMrnhhUX089m8Cq4lAV3Ml3+eRbKAUNG24j aqLqPaE9MqqymINk0N7jyy927uRhNBm6brYOoB4geyQ+HpqlZAz3AhDpASOMsOP/ 6y6NN48sGwU5ZrYoMZP8Jue9dX0xBw== =yx8y -----END PGP SIGNATURE----- --=-=-=--