setup-php 2.35.4 → 2.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +103 -88
  2. package/lib/extensions.js +8 -8
  3. package/lib/extensions.js.map +1 -1
  4. package/lib/install.js +1 -1
  5. package/lib/install.js.map +1 -1
  6. package/lib/tools.js +35 -10
  7. package/lib/tools.js.map +1 -1
  8. package/lib/utils.js +1 -1
  9. package/lib/utils.js.map +1 -1
  10. package/package.json +17 -16
  11. package/src/configs/brew_extensions +1 -0
  12. package/src/configs/darwin_libs +22 -0
  13. package/src/configs/ini/jit_aarch64.ini +3 -0
  14. package/src/configs/linux_libs +22 -0
  15. package/src/configs/php-versions.json +5 -4
  16. package/src/configs/tools.json +2 -1
  17. package/src/extensions.ts +23 -17
  18. package/src/install.ts +1 -1
  19. package/src/scripts/darwin.sh +37 -17
  20. package/src/scripts/extensions/add_extensions.sh +5 -3
  21. package/src/scripts/extensions/gearman.sh +3 -1
  22. package/src/scripts/extensions/ibm.ps1 +56 -0
  23. package/src/scripts/extensions/ibm.sh +106 -0
  24. package/src/scripts/extensions/intl.sh +5 -4
  25. package/src/scripts/extensions/oci.sh +2 -1
  26. package/src/scripts/extensions/patches/amqp.sh +5 -0
  27. package/src/scripts/extensions/patches/common.sh +31 -8
  28. package/src/scripts/extensions/patches/geos.sh +1 -5
  29. package/src/scripts/extensions/patches/pdo_oci.sh +3 -0
  30. package/src/scripts/extensions/patches/pdo_sqlsrv.sh +5 -0
  31. package/src/scripts/extensions/patches/phpize.sh +2 -1
  32. package/src/scripts/extensions/relay.sh +21 -34
  33. package/src/scripts/extensions/source.sh +23 -5
  34. package/src/scripts/linux.sh +1 -1
  35. package/src/scripts/tools/add_tools.sh +5 -1
  36. package/src/scripts/tools/ppa.sh +204 -30
  37. package/src/scripts/tools/symfony.ps1 +28 -14
  38. package/src/scripts/tools/symfony.sh +34 -31
  39. package/src/scripts/unix.sh +5 -3
  40. package/src/scripts/win32.ps1 +5 -2
  41. package/src/tools.ts +33 -10
  42. package/src/utils.ts +1 -1
  43. package/src/scripts/extensions/patches/gearman.sh +0 -5
@@ -50,12 +50,23 @@ update_lists_helper() {
50
50
  update_lists() {
51
51
  local ppa=${1:-}
52
52
  local ppa_search=${2:-}
53
+ local status_token=${3:-$ppa_search}
53
54
  local list=
54
- status_file=/tmp/os_lists
55
+ local status_file=/tmp/os_lists
56
+ local hash_cmd
55
57
  if [[ -n "$ppa" && -n "$ppa_search" ]]; then
56
- list="$list_dir"/"$(basename "$(grep -lr "$ppa_search" "$list_dir")")"
57
- status_file=/tmp/"$(echo -n "$ppa_search" | shasum -a 256 | cut -d ' ' -f 1)"
58
- elif [ -e "$list_file" ] && grep -Eq '^deb |^Types deb' "$list_file"; then
58
+ if [ -f "$ppa_search" ]; then
59
+ list="$ppa_search"
60
+ else
61
+ list="$(grep -Elr "$ppa_search" "$list_dir" 2>/dev/null | head -n 1)"
62
+ fi
63
+ hash_cmd="$(command -v sha256sum || command -v shasum)"
64
+ if [ -n "$status_token" ] && [ -n "$hash_cmd" ]; then
65
+ status_file=/tmp/os_lists_"$(echo -n "$status_token" | $hash_cmd | awk '{print $1}')"
66
+ elif [ -n "$status_token" ]; then
67
+ status_file=/tmp/os_lists_$(date +%s)
68
+ fi
69
+ elif [ -e "$list_file" ] && grep -Eq '^deb |^Types: *deb' "$list_file"; then
59
70
  list="$list_file"
60
71
  fi
61
72
  if [ ! -e "$status_file" ]; then
@@ -64,12 +75,91 @@ update_lists() {
64
75
  fi
65
76
  }
66
77
 
78
+ # Determine whether deb822 sources are the default on this system.
79
+ get_sources_format() {
80
+ if [ -n "$sources_format" ]; then
81
+ echo "$sources_format"
82
+ return
83
+ fi
84
+ sources_format=deb
85
+ if [ -e "$list_dir"/ubuntu.sources ] || [ -e "$list_dir"/debian.sources ]; then
86
+ sources_format="deb822"
87
+ elif ! [[ "$ID" =~ ubuntu|debian ]]; then
88
+ find "$list_dir" -type f -name '*.sources' | grep -q . && sources_format="deb822"
89
+ fi
90
+ echo "$sources_format"
91
+ }
92
+
93
+ # Function to get sources file extension.
94
+ get_sources_extension() {
95
+ [ "$1" = "deb822" ] && echo "sources" || echo "list"
96
+ }
97
+
98
+ # Function to escape regex special characters.
99
+ escape_regex() {
100
+ printf '%s' "$1" | sed -e 's/[][\.^$*+?{}()|\/]/\\&/g'
101
+ }
102
+
103
+ # Function to merge two components strings.
104
+ merge_components() {
105
+ local out=() t
106
+ for t in $1 $2; do [[ $t && " ${out[*]} " != *" $t "* ]] && out+=("$t"); done
107
+ printf '%s\n' "${out[*]}"
108
+ }
109
+
110
+ # Function to merge components from a file.
111
+ merge_components_from_file() {
112
+ local path=$1
113
+ local incoming=$2
114
+ local current=
115
+ if [ -n "$path" ] && [ -e "$path" ]; then
116
+ if grep -Eq '^Components:' "$path"; then
117
+ current="$(grep -E '^Components:' "$path" | head -n 1 | cut -d ':' -f 2 | xargs)"
118
+ else
119
+ current="$(sed -E -n 's/^deb[[:space:]]+(\[[^]]*\][[:space:]]+)?[^[:space:]]+[[:space:]]+[^[:space:]]+[[:space:]]+//p' "$path" | head -n 1 | xargs)"
120
+ fi
121
+ fi
122
+ local merged
123
+ merged="$(merge_components "$current" "$incoming")"
124
+ if [ -z "$merged" ] || [ "$merged" = "$current" ]; then
125
+ return 1
126
+ fi
127
+ printf '%s\n' "$merged"
128
+ }
129
+
130
+ # Function to get repo patterns based on format.
131
+ get_repo_patterns() {
132
+ local list_format=$1
133
+ local ppa_url=$2
134
+ local package_dist=$3
135
+ local branches=$4
136
+ local escaped_url
137
+ local escaped_dist
138
+ local escaped_branches
139
+ escaped_url="$(escape_regex "$ppa_url")"
140
+ escaped_dist="$(escape_regex "$package_dist")"
141
+ escaped_branches="$(escape_regex "$branches")"
142
+ local deb_primary="^deb[[:space:]]+(\\[[^]]*\\][[:space:]]+)?${escaped_url}[[:space:]]+${escaped_dist}[[:space:]]"
143
+ local deb_secondary="^deb[[:space:]]+(\\[[^]]*\\][[:space:]]+)?${escaped_url}[[:space:]]+${escaped_dist}[[:space:]]+.*${escaped_branches}([[:space:]]|$)"
144
+ local deb822_primary="^URIs: ${escaped_url}$"
145
+ local deb822_secondary="^Suites: ${escaped_dist}$"
146
+ if [ "$list_format" = "deb822" ]; then
147
+ printf '%s|%s\n' "$deb822_primary" "$deb822_secondary"
148
+ else
149
+ printf '%s|%s\n' "$deb_primary" "$deb_secondary"
150
+ fi
151
+ }
152
+
67
153
  # Function to get fingerprint from an Ubuntu PPA.
68
154
  ubuntu_fingerprint() {
69
- ppa=$1
70
- get -s -n "" "${lp_api[@]/%//~${ppa%/*}/+archive/${ppa##*/}}" | jq -r '.signing_key_fingerprint'
155
+ ppa="$1"
156
+ ppa_uri="~${ppa%/*}/+archive/ubuntu/${ppa##*/}"
157
+ get -s -n "" "${lp_api[0]}/$ppa_uri" | jq -er '.signing_key_fingerprint' 2>/dev/null \
158
+ || get -s -n "" "${lp_api[1]}/$ppa_uri" | jq -er '.signing_key_fingerprint' 2>/dev/null \
159
+ || get -s -n "" "$ppa_sp/keys/$ppa.fingerprint"
71
160
  }
72
161
 
162
+
73
163
  # Function to get fingerprint from a Debian PPA.
74
164
  debian_fingerprint() {
75
165
  ppa=$1
@@ -93,25 +183,81 @@ add_key() {
93
183
  sks_params="op=get&options=mr&exact=on&search=0x$fingerprint"
94
184
  key_urls=("${sks[@]/%/\/pks\/lookup\?"$sks_params"}")
95
185
  fi
186
+ key_urls+=("$ppa_sp/keys/$ppa.gpg")
96
187
  [ ! -e "$key_source" ] && get -q -n "$key_file" "${key_urls[@]}"
97
188
  if [[ "$(file "$key_file")" =~ .*('Public-Key (old)'|'Secret-Key') ]]; then
98
189
  sudo gpg --batch --yes --dearmor "$key_file" >/dev/null 2>&1 && sudo mv "$key_file".gpg "$key_file"
99
190
  fi
100
191
  }
101
192
 
193
+ # Function to handle existing list files.
194
+ handle_existing_list() {
195
+ local ppa=$1
196
+ local list_format=$2
197
+ local branches=$3
198
+ local merged_components
199
+ if [ -z "$check_lists_file" ]; then
200
+ echo "Repository $ppa ($branches) already exists" && return 1
201
+ fi
202
+ if merged_components="$(merge_components_from_file "$check_lists_file" "$branches")"; then
203
+ sudo rm -f "$check_lists_file" && printf '%s\n' "$merged_components" && return 0
204
+ fi
205
+ if [[ "$list_format" = "deb822" && "$check_lists_file" = *.list ]]; then
206
+ sudo rm -f "$check_lists_file" && printf '%s\n' "$branches" && return 0
207
+ fi
208
+ echo "Repository $ppa ($branches) already exists" && return 1
209
+ }
210
+
211
+ # Function to write a list file.
212
+ write_list() {
213
+ local type=$1
214
+ local ppa=$2
215
+ local url=$3
216
+ local suite=$4
217
+ local components=$5
218
+ local key_file=$6
219
+ local list_basename="${ppa%%/*}"-"$ID"-"${ppa#*/}"-"$suite"
220
+ local arch
221
+ arch="$(dpkg --print-architecture)"
222
+ sudo rm -f "$list_dir"/"${ppa/\//-}".list "$list_dir"/"${ppa/\//-}".sources "$list_dir"/"$list_basename".list "$list_dir"/"$list_basename".sources || true
223
+ if [ "$type" = "deb822" ]; then
224
+ cat <<EOF | sudo tee "$list_dir"/"$list_basename".sources >/dev/null
225
+ Types: deb
226
+ URIs: $url
227
+ Suites: $suite
228
+ Components: $components
229
+ Architectures: $arch
230
+ Signed-By: $key_file
231
+ EOF
232
+ else
233
+ echo "deb [arch=$arch signed-by=$key_file] $url $suite $components" | sudo tee "$list_dir"/"$list_basename".list >/dev/null 2>&1
234
+ fi
235
+ }
236
+
102
237
  # Function to check if a PPA and its lists exist
103
238
  check_lists() {
104
- ppa=$1
105
- ppa_search=$2
106
- if grep -Eqr "$ppa_search" "$list_dir"; then
239
+ local ppa=$1
240
+ local primary=${2:-}
241
+ local secondary=${3:-}
242
+ local status_token=${4:-$primary}
243
+ local match_file=
244
+ check_lists_file=
245
+ if [ -n "$primary" ]; then
246
+ match_file=$(grep -Elr "$primary" "$list_dir" 2>/dev/null | head -n 1)
247
+ fi
248
+ if [ -z "$match_file" ] && [ -n "$secondary" ]; then
249
+ match_file=$(grep -Elr "$secondary" "$list_dir" 2>/dev/null | head -n 1)
250
+ fi
251
+ if [ -n "$match_file" ]; then
252
+ local list_count
107
253
  list_count="$(sudo find /var/lib/apt/lists -type f -name "*${ppa/\//_}*" | wc -l)"
108
254
  if [ "$list_count" = "0" ]; then
109
- update_lists "$ppa" "$ppa_search"
255
+ update_lists "$ppa" "$match_file" "$status_token"
110
256
  fi
111
- return 0;
112
- else
113
- return 1;
257
+ check_lists_file="$match_file"
258
+ return 0
114
259
  fi
260
+ return 1
115
261
  }
116
262
 
117
263
  # Function to add a sources list.
@@ -121,19 +267,32 @@ add_list() {
121
267
  key_source=${3:-"$ppa_url"}
122
268
  package_dist=${4:-"$VERSION_CODENAME"}
123
269
  branches=${5:-main}
124
- ppa_search="deb .*$ppa_url $package_dist .*$branches$"
125
- if check_lists "$ppa" "$ppa_search"; then
126
- echo "Repository $ppa already exists";
127
- return 1;
128
- else
129
- arch=$(dpkg --print-architecture)
130
- [ -e "$key_source" ] && key_file=$key_source || key_file="$key_dir"/"${ppa/\//-}"-keyring.gpg
131
- add_key "$ppa" "$ppa_url" "$package_dist" "$key_source" "$key_file"
132
- sudo rm -rf "$list_dir"/"${ppa/\//-}".list || true
133
- echo "deb [arch=$arch signed-by=$key_file] $ppa_url $package_dist $branches" | sudo tee -a "$list_dir"/"${ppa%%/*}"-"$ID"-"${ppa#*/}"-"$package_dist".list >/dev/null 2>&1
134
- update_lists "$ppa" "$ppa_search"
135
- . /etc/os-release
270
+ local list_format
271
+ local list_extension
272
+ local status_token
273
+ local resolved_branches
274
+ local list_path=
275
+ list_format="$(get_sources_format)"
276
+ list_extension="$(get_sources_extension "$list_format")"
277
+ status_token="${ppa_url}|${package_dist}|${branches}"
278
+ IFS='|' read -r primary_pattern secondary_pattern <<< "$(get_repo_patterns "$list_format" "$ppa_url" "$package_dist" "$branches")"
279
+ if check_lists "$ppa" "$primary_pattern" "$secondary_pattern" "$status_token"; then
280
+ list_path="$check_lists_file"
281
+ if resolved_branches="$(handle_existing_list "$ppa" "$list_format" "$branches")"; then
282
+ branches="$resolved_branches"
283
+ else
284
+ [ -n "$resolved_branches" ] && echo "$resolved_branches" && return 1
285
+ fi
286
+ check_lists_file=
287
+ IFS='|' read -r primary_pattern secondary_pattern <<< "$(get_repo_patterns "$list_format" "$ppa_url" "$package_dist" "$branches")"
288
+ status_token="${ppa_url}|${package_dist}|${branches}"
136
289
  fi
290
+ [ -e "$key_source" ] && key_file=$key_source || key_file="$key_dir"/"${ppa/\//-}"-keyring.gpg
291
+ add_key "$ppa" "$ppa_url" "$package_dist" "$key_source" "$key_file"
292
+ write_list "$list_format" "$ppa" "$ppa_url" "$package_dist" "$branches" "$key_file"
293
+ list_path="$list_dir"/"${ppa%%/*}"-"$ID"-"${ppa#*/}"-"$package_dist"."$list_extension"
294
+ update_lists "$ppa" "$list_path" "$status_token"
295
+ . /etc/os-release
137
296
  return 0;
138
297
  }
139
298
 
@@ -143,8 +302,12 @@ check_ppa() {
143
302
  ppa_url=${2:-"$lpc_ppa/$ppa/ubuntu"}
144
303
  package_dist=${3:-"$VERSION_CODENAME"}
145
304
  branches=${4:-main}
146
- ppa_search="deb .*$ppa_url $package_dist .*$branches$"
147
- if check_lists "$ppa" "$ppa_search"; then
305
+ local list_format
306
+ list_format="$(get_sources_format)"
307
+ IFS='|' read -r primary_pattern secondary_pattern <<< "$(get_repo_patterns "$list_format" "$ppa_url" "$package_dist" "$branches")"
308
+ local status_token
309
+ status_token="${ppa_url}|${package_dist}|${branches}"
310
+ if check_lists "$ppa" "$primary_pattern" "$secondary_pattern" "$status_token"; then
148
311
  return 0;
149
312
  else
150
313
  return 1;
@@ -158,7 +321,7 @@ remove_list() {
158
321
  for ppa_url in "${ppa_urls[@]}"; do
159
322
  grep -lr "$ppa_url" "$list_dir" | xargs -n1 sudo rm -f
160
323
  done
161
- sudo rm -f "$key_dir"/"${ppa/\//-}"-keyring || true
324
+ sudo rm -f "$key_dir"/"${ppa/\//-}"-keyring /tmp/os_lists* || true
162
325
  }
163
326
 
164
327
  # Function to check if ubuntu ppa is up
@@ -208,12 +371,23 @@ update_ppa() {
208
371
  ppa_url=${2:-"$lpc_ppa/$ppa/ubuntu"}
209
372
  package_dist=${4:-"$VERSION_CODENAME"}
210
373
  branches=${5:-main}
211
- ppa_search="deb .*$ppa_url $package_dist .*$branches"
212
- update_lists "$ppa" "$ppa_search"
374
+ local list_format
375
+ list_format="$(get_sources_format)"
376
+ IFS='|' read -r primary_pattern secondary_pattern <<< "$(get_repo_patterns "$list_format" "$ppa_url" "$package_dist" "$branches")"
377
+ local list_path
378
+ list_path="$(grep -Elr "$primary_pattern" "$list_dir" 2>/dev/null | head -n 1)"
379
+ if [ -z "$list_path" ] && [ -n "$secondary_pattern" ]; then
380
+ list_path="$(grep -Elr "$secondary_pattern" "$list_dir" 2>/dev/null | head -n 1)"
381
+ fi
382
+ local status_token
383
+ status_token="${ppa_url}|${package_dist}|${branches}"
384
+ update_lists "$ppa" "${list_path:-$primary_pattern}" "$status_token"
213
385
  . /etc/os-release
214
386
  }
215
387
 
216
388
  # Variables
389
+ sources_format=
390
+ check_lists_file=
217
391
  list_dir='/etc/apt/sources.list.d'
218
392
  list_file="/etc/apt/sources.list.d/$ID.sources"
219
393
  [ -e "$list_file" ] || list_file='/etc/apt/sources.list'
@@ -1,18 +1,32 @@
1
1
  Function Add-Symfony() {
2
- $arch_name ='amd64'
3
- if(-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') {
4
- $arch_name = '386'
5
- }
6
- $url = "https://github.com/symfony-cli/symfony-cli/releases/latest/download/symfony-cli_windows_${arch_name}.zip"
7
- Get-File -Url $url -OutFile $bin_dir\symfony.zip >$null 2>&1
8
- Expand-Archive -Path $bin_dir\symfony.zip -DestinationPath $bin_dir -Force >$null 2>&1
9
- if(Test-Path $bin_dir\symfony.exe) {
10
- Copy-Item -Path $bin_dir\symfony.exe -Destination $bin_dir\symfony-cli.exe > $null 2>&1
11
- Add-ToProfile $current_profile 'symfony' "New-Alias symfony $bin_dir\symfony.exe"
12
- Add-ToProfile $current_profile 'symfony_cli' "New-Alias symfony-cli $bin_dir\symfony-cli.exe"
13
- $tool_version = Get-ToolVersion symfony "-V"
14
- Add-Log $tick "symfony-cli" "Added symfony-cli $tool_version"
2
+ param(
3
+ [Parameter(Mandatory = $true, Position = 0, HelpMessage = 'Symfony version to be installed')]
4
+ [string] $protobuf_tag
5
+ )
6
+ $protobuf_tag = $protobuf_tag.replace('v', '')
7
+ if($protobuf_tag -ne 'latest' -and $protobuf_tag -notmatch '^\d+(\.\d+)*$') {
8
+ Add-Log $cross "symfony-cli" "Invalid symfony version: $protobuf_tag"
15
9
  } else {
16
- Add-Log $cross "symfony-cli" "Could not setup symfony-cli"
10
+ $arch_name = 'amd64'
11
+ if (-not ([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') {
12
+ $arch_name = '386'
13
+ }
14
+ $symfony_releases = "https://github.com/symfony-cli/symfony-cli/releases"
15
+ if ($protobuf_tag -eq 'latest') {
16
+ $url = "$symfony_releases/latest/download/symfony-cli_windows_${arch_name}.zip"
17
+ } else {
18
+ $url = "$symfony_releases/download/v$protobuf_tag/symfony-cli_windows_${arch_name}.zip"
19
+ }
20
+ Get-File -Url $url -OutFile $bin_dir\symfony.zip > $null 2>&1
21
+ Expand-Archive -Path $bin_dir\symfony.zip -DestinationPath $bin_dir -Force > $null 2>&1
22
+ if (Test-Path $bin_dir\symfony.exe) {
23
+ Copy-Item -Path $bin_dir\symfony.exe -Destination $bin_dir\symfony-cli.exe > $null 2>&1
24
+ Add-ToProfile $current_profile 'symfony' "New-Alias symfony $bin_dir\symfony.exe"
25
+ Add-ToProfile $current_profile 'symfony_cli' "New-Alias symfony-cli $bin_dir\symfony-cli.exe"
26
+ $tool_version = Get-ToolVersion symfony "-V"
27
+ Add-Log $tick "symfony-cli" "Added symfony-cli $tool_version"
28
+ } else {
29
+ Add-Log $cross "symfony-cli" "Could not setup symfony-cli"
30
+ }
17
31
  }
18
32
  }
@@ -1,41 +1,44 @@
1
- add_symfony_with_brew() {
2
- add_brew_tap symfony-cli/homebrew-tap
3
- brew install symfony-cli/tap/symfony-cli
4
- }
5
-
6
1
  get_symfony_artifact_url() {
7
- arch=$(dpkg --print-architecture)
8
- url=$(get -s -n "" https://raw.githubusercontent.com/symfony-cli/homebrew-tap/main/Formula/symfony-cli.rb 2<&1 | grep -m 1 "url.*linux.*${arch}" | cut -d\" -f 2)
9
- if [ -z "$url" ]; then
10
- url=$(get -s -n "" https://api.github.com/repos/symfony-cli/symfony-cli/releases 2<&1 | grep -m 1 "url.*linux.*${arch}.*gz\"" | cut -d\" -f 4)
11
- fi
12
- echo "$url"
2
+ local symfony_tag=$1
3
+ local os
4
+ local arch
5
+ os="$(uname -s | tr '[:upper:]' '[:lower:]')"
6
+ arch="$(uname -m)"
7
+ case "$arch" in
8
+ arm|armv6*|armv7*) arch="armv6" ;;
9
+ aarch64*|armv8*|arm64) arch="arm64" ;;
10
+ i[36]86) arch="386" ;;
11
+ x86_64|amd64) arch="amd64" ;;
12
+ esac
13
+ [ "$os" = "darwin" ] && arch="all"
14
+ symfony_releases="https://github.com/symfony-cli/symfony-cli/releases"
15
+ if [ "$symfony_tag" = "latest" ]; then
16
+ echo "$symfony_releases/latest/download/symfony-cli_${os}_${arch}.tar.gz"
17
+ else
18
+ echo "$symfony_releases/download/v$symfony_tag/symfony-cli_${os}_${arch}.tar.gz"
19
+ fi
13
20
  }
14
21
 
15
22
  add_symfony_helper() {
16
- if [ "$(uname -s)" = "Linux" ]; then
17
- url="$(get_symfony_artifact_url)"
18
- if [ -z "$url" ]; then
19
- . "${0%/*}"/tools/brew.sh
20
- configure_brew
21
- add_symfony_with_brew
22
- else
23
- get -s -n "" "$url" | sudo tar -xz -C "${tool_path_dir:?}" 2>/dev/null
24
- sudo chmod a+x /usr/local/bin/symfony
25
- fi
26
- elif [ "$(uname -s)" = "Darwin" ]; then
27
- add_symfony_with_brew
28
- fi
23
+ local install_dir=/usr/local/bin
24
+ [ "$(uname -s)" = "Darwin" ] && install_dir=${brew_prefix:?}/bin
25
+ get -s -n "" "$(get_symfony_artifact_url "$symfony_tag")" | sudo tar -xz -C "$install_dir" 2>/dev/null
26
+ sudo chmod a+x "$install_dir"/symfony
29
27
  }
30
28
 
31
29
  add_symfony() {
32
- add_symfony_helper >/dev/null 2>&1
33
- symfony_path="$(command -v symfony)"
34
- if [[ -n "$symfony_path" ]]; then
35
- sudo ln -s "$symfony_path" "${tool_path_dir:?}"/symfony-cli
36
- tool_version=$(get_tool_version "symfony" "-V")
37
- add_log "${tick:?}" "symfony-cli" "Added symfony-cli $tool_version"
30
+ local symfony_tag="${1/v/}"
31
+ if ! [[ "$symfony_tag" =~ ^[0-9]+(\.[0-9]+)*$ || "$symfony_tag" == 'latest' ]]; then
32
+ add_log "${cross:?}" "symfony-cli" "Version '$symfony_tag' is not valid for symfony-cli"
38
33
  else
39
- add_log "${cross:?}" "symfony-cli" "Could not setup symfony-cli"
34
+ add_symfony_helper "$symfony_tag" >/dev/null 2>&1
35
+ symfony_path="$(command -v symfony)"
36
+ if [[ -n "$symfony_path" ]]; then
37
+ sudo ln -s "$symfony_path" "${tool_path_dir:?}"/symfony-cli
38
+ tool_version=$(get_tool_version "symfony" "-V")
39
+ add_log "${tick:?}" "symfony-cli" "Added symfony-cli $tool_version"
40
+ else
41
+ add_log "${cross:?}" "symfony-cli" "Could not setup symfony-cli"
42
+ fi
40
43
  fi
41
44
  }
@@ -4,7 +4,7 @@ export cross="✗"
4
4
  export curl_opts=(-sL)
5
5
  export old_versions="5.[3-5]"
6
6
  export jit_versions="8.[0-9]"
7
- export nightly_versions="8.[3-9]"
7
+ export nightly_versions="8.[6-9]"
8
8
  export xdebug3_versions="7.[2-4]|8.[0-9]"
9
9
  export latest="releases/latest/download"
10
10
  export github="https://github.com/shivammathur"
@@ -145,7 +145,7 @@ get() {
145
145
  status_code=$(sudo curl -w "%{http_code}" -o "$file_path" "${curl_opts[@]}" "$link")
146
146
  [ "$status_code" = "200" ] && break
147
147
  done
148
- [ "$execute" = "-e" ] && sudo chmod a+x "$file_path"
148
+ [[ "$execute" = "-e" && -e "$file_path" ]] && sudo chmod a+x "$file_path"
149
149
  [ "$mode" = "-v" ] && echo "$status_code"
150
150
  [ "$runner" = "self-hosted" ] && release_lock "$lock_path"
151
151
  fi
@@ -244,7 +244,9 @@ configure_php() {
244
244
  add_php_config
245
245
  ini_config_dir="${src:?}"/configs/ini
246
246
  ini_config_files=("$ini_config_dir"/php.ini)
247
- jit_config_files=("$ini_config_dir"/jit.ini)
247
+ arch="$(uname -m)"
248
+ [[ "$arch" = "arm64" || "$arch" = "aarch64" ]] && jit_ini="$ini_config_dir"/jit_aarch64.ini || jit_ini="$ini_config_dir"/jit.ini
249
+ jit_config_files=("$jit_ini")
248
250
  [[ "$version" =~ $xdebug3_versions ]] && ini_config_files+=("$ini_config_dir"/xdebug.ini)
249
251
  cat "${ini_config_files[@]}" | sudo tee -a "${ini_file[@]:?}" >/dev/null 2>&1
250
252
  [[ "$version" =~ $jit_versions ]] && cat "${jit_config_files[@]}" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null 2>&1
@@ -323,7 +323,7 @@ $php_builder = "$github/shivammathur/php-builder-windows"
323
323
  $current_profile = "$env:TEMP\setup-php.ps1"
324
324
  $ProgressPreference = 'SilentlyContinue'
325
325
  $jit_versions = '8.[0-9]'
326
- $nightly_versions = '8.[2-9]'
326
+ $nightly_versions = '8.[6-9]'
327
327
  $xdebug3_versions = "7.[2-4]|8.[0-9]"
328
328
  $enable_extensions = ('openssl', 'curl', 'mbstring')
329
329
 
@@ -444,9 +444,12 @@ if($installed.MajorMinorVersion -ne $version) {
444
444
  }
445
445
  if($version -lt "5.5") {
446
446
  ('libeay32.dll', 'ssleay32.dll') | ForEach-Object -Parallel { Invoke-WebRequest -Uri "$using:php_builder/releases/download/openssl-1.0.2u/$_" -OutFile $using:php_dir\$_ >$null 2>&1 }
447
- } else {
447
+ } elseif($version -lt "8.5") {
448
448
  $enable_extensions += ('opcache')
449
449
  }
450
+ if($version -ge "8.5" -and (Test-Path $ext_dir\php_opcache.dll)) {
451
+ Remove-Item $ext_dir\php_opcache.dll -Force
452
+ }
450
453
  Enable-PhpExtension -Extension ($enable_extensions | Where-Object { Test-Path $ext_dir\php_$_.dll }) -Path $php_dir
451
454
  Add-PhpCAInfo
452
455
  Add-OpenSSLConf
package/src/tools.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import path from 'path';
2
2
  import fs from 'fs';
3
+ import * as cv from 'compare-versions';
3
4
  import * as fetch from './fetch';
4
5
  import * as packagist from './packagist';
5
6
  import * as utils from './utils';
@@ -20,6 +21,11 @@ interface IRef {
20
21
  * @param data
21
22
  */
22
23
  export async function getSemverVersion(data: RS): Promise<string> {
24
+ const fixSemver = (t: string): string => {
25
+ if (/^\d+\.\d+\.\d+(-|$)/.test(t)) return t;
26
+ const m = t.match(/^(\d+\.\d+\.\d+)([A-Za-z]+[0-9A-Za-z.]+)$/);
27
+ return m ? `${m[1]}-${m[2]}` : t;
28
+ };
23
29
  const search: string = data['version_prefix'] + data['version'];
24
30
  const url = `https://api.github.com/repos/${data['repository']}/git/matching-refs/tags%2F${search}.`;
25
31
  const github_token: string =
@@ -30,10 +36,24 @@ export async function getSemverVersion(data: RS): Promise<string> {
30
36
  data['error'] = response.error ?? `No version found with prefix ${search}.`;
31
37
  return data['version'];
32
38
  } else {
33
- const refs = JSON.parse(response['data']).reverse();
34
- const ref = refs.find((i: IRef) => /.*\d+.\d+.\d+$/.test(i['ref']));
35
- const tag: string = (ref || refs[0])['ref'].split('/').pop();
36
- return tag.replace(/^v(\d)/, '$1');
39
+ const refs: IRef[] = JSON.parse(response['data']);
40
+ const tags = refs
41
+ .map((i: IRef) => (i.ref?.split('/').pop() ?? '').replace(/^v(?=\d)/, ''))
42
+ .filter((t: string) => t.length > 0);
43
+ const fixedToOriginal = new Map<string, string>();
44
+ const fixed = tags.map(t => {
45
+ const f = fixSemver(t);
46
+ fixedToOriginal.set(f, t);
47
+ return f;
48
+ });
49
+ fixed.sort((a, b) => {
50
+ try {
51
+ return cv.compareVersions(b, a);
52
+ } catch {
53
+ return b.localeCompare(a, 'en', {numeric: true, sensitivity: 'base'});
54
+ }
55
+ });
56
+ return fixedToOriginal.get(fixed[0]) ?? fixed[0];
37
57
  }
38
58
  }
39
59
 
@@ -136,7 +156,7 @@ export async function filterList(tools_list: string[]): Promise<string[]> {
136
156
  * @param data
137
157
  */
138
158
  export async function getUrl(data: RS): Promise<string> {
139
- if (data['version'] === 'latest') {
159
+ if ((data['version'] ?? 'latest') === 'latest') {
140
160
  return [
141
161
  data['domain'],
142
162
  data['repository'],
@@ -263,30 +283,33 @@ export async function addComposer(data: RS): Promise<string> {
263
283
  const github = data['github'];
264
284
  const getcomposer = data['domain'];
265
285
  const cds = 'https://dl.cloudsmith.io';
286
+ const spc = 'https://artifacts.setup-php.com';
266
287
  const filename = `composer-${data['php_version']}-${channel}.phar`;
267
288
  const releases_url = `${github}/shivammathur/composer-cache/releases/latest/download/${filename}`;
268
289
  const cds_url = `${cds}/public/shivammathur/composer-cache/raw/files/${filename}`;
290
+ const spc_url = `${spc}/composer/${filename}`;
269
291
  const lts_url = `${getcomposer}/download/latest-2.2.x/composer.phar`;
270
292
  const is_lts = /^5\.[3-6]$|^7\.[0-1]$/.test(data['php_version']);
271
- const version_source_url = `${getcomposer}/composer-${channel}.phar`;
272
- let cache_url = `${releases_url},${cds_url}`;
293
+ const channel_source_url = `${getcomposer}/composer-${channel}.phar`;
294
+ const version_source_url = `${getcomposer}/download/${channel}/composer.phar`;
295
+ let cache_url = `${releases_url},${spc_url},${cds_url}`;
273
296
  let source_url = `${getcomposer}/composer.phar`;
274
297
  switch (true) {
275
298
  case /^snapshot$/.test(channel):
276
299
  source_url = is_lts ? lts_url : source_url;
277
300
  break;
278
301
  case /^preview$|^2$/.test(channel):
279
- source_url = is_lts ? lts_url : version_source_url;
302
+ source_url = is_lts ? lts_url : channel_source_url;
280
303
  break;
281
304
  case /^1$/.test(channel):
282
- source_url = version_source_url;
305
+ source_url = channel_source_url;
283
306
  break;
284
307
  case /^\d+\.\d+\.\d+[\w-]*$/.test(data['version']):
285
308
  cache_url = `${github}/${data['repository']}/releases/download/${data['version']}/composer.phar`;
286
309
  source_url = version_source_url;
287
310
  break;
288
311
  default:
289
- source_url = is_lts ? lts_url : version_source_url;
312
+ source_url = is_lts ? lts_url : channel_source_url;
290
313
  }
291
314
  const use_cache: boolean = (await utils.readEnv('NO_TOOLS_CACHE')) !== 'true';
292
315
  data['url'] = use_cache ? `${cache_url},${source_url}` : source_url;
package/src/utils.ts CHANGED
@@ -400,7 +400,7 @@ export async function customPackage(
400
400
  version: string,
401
401
  os: string
402
402
  ): Promise<string> {
403
- const pkg_name: string = pkg.replace(/\d+|(pdo|pecl)[_-]/, '');
403
+ const pkg_name: string = pkg.replace(/\d+|(pdo|pecl)[_-]|[_-]db2/, '');
404
404
  const script_extension: string = await scriptExtension(os);
405
405
  const script: string = path.join(
406
406
  __dirname,
@@ -1,5 +0,0 @@
1
- patch_gearman() {
2
- if [[ "${version:?}" =~ ${nightly_versions:?} ]]; then
3
- sed -i~ -e "s/zend_exception_get_default()/zend_ce_exception/" php_gearman.c
4
- fi
5
- }