SysrootService: use package_indexes list when present.

If package_indexes is provided, then that is used instead of the
BINHOST.conf from the overlays.

BUG=chromium:1088059
TEST=unit tests pass.

Change-Id: Ic2041e7bcc93242403d01e1f12d93fbd44539d13
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2341833
Tested-by: LaMont Jones <lamontjones@chromium.org>
Reviewed-by: Alex Klein <saklein@chromium.org>
Commit-Queue: LaMont Jones <lamontjones@chromium.org>
diff --git a/lib/build_target_lib.py b/lib/build_target_lib.py
index d6bee95..828e3bd 100644
--- a/lib/build_target_lib.py
+++ b/lib/build_target_lib.py
@@ -10,6 +10,8 @@
 import os
 import re
 
+from chromite.api.gen.chromiumos import common_pb2
+
 
 class Error(Exception):
   """Base module error class."""
@@ -59,6 +61,18 @@
   def name(self):
     return self._name
 
+  @property
+  def as_protobuf(self):
+    return common_pb2.BuildTarget(name=self.name)
+
+  @classmethod
+  def from_protobuf(cls, message):
+    return cls(name=message.name)
+
+  @property
+  def profile_protobuf(self):
+    return common_pb2.Profile(name=self.profile)
+
   def full_path(self, *args):
     """Turn a sysroot-relative path into an absolute path."""
     return os.path.join(self.root, *[part.lstrip(os.sep) for part in args])