build_dlc: Only copy directory contents into DLC image.
We don't want to copy the root of the DLC artifact source directory into
the image file, since this means we can't as easily control what is at
the top of the folder structure.
Also replace 'cp -a' with osutils.CopyDircontents()
And a few nits.
BUG=chromium:911169
TEST=unittests
TEST=Created a dlc and mounted it, the structurs were correct.
Change-Id: If2ec5fd93b863aa9016f8dc9ca2f73e9e1d96f53
Reviewed-on: https://chromium-review.googlesource.com/1359024
Commit-Ready: Amin Hassani <ahassani@chromium.org>
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Nicolas Norvez <norvez@chromium.org>
diff --git a/scripts/build_dlc.py b/scripts/build_dlc.py
index 1a1012e..2e48fa0 100644
--- a/scripts/build_dlc.py
+++ b/scripts/build_dlc.py
@@ -107,7 +107,8 @@
osutils.SafeMakedirs(dlc_root_dir)
try:
# Copy DLC files over to the image.
- cros_build_lib.SudoRunCommand(['cp', '-a', self.src_dir, dlc_root_dir])
+ osutils.CopyDirContents(self.src_dir, dlc_root_dir)
+
self.SquashOwnerships(mount_point)
finally:
# Unmount the ext4 image.
@@ -124,8 +125,8 @@
squashfs_root = os.path.join(temp_dir, 'squashfs-root')
dlc_root_dir = os.path.join(squashfs_root, self._DLC_ROOT_DIR)
osutils.SafeMakedirs(dlc_root_dir)
+ osutils.CopyDirContents(self.src_dir, dlc_root_dir)
- cros_build_lib.SudoRunCommand(['cp', '-a', self.src_dir, dlc_root_dir])
self.SquashOwnerships(squashfs_root)
cros_build_lib.RunCommand(['mksquashfs', squashfs_root, self.dest_image,