cros-test - add python bindings into container
There is a minor risk with the chroot being 3.6 and the container being
3.8. In another CL I might look into downgrading the exec container back
to 3.6 to keep in lockstep with the chroot.
BUG=b:244371752
TEST=cq/local build
Change-Id: If1864ed4a2775f5e2895831b820a69aaefc21e4f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/3867538
Reviewed-by: Jaques Clapauch <jaquesc@google.com>
Commit-Queue: Derek Beckett <dbeckett@chromium.org>
Tested-by: Derek Beckett <dbeckett@chromium.org>
diff --git a/src/chromiumos/test/dockerfiles/cros-test/Dockerfile b/src/chromiumos/test/dockerfiles/cros-test/Dockerfile
index 1d0bb78..03d0d97 100644
--- a/src/chromiumos/test/dockerfiles/cros-test/Dockerfile
+++ b/src/chromiumos/test/dockerfiles/cros-test/Dockerfile
@@ -103,6 +103,7 @@
COPY --chown=chromeos-test:chromeos-test autotest/ /usr/local/autotest
COPY --chown=chromeos-test:chromeos-test shadow_config.ini /usr/local/autotest/
+COPY --chown=chromeos-test:chromeos-test chromiumos/ /usr/local/lib/python3.8/site-packages/chromiumos
RUN mkdir -p /tmp/test
# Bring in metadata to 1 location (Can be different per board.)
diff --git a/src/chromiumos/test/python/src/docker_libs/build_libs/cros_test/container_prep.py b/src/chromiumos/test/python/src/docker_libs/build_libs/cros_test/container_prep.py
index cf13fe1..316bd82 100644
--- a/src/chromiumos/test/python/src/docker_libs/build_libs/cros_test/container_prep.py
+++ b/src/chromiumos/test/python/src/docker_libs/build_libs/cros_test/container_prep.py
@@ -32,6 +32,7 @@
self.create_tarball()
self.copy_service()
self.copy_metadata()
+ self.copy_python_protos()
self.copy_dockercontext()
self.untar()
self.remove_unused_deps()
diff --git a/src/chromiumos/test/python/src/docker_libs/build_libs/shared/common_artifact_prep.py b/src/chromiumos/test/python/src/docker_libs/build_libs/shared/common_artifact_prep.py
index f942883..cb4bfa3 100644
--- a/src/chromiumos/test/python/src/docker_libs/build_libs/shared/common_artifact_prep.py
+++ b/src/chromiumos/test/python/src/docker_libs/build_libs/shared/common_artifact_prep.py
@@ -12,7 +12,10 @@
# Point up a few directories to make the other python modules discoverable.
sys.path.append('../../../../')
-from src.common.exceptions import NotDirectoryException, ConfigError # noqa: E402 pylint: disable=import-error,wrong-import-position
+from src.common.exceptions import ( # noqa: E402 pylint: disable=import-error,wrong-import-position
+ ConfigError,
+)
+from src.common.exceptions import NotDirectoryException
class CrosArtifactPrep():
@@ -86,6 +89,13 @@
shutil.copy(os.path.join(self.chroot_bin, self.service),
self.full_out)
+ def copy_python_protos(self):
+ """Copy the python proto bindings."""
+ shutil.copytree(
+ os.path.join(self.chroot,
+ 'usr/lib64/python3.6/site-packages/chromiumos'),
+ os.path.join(self.full_out, 'chromiumos'))
+
def copy_dockercontext(self):
"""Copy Docker Context needed to build the container to the output dir."""