Skip to content

Commit b23438e

Browse files
authored
Fix profiler ZTS build on alpine (#2887)
Circleci config was bad. Signed-off-by: Bob Weinand <[email protected]>
1 parent 0430ed8 commit b23438e

2 files changed

Lines changed: 13 additions & 8 deletions

File tree

.circleci/continue_config.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,9 @@ commands:
650650
steps:
651651
- run:
652652
name: Build Profiler NTS
653+
shell: /bin/bash -ieo pipefail
653654
command: |
655+
source "$BASH_ENV"
654656
if [ -d '/opt/rh/devtoolset-7' ] ; then
655657
set +eo pipefail
656658
source scl_source enable devtoolset-7
@@ -659,7 +661,7 @@ commands:
659661
set -u
660662
prefix="<< parameters.prefix >>"
661663
mkdir -vp "${prefix}"
662-
command -v switch-php && switch-php "${PHP_VERSION}"
664+
switch-php "${PHP_VERSION}"
663665
cd profiling
664666
echo "${CARGO_TARGET_DIR}"
665667
cargo build --release
@@ -668,7 +670,9 @@ commands:
668670
objcopy --compress-debug-sections "${prefix}/datadog-profiling.so"
669671
- run:
670672
name: Build Profiler ZTS
673+
shell: /bin/bash -ieo pipefail
671674
command: |
675+
source "$BASH_ENV"
672676
if [ -d '/opt/rh/devtoolset-7' ] ; then
673677
set +eo pipefail
674678
source scl_source enable devtoolset-7
@@ -677,7 +681,7 @@ commands:
677681
set -u
678682
prefix="<< parameters.prefix >>"
679683
mkdir -vp "${prefix}"
680-
command -v switch-php && switch-php "${PHP_VERSION}-zts"
684+
switch-php "${PHP_VERSION}-zts"
681685
cd profiling
682686
echo "${CARGO_TARGET_DIR}"
683687
touch build.rs #make sure `build.rs` gets executed after `switch-php` call
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
#!/bin/sh
22

33
switch_php() {
4-
phpType=$1
4+
phpType=${1#*-}
55

6-
if [ ${phpType} != 'zts' ] && [ ${phpType} != 'nts' ]; then
7-
echo "Invalid PHP version. Valid versions are: 'nts' and 'zts-"
6+
if [ "${phpType}" != 'zts' ] && [ "${phpType}" != 'nts' ] && [ "${phpType#*.}" = "${phpType}" ]; then
7+
echo "Invalid PHP version. Valid versions are: 'nts' and 'zts'"
88
return 1
99
fi
1010

11-
if [ ${phpType} = 'zts' ]; then
11+
if [ "${phpType}" = 'zts' ]; then
1212
export PATH="$(echo "${PATH}" | sed 's/\(\/usr\/local\/php-[^:]*\)\(-zts\|\)\/bin/\1-zts\/bin/')"
1313
else
14-
export PATH="$(echo "${PATH}" | sed 's/\(\/usr\/local\/php-[^:]*\)\(-zts\|\)\/bin/\1\/bin/')"
14+
export PATH="$(echo "${PATH}" | sed 's/\(\/usr\/local\/php-[^:-]*\)\(-zts\|\)\/bin/\1\/bin/')"
1515
fi
16-
}
16+
}
17+
alias switch-php=switch_php

0 commit comments

Comments
 (0)