summaryrefslogtreecommitdiff
path: root/scripts/update_payload/applier.py
diff options
context:
space:
mode:
authorGilad Arnold <garnold@chromium.org>2013-05-27 16:54:59 -0700
committerChromeBot <chrome-bot@google.com>2013-06-03 14:31:57 -0700
commitf69065c07bb2eccc88499ba34429f62f707e19b8 (patch)
tree69f555cced23e268843fe855af2793850049f22a /scripts/update_payload/applier.py
parente5fdf189ce3a4628f02a0bd5e09694bf7b815cdf (diff)
paycheck/applier: stop using fallocate
It appears that fallocate is not supported on certain filesystems (e.g. failing on paygen genati instances). It also appears that we can do just fine without it when applying a full update, without significant impact on performance. In the interest of making the update_payload library more portable, we therefore drop the fallocate call and replace it with a simple create/truncate code (all Python standard lib calls). BUG=chromium:244091 TEST=Integration tests Change-Id: I57f7dec19e8131050c1d56d891e486714d4f7128 Reviewed-on: https://gerrit.chromium.org/gerrit/56762 Tested-by: Gilad Arnold <garnold@chromium.org> Reviewed-by: Matt Tennant <mtennant@chromium.org> Commit-Queue: Gilad Arnold <garnold@chromium.org>
Diffstat (limited to 'scripts/update_payload/applier.py')
-rw-r--r--scripts/update_payload/applier.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/scripts/update_payload/applier.py b/scripts/update_payload/applier.py
index 52a70f91..85f8b0eb 100644
--- a/scripts/update_payload/applier.py
+++ b/scripts/update_payload/applier.py
@@ -424,15 +424,15 @@ class PayloadApplier(object):
_VerifySha256(old_part_file, old_part_info.hash, part_name,
length=old_part_info.size)
- # Copy the src partition to the dst one.
+ # Copy the src partition to the dst one; make sure we don't truncate it.
shutil.copyfile(old_part_file_name, new_part_file_name)
+ new_part_file_mode = 'r+b'
else:
- # Preallocate the dst partition file.
- subprocess.check_call(
- ['fallocate', '-l', str(new_part_info.size), new_part_file_name])
+ # We need to create/truncate the dst partition file.
+ new_part_file_mode = 'w+b'
# Apply operations.
- with open(new_part_file_name, 'r+b') as new_part_file:
+ with open(new_part_file_name, new_part_file_mode) as new_part_file:
self._ApplyOperations(operations, base_name, new_part_file,
new_part_info.size)
# Truncate the result, if so instructed.