Skip to content

Commit 0a3cbf8

Browse files
committed
auto merge of #18673 : VHaravy/rust/issue-18632, r=alexcrichton
1. Introduce `putpathvar` function that prints variable shell-quoted by using `%q` format specifier. This function is used within `probe` to save the result into `config.tmp`. 2. Removes search-and-replace pattern that transforms `\` into `/` as it messes up shell-quoted strings.
2 parents 0b48001 + c7a0b9c commit 0a3cbf8

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

configure

+22-5
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,24 @@ putvar() {
7676
printf "%-20s := %s\n" $1 "$T" >>config.tmp
7777
}
7878

79+
putpathvar() {
80+
local T
81+
eval T=\$$1
82+
eval TLEN=\${#$1}
83+
if [ $TLEN -gt 35 ]
84+
then
85+
printf "configure: %-20s := %.35s ...\n" $1 "$T"
86+
else
87+
printf "configure: %-20s := %s %s\n" $1 "$T" "$2"
88+
fi
89+
if [ -z "$T" ]
90+
then
91+
printf "%-20s := \n" $1 >>config.tmp
92+
else
93+
printf "%-20s := \"%s\"\n" $1 "$T" >>config.tmp
94+
fi
95+
}
96+
7997
probe() {
8098
local V=$1
8199
shift
@@ -101,7 +119,7 @@ probe() {
101119
fi
102120
done
103121
eval $V=\$T
104-
putvar $V "$VER"
122+
putpathvar $V "$VER"
105123
}
106124

107125
probe_need() {
@@ -638,9 +656,9 @@ probe CFG_ADB adb
638656

639657
if [ ! -z "$CFG_PANDOC" ]
640658
then
641-
PV_MAJOR_MINOR=$(pandoc --version | grep '^pandoc ' |
659+
PV_MAJOR_MINOR=$(pandoc --version | grep '^pandoc\(.exe\)\? ' |
642660
# extract the first 2 version fields, ignore everything else
643-
sed 's/pandoc \([0-9]*\)\.\([0-9]*\).*/\1 \2/')
661+
sed 's/pandoc\(.exe\)\? \([0-9]*\)\.\([0-9]*\).*/\2 \3/')
644662

645663
MIN_PV_MAJOR="1"
646664
MIN_PV_MINOR="9"
@@ -1330,8 +1348,7 @@ do
13301348
done
13311349

13321350
# Munge any paths that appear in config.mk back to posix-y
1333-
perl -i.bak -p -e 's@ ([a-zA-Z]):[/\\]@ /\1/@go;' \
1334-
-e 's@\\@/@go;' config.tmp
1351+
perl -i.bak -p -e 's@ ([a-zA-Z]):[/\\]@ /\1/@go;' config.tmp
13351352
rm -f config.tmp.bak
13361353

13371354
msg

mk/reconfig.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ifndef CFG_DISABLE_MANAGE_SUBMODULES
1919
# (nothing checked out at all). `./configure --{llvm,jemalloc}-root`
2020
# will explicitly deinitialize the corresponding submodules, and we don't
2121
# want to force constant rebuilds in that case.
22-
NEED_GIT_RECONFIG=$(shell cd "$(CFG_SRC_DIR)" && "$(CFG_GIT)" submodule status | grep -c '^+')
22+
NEED_GIT_RECONFIG=$(shell cd "$(CFG_SRC_DIR)" && $(CFG_GIT) submodule status | grep -c '^+')
2323
else
2424
NEED_GIT_RECONFIG=0
2525
endif

0 commit comments

Comments
 (0)