Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions config/pkg/ext/ext-amqp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ ext-amqp:
type: php-extension
artifact:
source:
type: pecl
name: amqp
type: pie
repo: php-amqp/php-amqp
metadata:
license-files: [LICENSE]
license: PHP-3.01
Expand Down
4 changes: 2 additions & 2 deletions config/pkg/ext/ext-apcu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ ext-apcu:
type: php-extension
artifact:
source:
type: pecl
name: APCu
type: pie
repo: apcu/apcu
metadata:
license-files: [LICENSE]
license: PHP-3.01
4 changes: 2 additions & 2 deletions config/pkg/ext/ext-ast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ ext-ast:
type: php-extension
artifact:
source:
type: pecl
name: ast
type: pie
repo: nikic/php-ast
metadata:
license-files: [LICENSE]
license: BSD-3-Clause
4 changes: 2 additions & 2 deletions config/pkg/ext/ext-dio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ ext-dio:
type: php-extension
artifact:
source:
type: pecl
name: dio
type: pie
repo: pecl/dio
metadata:
license-files: [LICENSE]
license: PHP-3.01
4 changes: 2 additions & 2 deletions config/pkg/ext/ext-ev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ ext-ev:
type: php-extension
artifact:
source:
type: pecl
name: ev
type: pie
repo: osmanov/pecl-ev
metadata:
license-files: [LICENSE]
license: PHP-3.01
Expand Down
5 changes: 3 additions & 2 deletions config/pkg/ext/ext-excimer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ ext-excimer:
type: php-extension
artifact:
source:
type: pecl
name: excimer
type: ghtagtar
repo: wikimedia/mediawiki-php-excimer
extract: php-src/ext/excimer
metadata:
license-files: [LICENSE]
license: PHP-3.01
Expand Down
5 changes: 3 additions & 2 deletions config/pkg/ext/ext-gearman.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ ext-gearman:
type: php-extension
artifact:
source:
type: pecl
name: gearman
type: ghtar
repo: php/pecl-networking-gearman
extract: php-src/ext/gearman
metadata:
license-files: [LICENSE]
license: PHP-3.01
Expand Down
4 changes: 2 additions & 2 deletions config/pkg/ext/ext-grpc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ ext-grpc:
type: php-extension
artifact:
source:
type: pecl
name: grpc
type: pie
repo: grpc/grpc-php-ext
metadata:
license-files: [LICENSE]
license: Apache-2.0
Expand Down
4 changes: 2 additions & 2 deletions config/pkg/ext/ext-imagick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ ext-imagick:
type: php-extension
artifact:
source:
type: pecl
name: imagick
type: pie
repo: imagick/imagick
metadata:
license-files: [LICENSE]
license: PHP-3.01
Expand Down
5 changes: 3 additions & 2 deletions config/pkg/ext/ext-imap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ ext-imap:
type: php-extension
artifact:
source:
type: pecl
name: imap
type: ghtagtar
repo: php/pecl-mail-imap
extract: php-src/ext/imap
metadata:
license-files: [LICENSE]
license: PHP-3.01
Expand Down
4 changes: 2 additions & 2 deletions config/pkg/ext/ext-inotify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ ext-inotify:
type: php-extension
artifact:
source:
type: pecl
name: inotify
type: pie
repo: arnaud-lb/inotify
metadata:
license-files: [LICENSE]
license: PHP-3.01
Expand Down
5 changes: 3 additions & 2 deletions config/pkg/ext/ext-memcache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ ext-memcache:
type: php-extension
artifact:
source:
type: pecl
name: memcache
type: ghtar
repo: websupport-sk/pecl-memcache
extract: php-src/ext/memcache
metadata:
license-files: [LICENSE]
license: PHP-3.0
Expand Down
4 changes: 2 additions & 2 deletions config/pkg/ext/ext-memcached.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ ext-memcached:
type: php-extension
artifact:
source:
type: pecl
name: memcached
type: pie
repo: php-memcached/php-memcached
metadata:
license-files: [LICENSE]
license: PHP-3.01
Expand Down
4 changes: 2 additions & 2 deletions config/pkg/ext/ext-msgpack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ ext-msgpack:
type: php-extension
artifact:
source:
type: pecl
name: msgpack
type: pie
repo: msgpack/msgpack-php
metadata:
license-files: [LICENSE]
license: BSD-3-Clause
Expand Down
1 change: 0 additions & 1 deletion config/pkg/ext/ext-mysqlnd_ed25519.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ ext-mysqlnd_ed25519:
source:
type: pie
repo: mariadb/mysqlnd_ed25519
extract: php-src/ext/mysqlnd_ed25519
metadata:
license-files: [LICENSE]
license: BSD-3-Clause
Expand Down
1 change: 0 additions & 1 deletion config/pkg/ext/ext-mysqlnd_parsec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ ext-mysqlnd_parsec:
source:
type: pie
repo: mariadb/mysqlnd_parsec
extract: php-src/ext/mysqlnd_parsec
metadata:
license-files: [LICENSE]
license: BSD-3-Clause
Expand Down
4 changes: 2 additions & 2 deletions config/pkg/ext/ext-parallel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ ext-parallel:
type: php-extension
artifact:
source:
type: pecl
name: parallel
type: pie
repo: pecl/parallel
metadata:
license-files: [LICENSE]
license: PHP-3.01
Expand Down
4 changes: 2 additions & 2 deletions config/pkg/ext/ext-pcov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ ext-pcov:
type: php-extension
artifact:
source:
type: pecl
name: pcov
type: pie
repo: pecl/pcov
metadata:
license-files: [LICENSE]
license: PHP-3.01
Expand Down
4 changes: 2 additions & 2 deletions config/pkg/ext/ext-redis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ ext-redis:
type: php-extension
artifact:
source:
type: pecl
name: redis
type: pie
repo: phpredis/phpredis
metadata:
license-files: [LICENSE]
license: PHP-3.01
Expand Down
1 change: 0 additions & 1 deletion config/pkg/ext/ext-spx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ ext-spx:
source:
type: pie
repo: noisebynorthwest/php-spx
extract: php-src/ext/spx
metadata:
license-files: [LICENSE]
license: GPL-3.0-or-later
Expand Down
5 changes: 3 additions & 2 deletions config/pkg/ext/ext-ssh2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ ext-ssh2:
type: php-extension
artifact:
source:
type: pecl
name: ssh2
type: ghtar
repo: php/pecl-networking-ssh2
extract: php-src/ext/ssh2
metadata:
license-files: [LICENSE]
license: PHP-3.01
Expand Down
5 changes: 3 additions & 2 deletions config/pkg/ext/ext-trader.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ ext-trader:
type: php-extension
artifact:
source:
type: pecl
name: trader
type: ghtagtar
repo: php/pecl-math-trader
extract: php-src/ext/trader
metadata:
license-files: [LICENSE]
license: BSD-2-Clause
Expand Down
4 changes: 2 additions & 2 deletions config/pkg/ext/ext-uuid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ ext-uuid:
type: php-extension
artifact:
source:
type: pecl
name: uuid
type: pie
repo: pecl/uuid
metadata:
license-files: [LICENSE]
license: LGPL-2.1-only
Expand Down
6 changes: 3 additions & 3 deletions config/pkg/ext/ext-uv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ ext-uv:
type: php-extension
artifact:
source:
type: pecl
name: uv
prefer-stable: false
type: ghtagtar
repo: amphp/ext-uv
extract: php-src/ext/uv
metadata:
license-files: [LICENSE]
license: PHP-3.01
Expand Down
1 change: 1 addition & 0 deletions config/pkg/ext/ext-xdebug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ ext-xdebug:
source:
type: pie
repo: xdebug/xdebug
extract: ext-xdebug
metadata:
license-files: [LICENSE]
license: Xdebug-1.03
Expand Down
4 changes: 2 additions & 2 deletions config/pkg/ext/ext-xhprof.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ ext-xhprof:
type: php-extension
artifact:
source:
type: pecl
name: xhprof
type: ghtar
repo: longxinH/xhprof
extract: php-src/ext/xhprof-src
metadata:
license-files: [LICENSE]
Expand Down
5 changes: 3 additions & 2 deletions config/pkg/ext/ext-yac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ ext-yac:
type: php-extension
artifact:
source:
type: pecl
name: yac
type: ghtagtar
repo: laruence/yac
extract: php-src/ext/yac
metadata:
license-files: [LICENSE]
license: PHP-3.01
Expand Down
4 changes: 2 additions & 2 deletions config/pkg/ext/ext-zip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ ext-zip:
type: php-extension
artifact:
source:
type: pecl
name: zip
type: pie
repo: pecl/zip
extract: ext-zip
metadata:
license-files: [LICENSE]
Expand Down
21 changes: 19 additions & 2 deletions src/StaticPHP/Artifact/Downloader/Type/PIE.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ public function download(string $name, array $config, ArtifactDownloader $downlo
if (!$dist_url || !$dist_type) {
throw new DownloaderException("failed to find {$name} dist info from packagist");
}
$extract = $config['extract'] ?? ('php-src/ext/' . strtolower(preg_replace('/^ext-/i', '', $name)));
$name = str_replace('/', '_', $config['repo']);
$version = $first['version'] ?? 'unknown';
$filename = "{$name}-{$version}." . ($dist_type === 'zip' ? 'zip' : 'tar.gz');
$path = DOWNLOAD_PATH . DIRECTORY_SEPARATOR . $filename;
default_shell()->executeCurlDownload($dist_url, $path, retries: $downloader->getRetry());
return DownloadResult::archive($filename, $config, $config['extract'] ?? null, version: $version, downloader: static::class);
return DownloadResult::archive($filename, $config, $extract, version: $version, downloader: static::class);
}

public function checkUpdate(string $name, array $config, ?string $old_version, ArtifactDownloader $downloader): CheckUpdateResult
Expand Down Expand Up @@ -56,7 +57,23 @@ protected function fetchPackagistInfo(string $name, array $config, ArtifactDownl
if (!isset($data['packages'][$config['repo']]) || !is_array($data['packages'][$config['repo']])) {
throw new DownloaderException("failed to find {$name} repo info from packagist");
}
$first = $data['packages'][$config['repo']][0] ?? [];
// p2 metadata is minified: each entry only carries fields changed vs the previous one, '__unset' removes a field
$releases = [];
$current = [];
foreach ($data['packages'][$config['repo']] as $release) {
$current = array_merge($current, $release);
$current = array_filter($current, static fn ($v) => $v !== '__unset');
$releases[] = $current;
}
// packagist lists newest first including RC/beta/alpha — pick the newest stable release
$first = null;
foreach ($releases as $release) {
if (!preg_match('/[._-]?(?:alpha|a|beta|b|rc)[._-]?\d*$/i', $release['version'] ?? '')) {
$first = $release;
break;
}
}
$first ??= $releases[0] ?? [];
if (!isset($first['php-ext'])) {
throw new DownloaderException("failed to find {$name} php-ext info from packagist, maybe not a php extension package");
}
Expand Down
Loading