Skip to content

Commit 500cc82

Browse files
authored
Autodetect PHP patch version (#1201)
1 parent 23714f8 commit 500cc82

File tree

2 files changed

+28
-12
lines changed

2 files changed

+28
-12
lines changed

.evergreen/compile-unix.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,8 @@ esac
6161
echo "MARCH: $MARCH"
6262
echo "RELEASE: $RELEASE"
6363
echo "OS: $OS"
64-
echo "PHP_VERSION: $PHP_VERSION"
64+
echo "PHP: $PHP_VERSION (`php --version | head -1`)"
6565

66-
OLD_PATH=$PATH
67-
PATH=/opt/php/${PHP_VERSION}-64bit/bin:$OLD_PATH
68-
69-
#cat `which phpize` | sed 's@/data/mci/.*/src@/opt@' > ./phpize
70-
#chmod +x ./phpize
7166
phpize
7267
./configure --enable-mongodb-developer-flags
7368
make

.evergreen/config.yml

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,23 @@ functions:
7171
export PROJECT_DIRECTORY=$(cygpath -m $PROJECT_DIRECTORY)
7272
fi
7373
74+
if [ -d "/opt/php/${PHP_VERSION}-64bit/bin" ]; then
75+
PHP_PATH="/opt/php/${PHP_VERSION}-64bit/bin"
76+
else
77+
# Try to find the newest version matching our constant
78+
PHP_PATH=`find /opt/php/ -maxdepth 1 -type d -name '${PHP_VERSION}*-64bit' -print | sort -V -r | head -1`/bin
79+
fi
80+
81+
if [ ! -d "$PHP_PATH" ]; then
82+
echo "Could not find PHP binaries for version ${PHP_VERSION}. Listing available versions..."
83+
ls -1 /opt/php
84+
exit 1
85+
fi
86+
7487
export MONGO_ORCHESTRATION_HOME="$DRIVERS_TOOLS/.evergreen/orchestration"
7588
export MONGODB_BINARIES="$DRIVERS_TOOLS/mongodb/bin"
7689
export UPLOAD_BUCKET="${project}"
90+
export PHP_VERSION="${PHP_VERSION}"
7791
7892
cat <<EOT > expansion.yml
7993
CURRENT_VERSION: "$CURRENT_VERSION"
@@ -82,6 +96,7 @@ functions:
8296
MONGODB_BINARIES: "$MONGODB_BINARIES"
8397
UPLOAD_BUCKET: "$UPLOAD_BUCKET"
8498
PROJECT_DIRECTORY: "$PROJECT_DIRECTORY"
99+
85100
PREPARE_SHELL: |
86101
set -o errexit
87102
set -o xtrace
@@ -92,8 +107,10 @@ functions:
92107
export PROJECT_DIRECTORY="$PROJECT_DIRECTORY"
93108
94109
export TMPDIR="$MONGO_ORCHESTRATION_HOME/db"
95-
export PATH="$MONGODB_BINARIES:$PATH"
110+
export PATH="$PHP_PATH:$MONGODB_BINARIES:$PATH"
96111
export PROJECT="${project}"
112+
113+
export PHP_VERSION="$PHP_VERSION"
97114
EOT
98115
# See what we've done
99116
cat expansion.yml
@@ -185,7 +202,7 @@ functions:
185202
working_dir: "src"
186203
script: |
187204
${PREPARE_SHELL}
188-
PHP_VERSION=${PHP_VERSION} sh ${PROJECT_DIRECTORY}/.evergreen/compile-unix.sh
205+
sh ${PROJECT_DIRECTORY}/.evergreen/compile-unix.sh
189206
190207
"exec script" :
191208
- command: shell.exec
@@ -1023,22 +1040,26 @@ axes:
10231040
- id: php-versions
10241041
display_name: PHP Version
10251042
values:
1043+
- id: "7.4"
1044+
display_name: "PHP 7.4"
1045+
variables:
1046+
PHP_VERSION: "7.4"
10261047
- id: "7.3"
10271048
display_name: "PHP 7.3"
10281049
variables:
1029-
PHP_VERSION: "7.3.8"
1050+
PHP_VERSION: "7.3"
10301051
- id: "7.2"
10311052
display_name: "PHP 7.2"
10321053
variables:
1033-
PHP_VERSION: "7.2.10"
1054+
PHP_VERSION: "7.2"
10341055
- id: "7.1"
10351056
display_name: "PHP 7.1"
10361057
variables:
1037-
PHP_VERSION: "7.1.22"
1058+
PHP_VERSION: "7.1"
10381059
- id: "7.0"
10391060
display_name: "PHP 7.0"
10401061
variables:
1041-
PHP_VERSION: "7.0.32"
1062+
PHP_VERSION: "7.0"
10421063

10431064
- id: os-php7
10441065
display_name: OS

0 commit comments

Comments
 (0)