@@ -984,7 +984,7 @@ func (p *Package) buildYarn(buildctx *buildContext, wd, result string) (bld *pac
984984 } else {
985985 commands [PackageBuildPhasePrep ] = append (commands [PackageBuildPhasePrep ], [][]string {
986986 {"mkdir" , tgt },
987- {"tar" , "xfz " , builtpkg , "--no-same-owner" , "-C" , tgt },
987+ {"tar" , "--sparse" , "-xzf " , builtpkg , "--no-same-owner" , "-C" , tgt },
988988 }... )
989989 }
990990 }
@@ -1103,7 +1103,7 @@ func (p *Package) buildYarn(buildctx *buildContext, wd, result string) (bld *pac
11031103 {"sh" , "-c" , fmt .Sprintf ("yarn generate-lock-entry --resolved file://./%s > _mirror/content_yarn.lock" , dst )},
11041104 {"sh" , "-c" , "cat yarn.lock >> _mirror/content_yarn.lock" },
11051105 {"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" , "." },
11071107 }... )
11081108 resultDir = "_mirror"
11091109 } else if cfg .Packaging == YarnLibrary {
@@ -1127,11 +1127,11 @@ func (p *Package) buildYarn(buildctx *buildContext, wd, result string) (bld *pac
11271127 {"yarn" , "pack" , "--filename" , pkg },
11281128 {"sh" , "-c" , fmt .Sprintf ("cat yarn.lock %s > _pkg/yarn.lock" , pkgYarnLock )},
11291129 {"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" , "." },
11311131 }... )
11321132 resultDir = "_pkg"
11331133 } 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 ), "." })
11351135 } else {
11361136 return nil , xerrors .Errorf ("unknown Yarn packaging: %s" , cfg .Packaging )
11371137 }
@@ -1299,7 +1299,7 @@ func (p *Package) buildGo(buildctx *buildContext, wd, result string) (res *packa
12991299
13001300 commands [PackageBuildPhasePackage ] = append (commands [PackageBuildPhasePackage ], []string {"rm" , "-rf" , "_deps" })
13011301 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 ), "." ,
13031303 })
13041304 if ! cfg .DontTest && ! buildctx .DontTest {
13051305 commands [PackageBuildPhasePackage ] = append (commands [PackageBuildPhasePackage ], [][]string {
@@ -1396,7 +1396,7 @@ func (p *Package) buildDocker(buildctx *buildContext, wd, result string) (res *p
13961396 tgt := p .BuildLayoutLocation (dep )
13971397 commands [PackageBuildPhasePrep ] = append (commands [PackageBuildPhasePrep ], [][]string {
13981398 {"mkdir" , tgt },
1399- {"tar" , "xfz " , fn , "--no-same-owner" , "-C" , tgt },
1399+ {"tar" , "--sparse" , "-xzf " , fn , "--no-same-owner" , "-C" , tgt },
14001400 }... )
14011401
14021402 if dep .Type != DockerPackage {
@@ -1486,7 +1486,7 @@ func (p *Package) buildDocker(buildctx *buildContext, wd, result string) (res *p
14861486 }
14871487 pkgCommands = append (pkgCommands , []string {"sh" , "-c" , fmt .Sprintf ("echo %s | base64 -d > %s" , base64 .StdEncoding .EncodeToString (consts ), dockerMetadataFile )})
14881488
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 }
14901490 if p .C .W .Provenance .Enabled {
14911491 archiveCmd = append (archiveCmd , "./" + provenanceBundleFilename )
14921492 }
@@ -1648,7 +1648,7 @@ func (p *Package) buildGeneric(buildctx *buildContext, wd, result string) (res *
16481648 log .WithField ("package" , p .FullName ()).Debug ("package has no commands nor test - creating empty tar" )
16491649
16501650 compressArg := getCompressionArg (buildctx )
1651- tarArgs := []string {"cf" , result }
1651+ tarArgs := []string {"--sparse" , "- cf" , result }
16521652 if compressArg != "" {
16531653 tarArgs = append (tarArgs , compressArg )
16541654 }
@@ -1681,7 +1681,7 @@ func (p *Package) buildGeneric(buildctx *buildContext, wd, result string) (res *
16811681 tgt := p .BuildLayoutLocation (dep )
16821682 commands = append (commands , [][]string {
16831683 {"mkdir" , tgt },
1684- {"tar" , "xfz " , fn , "--no-same-owner" , "-C" , tgt },
1684+ {"tar" , "--sparse" , "-xzf " , fn , "--no-same-owner" , "-C" , tgt },
16851685 }... )
16861686 }
16871687
@@ -1692,7 +1692,7 @@ func (p *Package) buildGeneric(buildctx *buildContext, wd, result string) (res *
16921692 }
16931693
16941694 compressArg := getCompressionArg (buildctx )
1695- tarArgs := []string {"cf" , result }
1695+ tarArgs := []string {"--sparse" , "- cf" , result }
16961696 if compressArg != "" {
16971697 tarArgs = append (tarArgs , compressArg )
16981698 }
0 commit comments