Build API: Additional controller_util functionality.

Added BuildTarget parsing in controller util.
Added eq support in BuildTarget and Chroot to make testing
easier and cleaner.
Enforce BuildTarget.name and Chroot.path immutability.

BUG=None
TEST=run_tests

Change-Id: I6699a83e67940799279a6bcb8fb8a4fbb559c2b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1739156
Tested-by: Alex Klein <saklein@chromium.org>
Reviewed-by: David Burger <dburger@chromium.org>
Commit-Queue: Alex Klein <saklein@chromium.org>
diff --git a/api/controller/artifacts.py b/api/controller/artifacts.py
index e16b7c0..f00d856 100644
--- a/api/controller/artifacts.py
+++ b/api/controller/artifacts.py
@@ -168,7 +168,7 @@
   # TODO(saklein) Cleanup legacy handling after it has been switched over.
   if target:
     # Legacy handling.
-    chroot.path = os.path.join(build_root, 'chroot')
+    chroot = chroot_lib.Chroot(path=os.path.join(build_root, 'chroot'))
     sysroot_path = os.path.join('/build', target)
 
   # New handling - chroot & sysroot based.
@@ -294,7 +294,7 @@
   if target:
     # Legacy handling.
     build_root = constants.SOURCE_ROOT
-    chroot.path = os.path.join(build_root, 'chroot')
+    chroot = chroot_lib.Chroot(path=os.path.join(build_root, 'chroot'))
     sysroot_path = os.path.join('/build', target)
 
   # TODO(saklein): Switch to validation_complete decorator after legacy