Skip to content

Commit 909f901

Browse files
committed
Support resolving cross dependencies
Now that python 3.12 has been fixed so that it properly detects the host triple, shared objects now include this triple in the filename. This means that the filename search list for a module called `foo` is now: pkg.debug.depend.file=64/foo.abi3.so pkg.debug.depend.file=64/foo.cpython-312-x86_64-pc-solaris2.so pkg.debug.depend.file=64/foo.so pkg.debug.depend.file=foo.abi3.so pkg.debug.depend.file=foo.cpython-312-x86_64-pc-solaris2.so pkg.debug.depend.file=foo.py pkg.debug.depend.file=foo.pyc pkg.debug.depend.file=foo.pyo pkg.debug.depend.file=foo.so pkg.debug.depend.file=foo/__init__.py This obviously doesn't work for aarch64, and we were effectively getting away with it before because the shared objects were just named foo.cpython-312.so. With this patch, if the environment contains PKG_CROSS_DEPEND=aarch64-unknown-solaris2 the search list is: pkg.debug.depend.file=foo.abi3.so pkg.debug.depend.file=foo.cpython-312-aarch64-unknown-solaris2.so pkg.debug.depend.file=foo.py pkg.debug.depend.file=foo.pyc pkg.debug.depend.file=foo.pyo pkg.debug.depend.file=foo.so pkg.debug.depend.file=foo/__init__.py Note also that the 64/ paths have been removed.
1 parent ac092d8 commit 909f901

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/modules/flavor/depthlimitedmf.py

+16-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Software Foundation; All Rights Reserved
44
#
55
# Copyright (c) 2012, 2022, Oracle and/or its affiliates.
6+
# Copyright 2024 OmniOS Community Edition (OmniOSce) Association.
67

78

89
"""A standalone version of ModuleFinder which limits the depth of exploration
@@ -66,9 +67,21 @@ def __init__(self, name, dirs, builtin=False):
6667
"64/{0}module.so",
6768
]
6869
else:
69-
self.patterns += [
70-
"{{0}}{0}".format(s) for s in EXTENSION_SUFFIXES
71-
] + ["64/{{0}}{0}".format(s) for s in EXTENSION_SUFFIXES]
70+
try:
71+
cross_env = os.environ["PKG_CROSS_DEPEND"]
72+
suffixes = []
73+
for s in EXTENSION_SUFFIXES:
74+
if s.endswith("solaris2.so"):
75+
s = "{}-{}.so".format(
76+
"-".join(s.split("-")[:2]), cross_env
77+
)
78+
suffixes.append(s)
79+
self.patterns += ["{{0}}{0}".format(s) for s in suffixes]
80+
except KeyError:
81+
suffixes = EXTENSION_SUFFIXES
82+
self.patterns += ["{{0}}{0}".format(s) for s in suffixes] + [
83+
"64/{{0}}{0}".format(s) for s in suffixes
84+
]
7285
self.dirs = sorted(dirs)
7386

7487
def make_package(self):

0 commit comments

Comments
 (0)