Add -quiet
option in soong_zip
The quiet option prevents warnings from being printed to the console. Test: m soong_zip Bug: 300166930 Change-Id: I4c2c5f16c45c2874a2a2cbb1e3f397124043e472
This commit is contained in:
@@ -174,6 +174,7 @@ func main() {
|
|||||||
traceFile := flags.String("trace", "", "write trace to file")
|
traceFile := flags.String("trace", "", "write trace to file")
|
||||||
sha256Checksum := flags.Bool("sha256", false, "add a zip header to each file containing its SHA256 digest")
|
sha256Checksum := flags.Bool("sha256", false, "add a zip header to each file containing its SHA256 digest")
|
||||||
doNotWrite := flags.Bool("n", false, "Nothing is written to disk -- all other work happens")
|
doNotWrite := flags.Bool("n", false, "Nothing is written to disk -- all other work happens")
|
||||||
|
quiet := flags.Bool("quiet", false, "do not print warnings to console")
|
||||||
|
|
||||||
flags.Var(&rootPrefix{}, "P", "path prefix within the zip at which to place files")
|
flags.Var(&rootPrefix{}, "P", "path prefix within the zip at which to place files")
|
||||||
flags.Var(&listFiles{}, "l", "file containing list of files to zip")
|
flags.Var(&listFiles{}, "l", "file containing list of files to zip")
|
||||||
@@ -238,6 +239,7 @@ func main() {
|
|||||||
IgnoreMissingFiles: *ignoreMissingFiles,
|
IgnoreMissingFiles: *ignoreMissingFiles,
|
||||||
Sha256Checksum: *sha256Checksum,
|
Sha256Checksum: *sha256Checksum,
|
||||||
DoNotWrite: *doNotWrite,
|
DoNotWrite: *doNotWrite,
|
||||||
|
Quiet: *quiet,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(os.Stderr, "error:", err.Error())
|
fmt.Fprintln(os.Stderr, "error:", err.Error())
|
||||||
|
@@ -283,6 +283,7 @@ type ZipArgs struct {
|
|||||||
IgnoreMissingFiles bool
|
IgnoreMissingFiles bool
|
||||||
Sha256Checksum bool
|
Sha256Checksum bool
|
||||||
DoNotWrite bool
|
DoNotWrite bool
|
||||||
|
Quiet bool
|
||||||
|
|
||||||
Stderr io.Writer
|
Stderr io.Writer
|
||||||
Filesystem pathtools.FileSystem
|
Filesystem pathtools.FileSystem
|
||||||
@@ -340,7 +341,9 @@ func zipTo(args ZipArgs, w io.Writer) error {
|
|||||||
Err: os.ErrNotExist,
|
Err: os.ErrNotExist,
|
||||||
}
|
}
|
||||||
if args.IgnoreMissingFiles {
|
if args.IgnoreMissingFiles {
|
||||||
|
if !args.Quiet {
|
||||||
fmt.Fprintln(z.stderr, "warning:", err)
|
fmt.Fprintln(z.stderr, "warning:", err)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -357,7 +360,9 @@ func zipTo(args ZipArgs, w io.Writer) error {
|
|||||||
Err: os.ErrNotExist,
|
Err: os.ErrNotExist,
|
||||||
}
|
}
|
||||||
if args.IgnoreMissingFiles {
|
if args.IgnoreMissingFiles {
|
||||||
|
if !args.Quiet {
|
||||||
fmt.Fprintln(z.stderr, "warning:", err)
|
fmt.Fprintln(z.stderr, "warning:", err)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -368,7 +373,9 @@ func zipTo(args ZipArgs, w io.Writer) error {
|
|||||||
Err: syscall.ENOTDIR,
|
Err: syscall.ENOTDIR,
|
||||||
}
|
}
|
||||||
if args.IgnoreMissingFiles {
|
if args.IgnoreMissingFiles {
|
||||||
|
if !args.Quiet {
|
||||||
fmt.Fprintln(z.stderr, "warning:", err)
|
fmt.Fprintln(z.stderr, "warning:", err)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user