Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2875)

Unified Diff: autoupdate.py

Issue 5281002: Fix --payload for optional stateful.tgz. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/dev-util.git@master
Patch Set: Added warning if stateful.tgz missing for --payload. Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: autoupdate.py
diff --git a/autoupdate.py b/autoupdate.py
index 2addd2c760976eeaa6382ed0b911d5f2b9a2088e..84dc69074ac3288561b62baf5682b35de8ac99ee 100644
--- a/autoupdate.py
+++ b/autoupdate.py
@@ -529,15 +529,26 @@ class Autoupdate(BuildObject):
if self.forced_payload:
# If the forced payload is not already in our static_image_dir,
# copy it there.
- if (os.path.dirname(os.path.abspath(self.forced_payload)) !=
- os.path.abspath(static_image_dir)):
- self._Copy(self.forced_payload, os.path.join(static_image_dir,
- UPDATE_FILE))
-
- self._Copy(os.path.join(os.path.dirname(self.forced_payload),
- STATEFUL_FILE),
- os.path.join(static_image_dir,
- STATEFUL_FILE))
+ src_path = os.path.abspath(self.forced_payload)
+ dest_path = os.path.join(static_image_dir, UPDATE_FILE)
+
+ src_stateful = os.path.join(os.path.dirname(src_path),
+ STATEFUL_FILE)
+ dest_stateful = os.path.join(static_image_dir,
+ STATEFUL_FILE)
+
+ # Only copy the files if the source directory is different from dest.
+ if os.path.dirname(src_path) != os.path.abspath(static_image_dir):
+ self._Copy(src_path, dest_path)
+
+ # The stateful payload is optional.
+ if os.path.exists(src_stateful):
+ self._Copy(src_stateful, dest_stateful)
+ else:
+ _LogMessage('WARN: %s not found. Expected for dev and test builds.' %
+ STATEFUL_FILE)
+ if os.path.exists(dest_stateful):
+ os.remove(dest_stateful)
return UPDATE_FILE
elif self.forced_image:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698