Merge "Allow empty zip file in extra files in install command."

This commit is contained in:
Romain Jobredeaux 2022-06-07 15:14:18 +00:00 committed by Gerrit Code Review
commit 41758c71be
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") fmt.Fprintf(buf, "\tchmod +x $@\n")
} }
if extraFiles := install.extraFiles; extraFiles != nil { 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) fmt.Fprintln(buf)
} }

View file

@ -3282,8 +3282,9 @@ func (m *moduleContext) installFile(installPath InstallPath, name string, srcPat
extraCmds := "" extraCmds := ""
if extraZip != nil { 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()) 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) implicitDeps = append(implicitDeps, extraZip.zip)
} }