Use unzip -DD

We put reproducible timestamps in zip files so that the artifacts
are consistent, but that leads to old timestamps in the output
directory if they are unzipped as part of the build.  Use
unzip -DD when unzipping to update the timestamps.

Bug: 161015009
Test: touch -d 2020-01-01 ref; find $OUT/system -not -newer ref
Change-Id: I70407a627cb070e24be510faa6a774e3d9eae3a8
This commit is contained in:
Colin Cross 2020-07-11 22:30:45 -07:00
parent 41405cc275
commit d783bbbace
3 changed files with 3 additions and 3 deletions

View File

@ -390,7 +390,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
} else { } else {
if fi.class == appSet { if fi.class == appSet {
copyCommands = append(copyCommands, copyCommands = append(copyCommands,
fmt.Sprintf("unzip -q -d %s %s", destPathDir, fi.builtFile.String())) fmt.Sprintf("unzip -qDD -d %s %s", destPathDir, fi.builtFile.String()))
} else { } else {
copyCommands = append(copyCommands, "cp -f "+fi.builtFile.String()+" "+destPath) copyCommands = append(copyCommands, "cp -f "+fi.builtFile.String()+" "+destPath)
} }

View File

@ -641,7 +641,7 @@ func (a *AARImport) DepsMutator(ctx android.BottomUpMutatorContext) {
var unzipAAR = pctx.AndroidStaticRule("unzipAAR", var unzipAAR = pctx.AndroidStaticRule("unzipAAR",
blueprint.RuleParams{ blueprint.RuleParams{
Command: `rm -rf $outDir && mkdir -p $outDir && ` + Command: `rm -rf $outDir && mkdir -p $outDir && ` +
`unzip -qo -d $outDir $in && rm -rf $outDir/res && touch $out`, `unzip -qoDD -d $outDir $in && rm -rf $outDir/res && touch $out`,
}, },
"outDir") "outDir")

View File

@ -146,7 +146,7 @@ func (h *hiddenAPI) hiddenAPIGenerateCSV(ctx android.ModuleContext, flagsCSV, me
var hiddenAPIEncodeDexRule = pctx.AndroidStaticRule("hiddenAPIEncodeDex", blueprint.RuleParams{ var hiddenAPIEncodeDexRule = pctx.AndroidStaticRule("hiddenAPIEncodeDex", blueprint.RuleParams{
Command: `rm -rf $tmpDir && mkdir -p $tmpDir && mkdir $tmpDir/dex-input && mkdir $tmpDir/dex-output && Command: `rm -rf $tmpDir && mkdir -p $tmpDir && mkdir $tmpDir/dex-input && mkdir $tmpDir/dex-output &&
unzip -o -q $in 'classes*.dex' -d $tmpDir/dex-input && unzip -qoDD $in 'classes*.dex' -d $tmpDir/dex-input &&
for INPUT_DEX in $$(find $tmpDir/dex-input -maxdepth 1 -name 'classes*.dex' | sort); do for INPUT_DEX in $$(find $tmpDir/dex-input -maxdepth 1 -name 'classes*.dex' | sort); do
echo "--input-dex=$${INPUT_DEX}"; echo "--input-dex=$${INPUT_DEX}";
echo "--output-dex=$tmpDir/dex-output/$$(basename $${INPUT_DEX})"; echo "--output-dex=$tmpDir/dex-output/$$(basename $${INPUT_DEX})";