Chromium Code Reviews| Index: autoupdate.py |
| diff --git a/autoupdate.py b/autoupdate.py |
| index 2addd2c760976eeaa6382ed0b911d5f2b9a2088e..777a4e5103a5052234f06063a829a8deac8abf16 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) |
| + |
| + # If the files are already in the destination dir, don't copy them. |
| + if os.path.dirname(src_path) != os.path.abspath(static_image_dir): |
|
sosa
2010/11/23 00:49:42
The comment here is somewhat misleading. Can you
dgarrett
2010/11/23 01:30:27
Done.
|
| + self._Copy(src_path, dest_path) |
| + |
| + # The stateful payload is optional. |
| + if os.path.exists(src_stateful): |
|
sosa
2010/11/23 00:49:42
I'm not really sure this should be optional. Mayb
dgarrett
2010/11/23 01:30:27
It's normal for it to be missing for some workflow
sosa
2010/11/23 01:51:11
It should always be there for an image that is a D
dgarrett
2010/11/23 02:16:40
Done.
|
| + self._Copy(src_stateful, dest_stateful) |
| + else: |
| + # If the source doesn't exist, don't leave an outdated stateful |
| + # file around. |
| + if os.path.exists(dest_stateful): |
| + os.remove(dest_stateful) |
| return UPDATE_FILE |
| elif self.forced_image: |