Skip to content

Commit

Permalink
Make tests pass on busybox (#912)
Browse files Browse the repository at this point in the history
-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.
  • Loading branch information
graywolf-at-work authored May 26, 2022
1 parent 324dbd1 commit 5d391cf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion foreign_cc/private/framework/toolchains/linux_commands.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions test/convert_shell_script_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/expected/inner_fun_text.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 5d391cf

Please sign in to comment.