trace_replay: Support running on Arch-based images with pacman.
Arch has pacman instead of dpkg. Attempt both to see if a package
exists.
BUG=b:214587693
TEST=tast -verbose run -buildbundle=crosint $dut borealis.TraceReplay.hollow_knight
Change-Id: I875296304fa0b7ebb09363b2fcc4d51e373b837f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/graphics/+/3389706
Tested-by: David Riley <davidriley@chromium.org>
Auto-Submit: David Riley <davidriley@chromium.org>
Reviewed-by: Ilja Friedel <ihf@chromium.org>
Commit-Queue: David Riley <davidriley@chromium.org>
diff --git a/src/trace_replay/cmd/trace_replay/main.go b/src/trace_replay/cmd/trace_replay/main.go
index 93f42f1..2e096c6 100644
--- a/src/trace_replay/cmd/trace_replay/main.go
+++ b/src/trace_replay/cmd/trace_replay/main.go
@@ -489,8 +489,11 @@
}
func checkPackageInstalled(ctx context.Context, name string) error {
+ // Attempt to dpkg -l (for Debian/Ubuntu) and, if that fails, pacman -Q (for Arch).
if exitCode, _, stderr := runCommand(ctx, nil, "dpkg", "-l", name); exitCode != 0 {
- return errors.New("dpkg for %s failed with exit code %d! %s", name, exitCode, stderr)
+ if exitCode, _, stderr = runCommand(ctx, nil, "pacman", "-Q", name); exitCode != 0 {
+ return errors.New("dpkg -l and pacman -Q for %s failed with exit code %d! %s", name, exitCode, stderr)
+ }
}
return nil
}