From af9db63711386e351345b9a2c613bf01b602ede6 Mon Sep 17 00:00:00 2001 From: Alexey Nagaev Date: Tue, 9 Sep 2025 13:45:01 +0300 Subject: [PATCH] Update for sysroot build --- tools/linux/sysroot/build_sysroot.py | 1 + tools/linux/sysroot/fix_symlinks.py | 20 ++++++++------------ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/tools/linux/sysroot/build_sysroot.py b/tools/linux/sysroot/build_sysroot.py index 5643e01..2340c35 100755 --- a/tools/linux/sysroot/build_sysroot.py +++ b/tools/linux/sysroot/build_sysroot.py @@ -53,6 +53,7 @@ def download_sysroot(): apt_libs += ["libxss-dev"] apt_libs += ["libxkbcommon-dev"] apt_libs += ["libxkbcommon-x11-dev"] + apt_libs += ["libnotify-dev"] apt_libs_str = "" for apt_lib in apt_libs: diff --git a/tools/linux/sysroot/fix_symlinks.py b/tools/linux/sysroot/fix_symlinks.py index 6c91a41..1cddda1 100644 --- a/tools/linux/sysroot/fix_symlinks.py +++ b/tools/linux/sysroot/fix_symlinks.py @@ -4,46 +4,42 @@ import uuid # change symbolic link to relative paths def fix_symlinks(top_dir='./sysroot_ubuntu_1604'): - top_dir += '/usr/lib/x86_64-linux-gnu' for root, dirs, files in os.walk(top_dir): for name in files: path = os.path.join(root, name) if not os.path.islink(path): continue - try: target = os.readlink(path) except OSError as e: print(f"Error reading link '{path}': {e}", file=sys.stderr) continue - - if not target.startswith('/lib/'): + + if not target.startswith('/'): continue - - new_target = "../../../lib" + target[4:] + + new_target = top_dir + target + new_target_rel = os.path.relpath(new_target, os.path.dirname(path)) temp_name = f".tmp.{uuid.uuid4().hex}" temp_path = os.path.join(root, temp_name) - try: - os.symlink(new_target, temp_path) + os.symlink(new_target_rel, temp_path) except OSError as e: print(f"Failed to create temporary symlink for '{path}': {e}", file=sys.stderr) continue - try: os.replace(temp_path, path) - print(f"Updated: {path} -> {new_target}") + print(f"Updated: {path} -> {new_target_rel}") except OSError as e: print(f"Failed to replace symlink '{path}': {e}", file=sys.stderr) try: os.unlink(temp_path) except OSError: pass - break # no subfolders if __name__ == "__main__": if len(sys.argv) > 1: directory = sys.argv[1] else: directory = './sysroot_ubuntu_1604' - fix_symlinks(directory) \ No newline at end of file + fix_symlinks(directory)