Merge "Allow empty zip file in extra files in install command." am: 41758c71be

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2100283

Change-Id: I563ab9509f422698671f2cc6eff9950524bffbd8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Romain Jobredeaux 2022-06-07 15:34:20 +00:00 committed by Automerger Merge Worker
commit 9eadd04b98
2 changed files with 4 additions and 2 deletions

View file

@ -472,7 +472,8 @@ func (s *makeVarsSingleton) writeInstalls(installs, symlinks []katiInstall) []by
fmt.Fprintf(buf, "\tchmod +x $@\n")
}
if extraFiles := install.extraFiles; extraFiles != nil {
fmt.Fprintf(buf, "\tunzip -qDD -d '%s' '%s'\n", extraFiles.dir.String(), extraFiles.zip.String())
fmt.Fprintf(buf, "\t( unzip -qDD -d '%s' '%s' 2>&1 | grep -v \"zipfile is empty\"; exit $${PIPESTATUS[0]} ) || \\\n", extraFiles.dir.String(), extraFiles.zip.String())
fmt.Fprintf(buf, "\t ( code=$$?; if [ $$code -ne 0 -a $$code -ne 1 ]; then exit $$code; fi )\n")
}
fmt.Fprintln(buf)
}

View file

@ -3282,8 +3282,9 @@ func (m *moduleContext) installFile(installPath InstallPath, name string, srcPat
extraCmds := ""
if extraZip != nil {
extraCmds += fmt.Sprintf(" && unzip -qDD -d '%s' '%s'",
extraCmds += fmt.Sprintf(" && ( unzip -qDD -d '%s' '%s' 2>&1 | grep -v \"zipfile is empty\"; exit $${PIPESTATUS[0]} )",
extraZip.dir.String(), extraZip.zip.String())
extraCmds += " || ( code=$$?; if [ $$code -ne 0 -a $$code -ne 1 ]; then exit $$code; fi )"
implicitDeps = append(implicitDeps, extraZip.zip)
}