goofool: Ignore warning messages when tar returns 1
The return code '1' for 'tar' means there were files changed when
archiving files. If there were other errors tar should return 2.
So, we should not check the error messages when return code is 1 - the
messages may be different on other (or newer) tar implementations.
BUG=b:147722589
TEST=make test
Change-Id: I815ef3c1dfac26b05805cb0a81e0087e15ecc792
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/factory/+/2003837
Commit-Queue: Hung-Te Lin <hungte@chromium.org>
Commit-Queue: Wei-Han Chen <stimim@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Auto-Submit: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Wei-Han Chen <stimim@chromium.org>
diff --git a/py/gooftool/commands.py b/py/gooftool/commands.py
index fa59fc0..a534f05 100755
--- a/py/gooftool/commands.py
+++ b/py/gooftool/commands.py
@@ -654,10 +654,10 @@
tar_cmd += ' %s' % pipes.quote(f[1:])
cmd_result = Shell(tar_cmd)
- if ((cmd_result.status == 1) and
- all((x == '' or 'file changed as we read it' in x)
- for x in cmd_result.stderr.split('\n'))):
- # That's OK. Make sure it's valid though.
+ if cmd_result.status == 1:
+ # tar returns 1 when some files were changed during archiving,
+ # but that is expected for log files so should ignore such failure
+ # if the archive looks good.
Spawn(['tar', 'tJf', target_path], check_call=True, log=True,
ignore_stdout=True)
elif not cmd_result.success: