From 06d2c5c884eee0b5b663730f4d379a7ceae3a8e4 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 1 Aug 2026 05:26:16 +0900 Subject: 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 --- crates/shirabe/src/util/perforce.rs | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'crates/shirabe/src/util/perforce.rs') diff --git a/crates/shirabe/src/util/perforce.rs b/crates/shirabe/src/util/perforce.rs index fa448b35..9cd804a4 100644 --- a/crates/shirabe/src/util/perforce.rs +++ b/crates/shirabe/src/util/perforce.rs @@ -417,12 +417,12 @@ impl Perforce { pub fn write_client_spec_to_file(&mut self, spec: &PhpResource) { fwrite( spec, - &format!("Client: {}{}{}", self.get_client(), PHP_EOL, PHP_EOL), + format!("Client: {}{}{}", self.get_client(), PHP_EOL, PHP_EOL), None, ); fwrite( spec, - &format!( + format!( "Update: {}{}{}", date("Y/m/d H:i:s", None), PHP_EOL, @@ -432,12 +432,12 @@ impl Perforce { ); fwrite( spec, - &format!("Access: {}{}", date("Y/m/d H:i:s", None), PHP_EOL), + format!("Access: {}{}", date("Y/m/d H:i:s", None), PHP_EOL), None, ); fwrite( spec, - &format!( + format!( "Owner: {}{}{}", self.get_user().unwrap_or_default(), PHP_EOL, @@ -445,10 +445,10 @@ impl Perforce { ), None, ); - fwrite(spec, &format!("Description:{}", PHP_EOL), None); + fwrite(spec, format!("Description:{}", PHP_EOL), None); fwrite( spec, - &format!( + format!( " Created by {} from composer.{}{}", self.get_user().unwrap_or_default(), PHP_EOL, @@ -458,12 +458,12 @@ impl Perforce { ); fwrite( spec, - &format!("Root: {}{}{}", self.get_path(), PHP_EOL, PHP_EOL), + format!("Root: {}{}{}", self.get_path(), PHP_EOL, PHP_EOL), None, ); fwrite( spec, - &format!( + format!( "Options: noallwrite noclobber nocompress unlocked modtime rmdir{}{}", PHP_EOL, PHP_EOL ), @@ -471,20 +471,16 @@ impl Perforce { ); fwrite( spec, - &format!("SubmitOptions: revertunchanged{}{}", PHP_EOL, PHP_EOL), - None, - ); - fwrite( - spec, - &format!("LineEnd: local{}{}", PHP_EOL, PHP_EOL), + format!("SubmitOptions: revertunchanged{}{}", PHP_EOL, PHP_EOL), None, ); + fwrite(spec, format!("LineEnd: local{}{}", PHP_EOL, PHP_EOL), None); if self.is_stream() { - fwrite(spec, &format!("Stream:{}", PHP_EOL), None); + fwrite(spec, format!("Stream:{}", PHP_EOL), None); let stream_clone = self.p4_stream.clone().unwrap_or_default(); fwrite( spec, - &format!( + format!( " {}{}", self.get_stream_without_label(&stream_clone), PHP_EOL @@ -496,7 +492,7 @@ impl Perforce { let client = self.get_client(); fwrite( spec, - &format!("View: {}/... //{}/... {}", stream, client, PHP_EOL), + format!("View: {}/... //{}/... {}", stream, client, PHP_EOL), None, ); } -- cgit v1.3.1