Skip to content
Closed
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
10 changes: 7 additions & 3 deletions packages/build-infra/test/validate-checkpoints.mts
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,20 @@ function isCheckpointFile(filename: string): boolean {
}

/**
* Validates a single tar archive using tar -tzf command.
* Validates a single tar archive using tar command.
* Checks both integrity (readable) and that it contains files.
*/
function validateTarArchive(tarPath: string): boolean {
try {
// Check if file exists and is readable.
accessSync(tarPath, constants.R_OK)

// Use tar -tzf to list contents (validates archive integrity).
const result = spawnSync('tar', ['-tzf', tarPath], {
// Use tar -tf for .tar files, tar -tzf for compressed files.
// The -z flag is for gzip compression (.tar.gz, .tgz).
const isCompressed = tarPath.endsWith('.tar.gz') || tarPath.endsWith('.tgz')
const flags = isCompressed ? '-tzf' : '-tf'

const result = spawnSync('tar', [flags, tarPath], {
encoding: 'utf8',
stdio: ['ignore', 'pipe', 'pipe'],
})
Expand Down
31 changes: 11 additions & 20 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ catalog:
magic-string: 0.30.19
octokit: 5.0.5
postject: 1.0.0-alpha.6
tar: 7.4.3
tar: 7.5.8
vitest: 4.0.3
yoctocolors-cjs: 2.1.3