blasphemy: add the user-supplied --paths argument to the library search paths, as well as to LD_LIBRARY_PATH
This commit is contained in:
parent
4d7a15ed3b
commit
1d3b97a9f5
14
blasphemy
14
blasphemy
@ -12,7 +12,7 @@ USER_PROFILE = os.path.join(os.environ["HOME"], ".guix-profile")
|
||||
|
||||
LOADER = os.path.join(USER_PROFILE, "lib", "ld-linux-x86-64.so.2")
|
||||
|
||||
SEARCH_PATHS = [
|
||||
DEFAULT_SEARCH_PATHS = [
|
||||
os.path.join(USER_PROFILE, "lib"),
|
||||
os.path.join(CURRENT_PROFILE, "lib"),
|
||||
LIBRARY_STORE
|
||||
@ -37,8 +37,8 @@ def scan_input_binary(input_binary):
|
||||
discovered[library] = path.split(" ")[0]
|
||||
return (discovered, not_found)
|
||||
|
||||
def find_library(library):
|
||||
for path in SEARCH_PATHS:
|
||||
def find_library(library, search_paths):
|
||||
for path in search_paths:
|
||||
print(">> >> >> Looking for {0} in: {1}".format(library, path), file=sys.stderr)
|
||||
found_library = find_library_in_search_path(library, path)
|
||||
if found_library:
|
||||
@ -55,7 +55,7 @@ def find_library_in_search_path(library, path):
|
||||
if "ELF 64-bit" in file_type(library_path):
|
||||
return library_path
|
||||
|
||||
def find_libraries(already_found, to_find):
|
||||
def find_libraries(already_found, to_find, search_paths):
|
||||
resolved = {}
|
||||
for library in to_find:
|
||||
print(">> Looking for: {0}".format(library), file=sys.stderr)
|
||||
@ -66,7 +66,7 @@ def find_libraries(already_found, to_find):
|
||||
resolved[library] = already_found[library]
|
||||
else:
|
||||
print(">> >> Performing search for: {0}".format(library), file=sys.stderr)
|
||||
library_path = find_library(library)
|
||||
library_path = find_library(library, search_paths)
|
||||
if library_path:
|
||||
print(">> >> >> >> Resolved {0} as: {1}".format(library, library_path), file=sys.stderr)
|
||||
resolved[library] = library_path
|
||||
@ -101,10 +101,12 @@ paths = args.paths
|
||||
pre_command = [LOADER]
|
||||
command = args.command
|
||||
|
||||
search_paths = paths + DEFAULT_SEARCH_PATHS
|
||||
|
||||
for input_binary in args.inputs:
|
||||
(discovered, not_found) = scan_input_binary(input_binary)
|
||||
libraries.update(discovered)
|
||||
found = find_libraries(libraries, not_found)
|
||||
found = find_libraries(libraries, not_found, search_paths)
|
||||
libraries.update(found)
|
||||
paths = paths + [os.path.dirname(path) for path in found.values()]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user