More quoting fixes for handling paths with spaces (#850)

This commit is contained in:
James Sharpe 2022-01-02 16:42:56 +00:00 committed by GitHub
parent 5f37b4245b
commit ae4ff42901
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 14 deletions

View File

@ -78,7 +78,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 "*.pc" -or -name "*.la" -or -name "*-config" -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
local backup=$(mktemp)
@ -103,7 +103,7 @@ if [[ -d "{source}" ]]; then
else
cp -L -R "{source}" "{target}"
fi
find {target} -type f -exec touch -r "{source}" "{{}}" \\;
find "{target}" -type f -exec touch -r "{source}" "{{}}" \\;
""".format(
source = source,
target = target,
@ -216,7 +216,7 @@ def cleanup_function(on_success, on_failure):
def children_to_path(dir_):
text = """\
if [ -d {dir_} ]; then
local tools=$(find $EXT_BUILD_DEPS/bin/ -maxdepth 1 -mindepth 1)
local tools=$(find "$EXT_BUILD_DEPS/bin/" -maxdepth 1 -mindepth 1)
for tool in $tools;
do
if [[ -d \"$tool\" ]] || [[ -L \"$tool\" ]]; then

View File

@ -69,7 +69,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 "*.pc" -or -name "*.la" -or -name "*-config" -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
local backup=$(mktemp)
@ -86,7 +86,7 @@ fi
)
def copy_dir_contents_to_dir(source, target):
return """cp -L -r --no-target-directory "{source}" "{target}" && find {target} -type f -exec touch -r "{source}" "{{}}" \\;""".format(
return """cp -L -r --no-target-directory "{source}" "{target}" && find "{target}" -type f -exec touch -r "{source}" "{{}}" \\;""".format(
source = source,
target = target,
)
@ -166,7 +166,7 @@ def script_prelude():
def increment_pkg_config_path(source):
text = """\
local children=$(find $1 -mindepth 1 -name '*.pc')
local children=$(find "$1" -mindepth 1 -name '*.pc')
# assume there is only one directory with pkg config
for child in $children; do
export PKG_CONFIG_PATH="$${PKG_CONFIG_PATH:-}$$:$(dirname $child)"
@ -198,7 +198,7 @@ def cleanup_function(on_success, on_failure):
def children_to_path(dir_):
text = """\
if [ -d {dir_} ]; then
local tools=$(find $EXT_BUILD_DEPS/bin -maxdepth 1 -mindepth 1)
local tools=$(find "$EXT_BUILD_DEPS/bin" -maxdepth 1 -mindepth 1)
for tool in $tools;
do
if [[ -d \"$tool\" ]] || [[ -L \"$tool\" ]]; then

View File

@ -69,7 +69,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 "*.pc" -or -name "*.la" -or -name "*-config" -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
local backup=$(mktemp)
@ -94,7 +94,7 @@ if [[ -d "{source}" ]]; then
else
cp -L -R "{source}" "{target}"
fi
find {target} -type f -exec touch -r "{source}" "{{}}" \\;
find "{target}" -type f -exec touch -r "{source}" "{{}}" \\;
""".format(
source = source,
target = target,
@ -207,7 +207,7 @@ def cleanup_function(on_success, on_failure):
def children_to_path(dir_):
text = """\
if [ -d {dir_} ]; then
local tools=$(find $EXT_BUILD_DEPS/bin/ -maxdepth 1 -mindepth 1)
local tools=$(find "$EXT_BUILD_DEPS/bin/" -maxdepth 1 -mindepth 1)
for tool in $tools;
do
if [[ -d \"$tool\" ]] || [[ -L \"$tool\" ]]; then

View File

@ -70,7 +70,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=$($REAL_FIND -P $1 -type f \\( -type f -and \\( -name "*.pc" -or -name "*.la" -or -name "*-config" -or -name "*.mk" -or -name "*.cmake" \\) \\))
local files=$($REAL_FIND -P "$1" -type f \\( -type f -and \\( -name "*.pc" -or -name "*.la" -or -name "*-config" -or -name "*.mk" -or -name "*.cmake" \\) \\))
IFS=$SAVEIFS
# Escape any backslashes so sed can understand what it's supposed to replace
local argv2=$(echo "$2" | sed 's/\\\\/\\\\\\\\/g')
@ -90,7 +90,7 @@ fi
)
def copy_dir_contents_to_dir(source, target):
return """cp -L -r --no-target-directory "{source}" "{target}" && find {target} -type f -exec touch -r "{source}" "{{}}" \\;""".format(
return """cp -L -r --no-target-directory "{source}" "{target}" && $REAL_FIND "{target}" -type f -exec touch -r "{source}" "{{}}" \\;""".format(
source = source,
target = target,
)
@ -180,7 +180,7 @@ export SYSTEMDRIVE="C:"
def increment_pkg_config_path(source):
text = """\
local children=$($REAL_FIND $1 -mindepth 1 -name '*.pc')
local children=$($REAL_FIND "$1" -mindepth 1 -name '*.pc')
# assume there is only one directory with pkg config
for child in $children; do
export PKG_CONFIG_PATH="$${PKG_CONFIG_PATH:-}$$:$(dirname $child)"
@ -212,7 +212,7 @@ def cleanup_function(on_success, on_failure):
def children_to_path(dir_):
text = """\
if [ -d {dir_} ]; then
local tools=$($REAL_FIND $EXT_BUILD_DEPS/bin -maxdepth 1 -mindepth 1)
local tools=$($REAL_FIND "$EXT_BUILD_DEPS/bin" -maxdepth 1 -mindepth 1)
for tool in $tools;
do
if [[ -d \"$tool\" ]] || [[ -L \"$tool\" ]]; then