api: field_handler: Translate chroot paths with chroot_lib
The build API router has its own path translation for many proto fields,
so certain artifacts can be transparently copied/synced in and out of
the chroot. This translation assumed it can do relative path and path
prefix computations. We're changing this assumption, so it needs to use
path_util or chroot_lib.
BUG=b:265885353, b:280706034
TEST=./run_tests
Change-Id: Id5fb422e4b4e48e74164b2ebf08e8f948a008181
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/4507724
Commit-Queue: Brian Norris <briannorris@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Tested-by: Brian Norris <briannorris@chromium.org>
diff --git a/api/router.py b/api/router.py
index 72b1a26..bd80d80 100644
--- a/api/router.py
+++ b/api/router.py
@@ -477,7 +477,7 @@
field_handler.copy_paths_in(
input_msg,
chroot.tmp,
- prefix=chroot.path,
+ chroot=chroot,
)
)
# The sync-directories context manager to handle SyncedDir messages.
@@ -485,7 +485,7 @@
field_handler.sync_dirs(
input_msg,
sync_tempdir,
- prefix=chroot.path,
+ chroot=chroot,
)
)