From 66cd7dc9d43b92a3faa29d91f1cb553a540eb45b Mon Sep 17 00:00:00 2001 From: UebelAndre Date: Sun, 16 May 2021 14:53:04 -0700 Subject: [PATCH] Revert "Include `libtool` and `.nice` files when replacing sandbox paths (#644)" (#648) This reverts commit 08598910609153bb82c7e3a91dbf7ae3d17a0575. --- foreign_cc/private/framework/toolchains/linux_commands.bzl | 7 +++---- foreign_cc/private/framework/toolchains/macos_commands.bzl | 7 +++---- .../private/framework/toolchains/windows_commands.bzl | 5 ++--- test/expected/inner_fun_text.txt | 5 ++--- test/expected/inner_fun_text_macos.txt | 5 ++--- 5 files changed, 12 insertions(+), 17 deletions(-) diff --git a/foreign_cc/private/framework/toolchains/linux_commands.bzl b/foreign_cc/private/framework/toolchains/linux_commands.bzl index e7115028..a59ca57c 100644 --- a/foreign_cc/private/framework/toolchains/linux_commands.bzl +++ b/foreign_cc/private/framework/toolchains/linux_commands.bzl @@ -68,7 +68,7 @@ if [ -d "$1" ]; then SAVEIFS=$IFS IFS=$'\n' # Find all real files. Symlinks are assumed to be relative to something within the directory we're seaching and thus ignored - local files=$(find -P $1 \\( -type f -and \\( -name "libtool" -or -name "*.pc" -or -name "*.lai" -or -name "*.la" -or -name "*-config" -or -name "*.nice" -or -name "*.mk" -or -name "*.cmake" \\) \\)) + local files=$(find -P $1 \\( -type f -and \\( -name "*.pc" -or -name "*.la" -or -name "*-config" -or -name "*.mk" -or -name "*.cmake" \\) \\)) IFS=$SAVEIFS for file in ${files[@]}; do sed -i 's@'"$2"'@'"$3"'@g' "${file}" @@ -114,9 +114,8 @@ mkdir -p "$target" if [[ -f "$1" ]]; then # In order to be able to use `replace_in_files`, we ensure that we create copies of specfieid # files so updating them is possible. - local input_basename="$(basename "$1")" - if [[ "$input_basename" == "libtool" || "$1" == *.pc || "$1" == *.la || "$1" == *.lai || "$1" == *-config || "$1" == *.nice || "$1" == *.mk || "$1" == *.cmake ]]; then - local dest="$target/$input_basename" + if [[ "$1" == *.pc || "$1" == *.la || "$1" == *-config || "$1" == *.mk || "$1" == *.cmake ]]; then + dest="$target/$(basename $1)" cp "$1" "$dest" && chmod +w "$dest" && touch -r "$1" "$dest" else ln -s -f -t "$target" "$1" diff --git a/foreign_cc/private/framework/toolchains/macos_commands.bzl b/foreign_cc/private/framework/toolchains/macos_commands.bzl index 74aa5470..9b4198ab 100644 --- a/foreign_cc/private/framework/toolchains/macos_commands.bzl +++ b/foreign_cc/private/framework/toolchains/macos_commands.bzl @@ -68,7 +68,7 @@ if [ -d "$1" ]; then SAVEIFS=$IFS IFS=$'\n' # Find all real files. Symlinks are assumed to be relative to something within the directory we're seaching and thus ignored - local files=$(find -P -f $1 \\( -type f -and \\( -name "libtool" -or -name "*.pc" -or -name "*.lai" -or -name "*.la" -or -name "*-config" -or -name "*.nice" -or -name "*.mk" -or -name "*.cmake" \\) \\)) + local files=$(find -P -f $1 \\( -type f -and \\( -name "*.pc" -or -name "*.la" -or -name "*-config" -or -name "*.mk" -or -name "*.cmake" \\) \\)) IFS=$SAVEIFS for file in ${files[@]}; do sed -i '' -e 's@'"$2"'@'"$3"'@g' "${file}" @@ -138,9 +138,8 @@ mkdir -p "$target" if [[ -f "$1" ]]; then # In order to be able to use `replace_in_files`, we ensure that we create copies of specfieid # files so updating them is possible. - local input_basename="$(basename "$1")" - if [[ "$input_basename" == "libtool" || "$1" == *.pc || "$1" == *.la || "$1" == *.lai || "$1" == *-config || "$1" == *.nice || "$1" == *.mk || "$1" == *.cmake ]]; then - local dest="$target/$input_basename" + if [[ "$1" == *.pc || "$1" == *.la || "$1" == *-config || "$1" == *.mk || "$1" == *.cmake ]]; then + dest="$target/$(basename $1)" cp "$1" "$dest" && chmod +w "$dest" && touch -r "$1" "$dest" else ln -s -f "$1" "$target" diff --git a/foreign_cc/private/framework/toolchains/windows_commands.bzl b/foreign_cc/private/framework/toolchains/windows_commands.bzl index 9967fd97..4b6ed4c6 100644 --- a/foreign_cc/private/framework/toolchains/windows_commands.bzl +++ b/foreign_cc/private/framework/toolchains/windows_commands.bzl @@ -115,9 +115,8 @@ mkdir -p "$target" if [[ -f "$1" ]]; then # In order to be able to use `replace_in_files`, we ensure that we create copies of specfieid # files so updating them is possible. - local input_basename="$(basename "$1")" - if [[ "$input_basename" == "libtool" || "$1" == *.pc || "$1" == *.la || "$1" == *.lai || "$1" == *-config || "$1" == *.nice || "$1" == *.mk || "$1" == *.cmake ]]; then - local dest="$target/$input_basename" + if [[ "$1" == *.pc || "$1" == *.la || "$1" == *-config || "$1" == *.mk || "$1" == *.cmake ]]; then + dest="$target/$(basename $1)" cp "$1" "$dest" && chmod +w "$dest" && touch -r "$1" "$dest" else ln -s -f -t "$target" "$1" diff --git a/test/expected/inner_fun_text.txt b/test/expected/inner_fun_text.txt index d9b15f28..7806a89c 100755 --- a/test/expected/inner_fun_text.txt +++ b/test/expected/inner_fun_text.txt @@ -23,9 +23,8 @@ mkdir -p "$target" if [[ -f "$1" ]]; then # In order to be able to use `replace_in_files`, we ensure that we create copies of specfieid # files so updating them is possible. -local input_basename="$(basename "$1")" -if [[ "$input_basename" == "libtool" || "$1" == *.pc || "$1" == *.la || "$1" == *.lai || "$1" == *-config || "$1" == *.nice || "$1" == *.mk || "$1" == *.cmake ]]; then -local dest="$target/$input_basename" +if [[ "$1" == *.pc || "$1" == *.la || "$1" == *-config || "$1" == *.mk || "$1" == *.cmake ]]; then +dest="$target/$(basename $1)" cp "$1" "$dest" && chmod +w "$dest" && touch -r "$1" "$dest" else ln -s -f -t "$target" "$1" diff --git a/test/expected/inner_fun_text_macos.txt b/test/expected/inner_fun_text_macos.txt index f00dedd3..6ee15266 100755 --- a/test/expected/inner_fun_text_macos.txt +++ b/test/expected/inner_fun_text_macos.txt @@ -23,9 +23,8 @@ mkdir -p "$target" if [[ -f "$1" ]]; then # In order to be able to use `replace_in_files`, we ensure that we create copies of specfieid # files so updating them is possible. -local input_basename="$(basename "$1")" -if [[ "$input_basename" == "libtool" || "$1" == *.pc || "$1" == *.la || "$1" == *.lai || "$1" == *-config || "$1" == *.nice || "$1" == *.mk || "$1" == *.cmake ]]; then -local dest="$target/$input_basename" +if [[ "$1" == *.pc || "$1" == *.la || "$1" == *-config || "$1" == *.mk || "$1" == *.cmake ]]; then +dest="$target/$(basename $1)" cp "$1" "$dest" && chmod +w "$dest" && touch -r "$1" "$dest" else ln -s -f "$1" "$target"