diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-10-04 04:57:33 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-06 07:39:33 +0200 |
commit | 3059b1cb8d701cf23f3e04a8a8fdcfcaa6a397fb (patch) | |
tree | 5795cbb447755ec0dbadb48ff3dc799dc44ce9f6 /scripts | |
parent | 7cfe40b987bf08053487f4a72fafe11de219b583 (diff) |
Add libnss files to downloads for packages
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/package.py | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/scripts/package.py b/scripts/package.py index ce7eb71..e3a6c52 100755 --- a/scripts/package.py +++ b/scripts/package.py @@ -22,7 +22,7 @@ $DOWNLOAD_DEPENDENCIES_COMMAND "$script_dir/$SO_LOADER" --library-path "$script_dir/libs":$HOME/.local/lib/sibs/"$program_full_name":/usr/lib/sibs/"$program_full_name" "$script_dir/$PROGRAM_NAME" "$@" """ -blacklisted_libs = [ "libGL\\.so.*", "libGLX.*", "libGLdispatch.*" ] +blacklisted_libs = [ re.compile("libGL\\.so.*"), re.compile("libGLX.*"), re.compile("libGLdispatch.*") ] def get_executable_dynamic_libraries(filepath): libs = [] @@ -46,9 +46,13 @@ def make_executable(filepath): def get_libnss_files(): libnss_pattern = re.compile("libnss.*\\.so.*") files = [] + dupl = {} for filepath in os.listdir("/usr/lib"): - if libnss_pattern.match(filepath): - files.append(os.path.join("/usr/lib", filepath)) + path = os.path.join("/usr/lib", filepath) + real = os.path.realpath(path) + if not dupl.get(real) and libnss_pattern.match(filepath) and not os.path.islink(path): + files.append(real) + dupl[real] = True return files def file_get_sha1(filepath): @@ -83,7 +87,7 @@ def remove_blacklisted_libs(libs): for lib in libs: is_blacklisted = False for blacklisted_lib in blacklisted_libs: - if re.match(blacklisted_lib, os.path.basename(lib[0])): + if blacklisted_lib.match(os.path.basename(lib[0])): is_blacklisted = True break if not is_blacklisted: @@ -125,6 +129,10 @@ def main(): print("So loader: %s" % so_loader) + libnss_files = get_libnss_files() + for libnss_file in libnss_files: + libs.append([ libnss_file, os.path.basename(libnss_file) ]) + mapped_libs = [] dependencies = [] if package_type == "--bundle-install": @@ -150,16 +158,6 @@ def main(): libs = new_libs so_loader = os.path.join("libs", so_loader) - libnss_files = get_libnss_files() - for idx, libnss_file in enumerate(libnss_files): - new_file_path = os.path.join(destination_path, os.path.basename(libnss_file)) - libnss_files[idx] = new_file_path - if os.path.islink(libnss_file): - target_name = os.path.basename(os.readlink(libnss_file)) - os.symlink(target_name, new_file_path) - else: - shutil.copyfile(libnss_file, new_file_path) - executable_filename = os.path.basename(executable_path) new_executable_path = os.path.join(destination_path, executable_filename) shutil.copyfile(executable_path, new_executable_path) @@ -195,11 +193,6 @@ def main(): print("Adding shared library %s to package" % lib[0]) tar.add(lib[0], arcname=os.path.join("libs", lib[1])) - for libnss_file in libnss_files: - print("Adding libnss shared library %s to package" % libnss_file) - libnss_name = os.path.basename(libnss_file) - tar.add(libnss_file, arcname=os.path.join("libs", libnss_name)) - print("Adding executable %s to package" % executable_path) tar.add(new_executable_path, arcname="program") print("Adding run script %s to package" % run_script_path) @@ -221,8 +214,6 @@ def main(): os.remove(urls_filepath) os.remove(library_mapping_filepath) os.remove(dependencies_filepath) - for libnss_file in libnss_files: - os.remove(libnss_file) print("Package has been created at %s" % package_name) if __name__ == "__main__": |