aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAri Hausman-Cohen <arihc@google.com>2016-05-03 16:38:04 -0700
committerAri Hausman-Cohen <arihc@google.com>2016-05-03 16:39:42 -0700
commit647dc5c0a3e86894a62858e2ce690a911da08fa2 (patch)
tree73b82e1e95b9fe92db00eb18a1c6651906772d26
parentb2b082128abb2bc060c0ef101ee7cc7162624c39 (diff)
downloadbdk-647dc5c0a3e86894a62858e2ce690a911da08fa2.tar.gz
Fix up some issues with flash/sync
BUG: 28564349 Change-Id: Idd9ee459f8cdeae9871c7d8d38acc5ce2c52aed2 TEST: unit tests pass, manually did image build/flash/syncs.
-rw-r--r--cli/lib/commands/v2/root/sync.py3
-rw-r--r--cli/lib/core/image_build.py3
-rw-r--r--cli/lib/environment/sysroot.py10
-rw-r--r--cli/lib/environment/sysroot_stub.py3
4 files changed, 12 insertions, 7 deletions
diff --git a/cli/lib/commands/v2/root/sync.py b/cli/lib/commands/v2/root/sync.py
index 5ebbe10..25ed191 100644
--- a/cli/lib/commands/v2/root/sync.py
+++ b/cli/lib/commands/v2/root/sync.py
@@ -109,7 +109,8 @@ class Sync(clicommand.Command):
# Point adb to the user artifact sysroot for syncing. This means changes
# to the platform won't be pushed by `bdk sync`, which is good because
# platform changes should probably require a full image flash.
- adb_tool.environment['ANDROID_PRODUCT_OUT'] = target_dir
+ adb_tool.environment['ANDROID_PRODUCT_OUT'] = os.path.join(
+ target_dir, 'root')
# adb does it's own parsing rather than using a library, so we have to
# be pretty careful to specify args the way it expects. Usage must be:
diff --git a/cli/lib/core/image_build.py b/cli/lib/core/image_build.py
index 77aac2d..462376f 100644
--- a/cli/lib/core/image_build.py
+++ b/cli/lib/core/image_build.py
@@ -312,7 +312,8 @@ def _CreateBuildProps(build_root, product_out, image_type, info_file):
'obj',
'PACKAGING',
'systemimage_intermediates',
- 'system_image_info.txt'), info_file)
+ 'system_image_info.txt'), info_file,
+ overwrite=True)
for line in fileinput.input(build_root.Path(info_file), inplace=True):
# We just want to change the SELinux file contexts.
if line.startswith('selinux_fc'):
diff --git a/cli/lib/environment/sysroot.py b/cli/lib/environment/sysroot.py
index a07fd28..347d2af 100644
--- a/cli/lib/environment/sysroot.py
+++ b/cli/lib/environment/sysroot.py
@@ -92,20 +92,22 @@ class Sysroot(object):
src_st = os.lstat(src)
os.utime(real_dest, (src_st.st_atime, src_st.st_mtime + 1))
- def AddFile(self, src, dest=''):
+ def AddFile(self, src, dest='', overwrite=False):
"""Copies a file from src to dest.
Args:
- src - the file to copy.
- dest - where to copy to. If a directory, uses the filename from src.
+ src: the file to copy.
+ dest: where to copy to. If a directory, uses the filename from src.
The dest directory must already exist.
+ overwrite: (optional) If True, always overwrite, even if src is
+ older than dest.
Raises:
IOError if the copy fails.
"""
try:
tgt = self.Path(dest)
- if self._src_is_newer(src, tgt):
+ if overwrite or self._src_is_newer(src, tgt):
shutil.copy2(src, tgt)
self._copy_times(src, tgt)
except (IOError, OSError) as e:
diff --git a/cli/lib/environment/sysroot_stub.py b/cli/lib/environment/sysroot_stub.py
index 17048fb..059d552 100644
--- a/cli/lib/environment/sysroot_stub.py
+++ b/cli/lib/environment/sysroot_stub.py
@@ -53,7 +53,8 @@ class StubSysroot(object):
else:
raise IOError('not supposed to write {0}'.format(path))
- def AddFile(self, src, dest=''):
+ # pylint: disable=unused-argument
+ def AddFile(self, src, dest='', overwrite=False):
if not (src, dest) in self.should_add_file:
raise IOError('Not supposed to add file {0} to {1}'.format(src,
dest))