From 5d391cfe9dbe3171202861c0bb6dee8ec7cfdad5 Mon Sep 17 00:00:00 2001 From: graywolf-at-work <43144838+graywolf-at-work@users.noreply.github.com> Date: Thu, 26 May 2022 22:24:17 +0000 Subject: [PATCH] Make tests pass on busybox (#912) -t option to ln is not defined under POSIX and (at least) busybox does not implement it. Rewrite the code to use only POSIX options to ln. --- .../private/framework/toolchains/linux_commands.bzl | 2 +- test/convert_shell_script_test.bzl | 8 ++++---- test/expected/inner_fun_text.txt | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/foreign_cc/private/framework/toolchains/linux_commands.bzl b/foreign_cc/private/framework/toolchains/linux_commands.bzl index 575d3aca0..a7fee29bf 100644 --- a/foreign_cc/private/framework/toolchains/linux_commands.bzl +++ b/foreign_cc/private/framework/toolchains/linux_commands.bzl @@ -139,7 +139,7 @@ if [[ -f "$1" ]]; then dest="$target/$(basename \"$1\")" cp "$1" "$dest" && chmod +w "$dest" && touch -r "$1" "$dest" else - ln -s -f -t "$target" "$1" + ln -sf "$1" "$target/${1##*/}" fi elif [[ -L "$1" && ! -d "$1" ]]; then cp -pR "$1" "$2" diff --git a/test/convert_shell_script_test.bzl b/test/convert_shell_script_test.bzl index 21f073021..b4f469f3a 100644 --- a/test/convert_shell_script_test.bzl +++ b/test/convert_shell_script_test.bzl @@ -216,9 +216,9 @@ def _symlink_to_dir(source, target): mkdir -p ${target} if [[ -d $1 ]]; then - ln -s -t ${target} $1 + ln -s "$1" "$target/${1##*/}" elif [[ -f $1 ]]; then - ln -s -t ${target} $1 + ln -s "$1" "$target/${1##*/}" elif [[ -L $1 ]]; then cp --no-target-directory $1 ${target} else @@ -249,9 +249,9 @@ local target="$2" mkdir -p ${target} if [[ -d $1 ]]; then -ln -s -t ${target} $1 +ln -s "$1" "$target/${1##*/}" elif [[ -f $1 ]]; then -ln -s -t ${target} $1 +ln -s "$1" "$target/${1##*/}" elif [[ -L $1 ]]; then cp --no-target-directory $1 ${target} else diff --git a/test/expected/inner_fun_text.txt b/test/expected/inner_fun_text.txt index 31286e02f..e5fae1e97 100755 --- a/test/expected/inner_fun_text.txt +++ b/test/expected/inner_fun_text.txt @@ -43,7 +43,7 @@ if [[ "$1" == *.pc || "$1" == *.la || "$1" == *-config || "$1" == *.mk || "$1" = dest="$target/$(basename "$1")" cp "$1" "$dest" && chmod +w "$dest" && touch -r "$1" "$dest" else -ln -s -f -t "$target" "$1" +ln -sf "$1" "$target/${1##*/}" fi elif [[ -L "$1" && ! -d "$1" ]]; then cp -pR "$1" "$2"