diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-01 05:26:16 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-01 18:41:11 +0900 |
| commit | 06d2c5c884eee0b5b663730f4d379a7ceae3a8e4 (patch) | |
| tree | 5cd768e0bdad3f8a056dd9b047de363963315135 /crates/shirabe/tests/package | |
| parent | b8d46b0495d00815a699932ced0b43955c949ab9 (diff) | |
| download | php-shirabe-06d2c5c884eee0b5b663730f4d379a7ceae3a8e4.tar.gz php-shirabe-06d2c5c884eee0b5b663730f4d379a7ceae3a8e4.tar.zst php-shirabe-06d2c5c884eee0b5b663730f4d379a7ceae3a8e4.zip | |
feat(php-shim): implement Phar/PharData and the zlib/bzip2 functions
Adopt the tar, flate2, and bzip2 crates to fill in the phar.rs and
compress.rs todos: PharData tar/zip reading, building, and whole-archive
compression, plus a native .phar reader that follows the php.net
file-format manual and verifies hash-based signatures. Callers now
propagate the constructor/extract errors PHP throws, and fwrite accepts
byte strings so gzread no longer needs lossy UTF-8.
The native .phar writing API stays todo!() (no call sites; Composer's
Compiler is not ported) and OPENSSL phar signatures are accepted
unverified (TODO(phase-c)).
This unblocks Tar::getComposerJson and the tar/phar/gzip downloaders;
tar_test (7), artifact_repository_test (2), and phar_archiver_test zip
(1) are un-ignored. The archive command itself still panics because
ArchiveManager::archive always generates glob excludes whose look-ahead
regexes the regex crate cannot compile; converting those patterns to
regex-compatible ones is a separate, still-undecided work item.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/tests/package')
| -rw-r--r-- | crates/shirabe/tests/package/archiver/archive_manager_test.rs | 8 | ||||
| -rw-r--r-- | crates/shirabe/tests/package/archiver/phar_archiver_test.rs | 6 |
2 files changed, 6 insertions, 8 deletions
diff --git a/crates/shirabe/tests/package/archiver/archive_manager_test.rs b/crates/shirabe/tests/package/archiver/archive_manager_test.rs index d85fac10..3db1e734 100644 --- a/crates/shirabe/tests/package/archiver/archive_manager_test.rs +++ b/crates/shirabe/tests/package/archiver/archive_manager_test.rs @@ -166,12 +166,8 @@ fn test_unknown_format() { } // ref: ArchiveManagerTest::testArchiveTar / testArchiveCustomFileName. -// -// These drive ArchiveManager::archive end-to-end for the 'tar' format, which dispatches to -// PharArchiver::archive. That builds the archive via PharData, whose build_from_iterator is -// todo!() in the php-shim, so the archiving path cannot run yet. #[test] -#[ignore = "needs PharData tar archiving (new_with_format/build_from_iterator are todo!() in the php-shim) for ArchiveManager::archive('tar', ...)"] +#[ignore = "ArchiveManager::archive always passes buildExcludePatterns' glob excludes (e.g. 'name-*.zip'), which BaseExcludeFilter::generate_pattern turns into look-ahead regexes the regex crate cannot compile"] fn test_archive_tar() { if !git_is_executable() { return; @@ -208,7 +204,7 @@ fn test_archive_tar() { } #[test] -#[ignore = "needs PharData tar archiving (new_with_format/build_from_iterator are todo!() in the php-shim) for ArchiveManager::archive('tar', ...)"] +#[ignore = "ArchiveManager::archive always passes buildExcludePatterns' glob excludes (e.g. 'name-*.zip'), which BaseExcludeFilter::generate_pattern turns into look-ahead regexes the regex crate cannot compile"] fn test_archive_custom_file_name() { if !git_is_executable() { return; diff --git a/crates/shirabe/tests/package/archiver/phar_archiver_test.rs b/crates/shirabe/tests/package/archiver/phar_archiver_test.rs index fe6185d8..39c5087a 100644 --- a/crates/shirabe/tests/package/archiver/phar_archiver_test.rs +++ b/crates/shirabe/tests/package/archiver/phar_archiver_test.rs @@ -1,5 +1,6 @@ //! ref: composer/tests/Composer/Test/Package/Archiver/PharArchiverTest.php +use serial_test::serial; use shirabe::package::archiver::{ArchiverInterface, PharArchiver}; use shirabe::package::handle::CompletePackageHandle; use shirabe::util::{Filesystem, Platform}; @@ -63,8 +64,9 @@ impl ArchiverTestCase { } } -#[ignore = "PharArchiver::archive builds the archive via PharData, which is todo!() in the php-shim"] +#[ignore = "the excludes passed here make BaseExcludeFilter::generate_pattern emit look-ahead regexes ((?=$|/) and Glob's (?=[^\\.])) that the regex crate cannot compile"] #[test] +#[serial] fn test_tar_archive() { let mut test_case = ArchiverTestCase::set_up(); @@ -98,8 +100,8 @@ fn test_tar_archive() { .unwrap(); } -#[ignore = "PharArchiver::archive builds the archive via PharData, which is todo!() in the php-shim"] #[test] +#[serial] fn test_zip_archive() { let mut test_case = ArchiverTestCase::set_up(); |
