@@ -984,7 +984,7 @@ func (p *Package) buildYarn(buildctx *buildContext, wd, result string) (bld *pac
984
984
} else {
985
985
commands [PackageBuildPhasePrep ] = append (commands [PackageBuildPhasePrep ], [][]string {
986
986
{"mkdir" , tgt },
987
- {"tar" , "xfz " , builtpkg , "--no-same-owner" , "-C" , tgt },
987
+ {"tar" , "--sparse" , "-xzf " , builtpkg , "--no-same-owner" , "-C" , tgt },
988
988
}... )
989
989
}
990
990
}
@@ -1103,7 +1103,7 @@ func (p *Package) buildYarn(buildctx *buildContext, wd, result string) (bld *pac
1103
1103
{"sh" , "-c" , fmt .Sprintf ("yarn generate-lock-entry --resolved file://./%s > _mirror/content_yarn.lock" , dst )},
1104
1104
{"sh" , "-c" , "cat yarn.lock >> _mirror/content_yarn.lock" },
1105
1105
{"yarn" , "pack" , "--filename" , dst },
1106
- {"tar" , "cf" , result , fmt .Sprintf ("--use-compress-program=%v" , compressor ), "-C" , "_mirror" , "." },
1106
+ {"tar" , "--sparse" , "- cf" , result , fmt .Sprintf ("--use-compress-program=%v" , compressor ), "-C" , "_mirror" , "." },
1107
1107
}... )
1108
1108
resultDir = "_mirror"
1109
1109
} else if cfg .Packaging == YarnLibrary {
@@ -1127,11 +1127,11 @@ func (p *Package) buildYarn(buildctx *buildContext, wd, result string) (bld *pac
1127
1127
{"yarn" , "pack" , "--filename" , pkg },
1128
1128
{"sh" , "-c" , fmt .Sprintf ("cat yarn.lock %s > _pkg/yarn.lock" , pkgYarnLock )},
1129
1129
{"yarn" , "--cwd" , "_pkg" , "install" , "--prod" , "--frozen-lockfile" },
1130
- {"tar" , "cf" , result , fmt .Sprintf ("--use-compress-program=%v" , compressor ), "-C" , "_pkg" , "." },
1130
+ {"tar" , "--sparse" , "- cf" , result , fmt .Sprintf ("--use-compress-program=%v" , compressor ), "-C" , "_pkg" , "." },
1131
1131
}... )
1132
1132
resultDir = "_pkg"
1133
1133
} else if cfg .Packaging == YarnArchive {
1134
- pkgCommands = append (pkgCommands , []string {"tar" , "cf" , result , fmt .Sprintf ("--use-compress-program=%v" , compressor ), "." })
1134
+ pkgCommands = append (pkgCommands , []string {"tar" , "--sparse" , "- cf" , result , fmt .Sprintf ("--use-compress-program=%v" , compressor ), "." })
1135
1135
} else {
1136
1136
return nil , xerrors .Errorf ("unknown Yarn packaging: %s" , cfg .Packaging )
1137
1137
}
@@ -1299,7 +1299,7 @@ func (p *Package) buildGo(buildctx *buildContext, wd, result string) (res *packa
1299
1299
1300
1300
commands [PackageBuildPhasePackage ] = append (commands [PackageBuildPhasePackage ], []string {"rm" , "-rf" , "_deps" })
1301
1301
commands [PackageBuildPhasePackage ] = append (commands [PackageBuildPhasePackage ], []string {
1302
- "tar" , "cf" , result , fmt .Sprintf ("--use-compress-program=%v" , compressor ), "." ,
1302
+ "tar" , "--sparse" , "- cf" , result , fmt .Sprintf ("--use-compress-program=%v" , compressor ), "." ,
1303
1303
})
1304
1304
if ! cfg .DontTest && ! buildctx .DontTest {
1305
1305
commands [PackageBuildPhasePackage ] = append (commands [PackageBuildPhasePackage ], [][]string {
@@ -1396,7 +1396,7 @@ func (p *Package) buildDocker(buildctx *buildContext, wd, result string) (res *p
1396
1396
tgt := p .BuildLayoutLocation (dep )
1397
1397
commands [PackageBuildPhasePrep ] = append (commands [PackageBuildPhasePrep ], [][]string {
1398
1398
{"mkdir" , tgt },
1399
- {"tar" , "xfz " , fn , "--no-same-owner" , "-C" , tgt },
1399
+ {"tar" , "--sparse" , "-xzf " , fn , "--no-same-owner" , "-C" , tgt },
1400
1400
}... )
1401
1401
1402
1402
if dep .Type != DockerPackage {
@@ -1486,7 +1486,7 @@ func (p *Package) buildDocker(buildctx *buildContext, wd, result string) (res *p
1486
1486
}
1487
1487
pkgCommands = append (pkgCommands , []string {"sh" , "-c" , fmt .Sprintf ("echo %s | base64 -d > %s" , base64 .StdEncoding .EncodeToString (consts ), dockerMetadataFile )})
1488
1488
1489
- archiveCmd := []string {"tar" , "cf" , result , fmt .Sprintf ("--use-compress-program=%v" , compressor ), "./" + dockerImageNamesFiles , "./" + dockerMetadataFile }
1489
+ archiveCmd := []string {"tar" , "--sparse" , "- cf" , result , fmt .Sprintf ("--use-compress-program=%v" , compressor ), "./" + dockerImageNamesFiles , "./" + dockerMetadataFile }
1490
1490
if p .C .W .Provenance .Enabled {
1491
1491
archiveCmd = append (archiveCmd , "./" + provenanceBundleFilename )
1492
1492
}
@@ -1648,7 +1648,7 @@ func (p *Package) buildGeneric(buildctx *buildContext, wd, result string) (res *
1648
1648
log .WithField ("package" , p .FullName ()).Debug ("package has no commands nor test - creating empty tar" )
1649
1649
1650
1650
compressArg := getCompressionArg (buildctx )
1651
- tarArgs := []string {"cf" , result }
1651
+ tarArgs := []string {"--sparse" , "- cf" , result }
1652
1652
if compressArg != "" {
1653
1653
tarArgs = append (tarArgs , compressArg )
1654
1654
}
@@ -1681,7 +1681,7 @@ func (p *Package) buildGeneric(buildctx *buildContext, wd, result string) (res *
1681
1681
tgt := p .BuildLayoutLocation (dep )
1682
1682
commands = append (commands , [][]string {
1683
1683
{"mkdir" , tgt },
1684
- {"tar" , "xfz " , fn , "--no-same-owner" , "-C" , tgt },
1684
+ {"tar" , "--sparse" , "-xzf " , fn , "--no-same-owner" , "-C" , tgt },
1685
1685
}... )
1686
1686
}
1687
1687
@@ -1692,7 +1692,7 @@ func (p *Package) buildGeneric(buildctx *buildContext, wd, result string) (res *
1692
1692
}
1693
1693
1694
1694
compressArg := getCompressionArg (buildctx )
1695
- tarArgs := []string {"cf" , result }
1695
+ tarArgs := []string {"--sparse" , "- cf" , result }
1696
1696
if compressArg != "" {
1697
1697
tarArgs = append (tarArgs , compressArg )
1698
1698
}
0 commit comments