From 9b966c5a5912113109cb0f571461bf3a4e26c610 Mon Sep 17 00:00:00 2001 From: Paul Cresswell Date: Thu, 4 Sep 2025 12:18:35 +0000 Subject: [PATCH 1/3] Try absolute path for link if relative path fails --- ecbundle/util.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ecbundle/util.py b/ecbundle/util.py index 5417b02..f224c73 100644 --- a/ecbundle/util.py +++ b/ecbundle/util.py @@ -105,6 +105,7 @@ def symlink_force(target, link_name): # prefer relative symlink rather than absolute # check first if target is absolute or relative + target_orig = target if os.path.isabs(target): target = os.path.relpath(target, os.path.dirname(link_name)) @@ -117,6 +118,11 @@ def symlink_force(target, link_name): else: raise exc + # If a relative link is invalid, retry with absolute path if available + if not os.path.exists(link_name): + if target != target_orig: + os.remove(link_name) + os.symlink(target_orig, link_name) def copydir(src_dir, target_dir): import os From 04a6116b6e5301e73e41859f8c575c0f9fcda061 Mon Sep 17 00:00:00 2001 From: Paul Cresswell Date: Thu, 4 Sep 2025 15:20:09 +0000 Subject: [PATCH 2/3] Raise error if link fails --- ecbundle/util.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ecbundle/util.py b/ecbundle/util.py index f224c73..20b650d 100644 --- a/ecbundle/util.py +++ b/ecbundle/util.py @@ -124,6 +124,15 @@ def symlink_force(target, link_name): os.remove(link_name) os.symlink(target_orig, link_name) + if not os.path.exists(link_name): + error( + "ERROR: Failed to create valid link from {0} to {1}".format( + link_name, target_orig + ) + ) + raise RuntimeError() + + def copydir(src_dir, target_dir): import os from subprocess import CalledProcessError, check_call From 784daa4769af38f307f9de21367761f3363666bc Mon Sep 17 00:00:00 2001 From: Paul Cresswell Date: Thu, 4 Sep 2025 16:58:42 +0000 Subject: [PATCH 3/3] Fix tests by adding missing link target --- tests/bundle_create/arch/.gitignore | 2 ++ tests/bundle_install/arch/.gitignore | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 tests/bundle_create/arch/.gitignore create mode 100644 tests/bundle_install/arch/.gitignore diff --git a/tests/bundle_create/arch/.gitignore b/tests/bundle_create/arch/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/tests/bundle_create/arch/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/tests/bundle_install/arch/.gitignore b/tests/bundle_install/arch/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/tests/bundle_install/arch/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore