1
0
mirror of https://github.com/php/pie.git synced 2026-03-23 23:12:17 +01:00

434: define a virtual package for Alpine

This commit is contained in:
James Titcumb
2025-12-17 16:13:45 +00:00
parent 1a15aa00e9
commit 60236eb58a
3 changed files with 15 additions and 2 deletions

View File

@@ -52,7 +52,7 @@ enum PackageManager: string
return match ($this) {
self::Test => ['echo', '"fake installing ' . implode(', ', $packages) . '"'],
self::Apt => ['apt-get', 'install', '-y', '--no-install-recommends', '--no-install-suggests', ...$packages],
self::Apk => ['apk', 'add', '--no-cache', ...$packages],
self::Apk => ['apk', 'add', '--no-cache', '--virtual', '.php-pie-deps', ...$packages],
self::Dnf => ['dnf', 'install', '-y', ...$packages],
self::Yum => ['yum', 'install', '-y', ...$packages],
self::Brew => ['brew', 'install', ...$packages],

View File

@@ -7,6 +7,7 @@ FROM alpine AS test_pie_installs_build_tools_on_alpine
RUN apk add php php-phar php-mbstring php-iconv php-openssl bzip2-dev libbz2
COPY --from=build_pie_phar /app/pie.phar /usr/local/bin/pie
RUN pie install --auto-install-build-tools -v php/bz2
RUN apk del .php-pie-deps
RUN pie show
FROM fedora AS test_pie_installs_build_tools_on_fedora

View File

@@ -22,8 +22,20 @@ final class PackageManagerTest extends TestCase
PackageManager::Apt->installCommand(['a', 'b']),
);
self::assertSame(
['apk', 'add', '--no-cache', 'a', 'b'],
['apk', 'add', '--no-cache', '--virtual', '.php-pie-deps', 'a', 'b'],
PackageManager::Apk->installCommand(['a', 'b']),
);
self::assertSame(
['dnf', 'install', '-y', 'a', 'b'],
PackageManager::Dnf->installCommand(['a', 'b']),
);
self::assertSame(
['yum', 'install', '-y', 'a', 'b'],
PackageManager::Yum->installCommand(['a', 'b']),
);
self::assertSame(
['brew', 'install', 'a', 'b'],
PackageManager::Brew->installCommand(['a', 'b']),
);
}
}