gobject-introspection: 1.60.0 -> 1.60.1
Updated the shlib patches: - Upstream now forces basename in sanitize_shlib_path(lib) if the system isn't darwin. We patch the function to always prefer absolute paths - Due to the above we no longer need the macos patch - `sanitize_shlib_path` is applied after `resolve_from_ldd_output` so we need to apply `fallback_libpath` afterwards too (else we get stuff like `/nix/store/...@rpath/foo.dylib` on darwin) - Note that the `fallback_path` no longer have any unit tests https://gitlab.gnome.org/GNOME/gobject-introspection/blob/1.60.1/NEWS
This commit is contained in:
parent
ee3729938d
commit
d747f1602d
|
@ -1,6 +1,6 @@
|
||||||
--- a/giscanner/scannermain.py
|
--- a/giscanner/scannermain.py
|
||||||
+++ b/giscanner/scannermain.py
|
+++ b/giscanner/scannermain.py
|
||||||
@@ -101,6 +101,39 @@
|
@@ -95,6 +95,39 @@ def get_windows_option_group(parser):
|
||||||
return group
|
return group
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
def _get_option_parser():
|
def _get_option_parser():
|
||||||
parser = optparse.OptionParser('%prog [options] sources',
|
parser = optparse.OptionParser('%prog [options] sources',
|
||||||
version='%prog ' + giscanner.__version__)
|
version='%prog ' + giscanner.__version__)
|
||||||
@@ -211,6 +244,10 @@
|
@@ -205,6 +238,10 @@ match the namespace prefix.""")
|
||||||
parser.add_option("", "--filelist",
|
parser.add_option("", "--filelist",
|
||||||
action="store", dest="filelist", default=[],
|
action="store", dest="filelist", default=[],
|
||||||
help="file containing headers and sources to be scanned")
|
help="file containing headers and sources to be scanned")
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
parser.add_option_group(group)
|
parser.add_option_group(group)
|
||||||
--- a/giscanner/shlibs.py
|
--- a/giscanner/shlibs.py
|
||||||
+++ b/giscanner/shlibs.py
|
+++ b/giscanner/shlibs.py
|
||||||
@@ -62,6 +62,12 @@
|
@@ -57,6 +57,12 @@ def _ldd_library_pattern(library_name):
|
||||||
$""" % re.escape(library_name), re.VERBOSE)
|
$""" % re.escape(library_name), re.VERBOSE)
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,21 +66,33 @@
|
||||||
# This is a what we do for non-la files. We assume that we are on an
|
# 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
|
# ELF-like system where ldd exists and the soname extracted with ldd is
|
||||||
# a filename that can be opened with dlopen().
|
# a filename that can be opened with dlopen().
|
||||||
@@ -110,17 +116,16 @@ def _resolve_non_libtool(options, binary, libraries):
|
@@ -106,7 +112,8 @@ def _resolve_non_libtool(options, binary, libraries):
|
||||||
if isinstance(output, bytes):
|
|
||||||
output = output.decode("utf-8", "replace")
|
output = output.decode("utf-8", "replace")
|
||||||
|
|
||||||
- # Use absolute paths on OS X to conform to how libraries are usually
|
shlibs = resolve_from_ldd_output(libraries, output)
|
||||||
- # referenced on OS X systems, and file names everywhere else.
|
- return list(map(sanitize_shlib_path, shlibs))
|
||||||
- basename = platform.system() != 'Darwin'
|
+ fallback_libpath = options.fallback_libpath or "";
|
||||||
- return resolve_from_ldd_output(libraries, output, basename=basename)
|
+ return list(map(lambda p: os.path.join(fallback_libpath, p), map(sanitize_shlib_path, shlibs)))
|
||||||
+ # Never strip away absolute paths in Nix
|
|
||||||
+ basename = False
|
|
||||||
+ return resolve_from_ldd_output(libraries, output, basename=basename, fallback_libpath=options.fallback_libpath)
|
|
||||||
|
|
||||||
|
|
||||||
-def resolve_from_ldd_output(libraries, output, basename=False):
|
def sanitize_shlib_path(lib):
|
||||||
+def resolve_from_ldd_output(libraries, output, basename=False, fallback_libpath=""):
|
@@ -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 = {}
|
patterns = {}
|
||||||
for library in libraries:
|
for library in libraries:
|
||||||
if not os.path.isfile(library):
|
if not os.path.isfile(library):
|
||||||
|
@ -89,7 +101,7 @@
|
||||||
if len(patterns) == 0:
|
if len(patterns) == 0:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
@@ -129,11 +134,14 @@ def resolve_from_ldd_output(libraries, output, basename=False):
|
@@ -139,8 +145,11 @@ def resolve_from_ldd_output(libraries, output):
|
||||||
if line.endswith(':'):
|
if line.endswith(':'):
|
||||||
continue
|
continue
|
||||||
for word in line.split():
|
for word in line.split():
|
||||||
|
@ -102,14 +114,10 @@
|
||||||
+ m = pattern.match(word)
|
+ m = pattern.match(word)
|
||||||
if m:
|
if m:
|
||||||
del patterns[library]
|
del patterns[library]
|
||||||
- shlibs.append(_sanitize_install_name(m.group()))
|
shlibs.append(m.group())
|
||||||
+ shlibs.append(os.path.join(fallback_libpath, _sanitize_install_name(m.group())))
|
|
||||||
break
|
|
||||||
|
|
||||||
if len(patterns) > 0:
|
|
||||||
--- a/giscanner/utils.py
|
--- a/giscanner/utils.py
|
||||||
+++ b/giscanner/utils.py
|
+++ b/giscanner/utils.py
|
||||||
@@ -116,17 +116,11 @@
|
@@ -111,17 +111,11 @@ def extract_libtool_shlib(la_file):
|
||||||
if dlname is None:
|
if dlname is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
pname = "gobject-introspection";
|
pname = "gobject-introspection";
|
||||||
version = "1.60.0";
|
version = "1.60.1";
|
||||||
in
|
in
|
||||||
with stdenv.lib;
|
with stdenv.lib;
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
|
@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
|
url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
|
||||||
sha256 = "0pgk9lcvz3i79m6g2ynlp00ghws7g0p0d5qyf0k72warrf841zly";
|
sha256 = "1cr4r3lh5alrks9q2ycs1kn2crnkhrhn2wrmibng6dndkr4x2i6q";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = [ "out" "dev" "man" ];
|
outputs = [ "out" "dev" "man" ];
|
||||||
|
@ -40,7 +40,6 @@ stdenv.mkDerivation rec {
|
||||||
setupHook = ./setup-hook.sh;
|
setupHook = ./setup-hook.sh;
|
||||||
|
|
||||||
patches = [
|
patches = [
|
||||||
./macos-shared-library.patch
|
|
||||||
(substituteAll {
|
(substituteAll {
|
||||||
src = ./test_shlibs.patch;
|
src = ./test_shlibs.patch;
|
||||||
inherit nixStoreDir;
|
inherit nixStoreDir;
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
diff --git a/giscanner/shlibs.py b/giscanner/shlibs.py
|
|
||||||
index c93d20c..4d4915d 100644
|
|
||||||
--- a/giscanner/shlibs.py
|
|
||||||
+++ b/giscanner/shlibs.py
|
|
||||||
@@ -43,6 +43,22 @@ def _resolve_libtool(options, binary, libraries):
|
|
||||||
|
|
||||||
return shlibs
|
|
||||||
|
|
||||||
+def _sanitize_install_name(install_name):
|
|
||||||
+ '''
|
|
||||||
+ On macOS, the dylib can be built with install_name as @rpath/libfoo.so
|
|
||||||
+ instead of the absolute path to the library, so handle that. The name
|
|
||||||
+ can also be @loader_path or @executable_path.
|
|
||||||
+ '''
|
|
||||||
+ if not install_name.startswith('@'):
|
|
||||||
+ return install_name
|
|
||||||
+ if install_name.startswith('@rpath/'):
|
|
||||||
+ return install_name[7:]
|
|
||||||
+ if install_name.startswith('@loader_path/'):
|
|
||||||
+ return install_name[13:]
|
|
||||||
+ if install_name.startswith('@executable_path/'):
|
|
||||||
+ return install_name[17:]
|
|
||||||
+ raise RuntimeError('Unknown install_name {!r}'.format(install_name))
|
|
||||||
+
|
|
||||||
|
|
||||||
# Assume ldd output is something vaguely like
|
|
||||||
#
|
|
||||||
@@ -136,7 +152,7 @@ def resolve_from_ldd_output(libraries, output, basename=False):
|
|
||||||
m = pattern.match(word)
|
|
||||||
if m:
|
|
||||||
del patterns[library]
|
|
||||||
- shlibs.append(m.group())
|
|
||||||
+ shlibs.append(_sanitize_install_name(m.group()))
|
|
||||||
break
|
|
||||||
|
|
||||||
if len(patterns) > 0:
|
|
|
@ -1,6 +1,6 @@
|
||||||
--- a/tests/scanner/test_shlibs.py
|
--- a/tests/scanner/test_shlibs.py
|
||||||
+++ b/tests/scanner/test_shlibs.py
|
+++ b/tests/scanner/test_shlibs.py
|
||||||
@@ -10,6 +10,46 @@ from giscanner.shlibs import resolve_from_ldd_output
|
@@ -7,6 +7,30 @@ from giscanner.shlibs import resolve_from_ldd_output, sanitize_shlib_path
|
||||||
|
|
||||||
class TestLddParser(unittest.TestCase):
|
class TestLddParser(unittest.TestCase):
|
||||||
|
|
||||||
|
@ -26,25 +26,18 @@
|
||||||
+ self.assertEqual(
|
+ self.assertEqual(
|
||||||
+ ['@nixStoreDir@/gmrf09y7sfxrr0mcx90dba7w41jj2kzk-glib-2.58.1/lib/libglib-2.0.so.0',
|
+ ['@nixStoreDir@/gmrf09y7sfxrr0mcx90dba7w41jj2kzk-glib-2.58.1/lib/libglib-2.0.so.0',
|
||||||
+ '@nixStoreDir@/gmrf09y7sfxrr0mcx90dba7w41jj2kzk-glib-2.58.1/lib/libgio-2.0.so.0'],
|
+ '@nixStoreDir@/gmrf09y7sfxrr0mcx90dba7w41jj2kzk-glib-2.58.1/lib/libgio-2.0.so.0'],
|
||||||
+ resolve_from_ldd_output(libraries, output, basename=False))
|
+ resolve_from_ldd_output(libraries, output))
|
||||||
+
|
|
||||||
+ def test_resolve_from_ldd_output_macos(self):
|
|
||||||
+ output = '''\
|
|
||||||
+ @rpath/libatk-1.0.0.dylib
|
|
||||||
+ @rpath/libgstreamer-1.0.0.dylib (compatibility version 0.0.0, current version 0.0.0)
|
|
||||||
+ /Volumes/USB_SSD/cerbero/build/dist/darwin_x86_64/lib/libglib-2.0.0.dylib (compatibility version 0.0.0, current version 0.0.0)
|
|
||||||
+ /Volumes/USB_SSD/cerbero/build/dist/darwin_x86_64/lib/libintl.dylib (compatibility version 0.0.0, current version 0.0.0)
|
|
||||||
+ /Volumes/USB_SSD/cerbero/build/dist/darwin_x86_64/lib/libgobject-2.0.0.dylib (compatibility version 0.0.0, current version 0.0.0)
|
|
||||||
+ /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)
|
|
||||||
+ '''
|
|
||||||
+ libraries = ['atk-1.0']
|
|
||||||
+ fallback_libpath = '@nixStoreDir@/1ynd5b01z87c1nw75k5iy7sq49hpkw53-atk-2.30.0/lib'
|
|
||||||
+
|
|
||||||
+ self.assertEqual(
|
|
||||||
+ [ '%s/libatk-1.0.0.dylib' % fallback_libpath ],
|
|
||||||
+ resolve_from_ldd_output(libraries, output, basename=False, fallback_libpath=fallback_libpath))
|
|
||||||
+
|
+
|
||||||
def test_resolve_from_ldd_output(self):
|
def test_resolve_from_ldd_output(self):
|
||||||
output = '''\
|
output = '''\
|
||||||
libglib-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fbe12d68000)
|
libglib-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fbe12d68000)
|
||||||
|
@@ -40,7 +64,8 @@ class TestLddParser(unittest.TestCase):
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
sanitize_shlib_path('/foo/bar'),
|
||||||
|
- '/foo/bar' if sys.platform == 'darwin' else 'bar')
|
||||||
|
+ # NixOS always want the absolute path
|
||||||
|
+ '/foo/bar')
|
||||||
|
|
||||||
|
def test_unresolved_library(self):
|
||||||
|
output = ''
|
||||||
|
|
Loading…
Reference in New Issue