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

Unified Diff: autoupdate.py

Issue 5297002: --archive_dir will now serve existing update.gz (Closed) Base URL: http://git.chromium.org/git/dev-util.git@master
Patch Set: Removed image.zip support. Serve only now means just that. 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 84dc69074ac3288561b62baf5682b35de8ac99ee..3a6c4861be320269a78b8bdbfef3ef3cd57859df 100644
--- a/autoupdate.py
+++ b/autoupdate.py
@@ -22,8 +22,8 @@ class Autoupdate(BuildObject):
"""Class that contains functionality that handles Chrome OS update pings.
Members:
- serve_only: Serve images from a pre-built image.zip file. static_dir
- must be set to the location of the image.zip.
+ serve_only: Serve only pre-built updates. static_dir must contain update.gz
+ and stateful.tgz.
factory_config: Path to the factory config file if handling factory
requests.
use_test_image: Use chromiumos_test_image.bin rather than the standard.
@@ -398,34 +398,6 @@ class Autoupdate(BuildObject):
return self.GenerateUpdateImageWithCache(latest_image_path,
static_image_dir=static_image_dir)
- def GenerateImageFromZip(self, static_image_dir):
- """Generates an update from an image zip file.
-
- This method assumes you have an image.zip in directory you are serving
- from. If this file is newer than a previously cached file, it will unzip
- this file, create a payload and serve it.
-
- Args:
- static_image_dir: Directory where the zip file exists.
- Returns:
- Name of the update payload relative to static_image_dir if successful.
- """
- _LogMessage('Preparing to generate update from zip in %s.' %
- static_image_dir)
- image_path = os.path.join(static_image_dir, self._GetImageName())
- zip_file_path = os.path.join(static_image_dir, 'image.zip')
-
- # TODO(dgarrett): Either work caching into this path before
- # we unpack, or remove zip support (sosa is considering).
- # It does currently cache, but after the unpack.
-
- if not self._UnpackZip(static_image_dir):
- _LogMessage('unzip image.zip failed.')
- return None
-
- return self.GenerateUpdateImageWithCache(image_path,
- static_image_dir=static_image_dir)
-
def ImportFactoryConfigFile(self, filename, validate_checksums=False):
"""Imports a factory-floor server configuration file. The file should
be in this format:
@@ -526,16 +498,16 @@ class Autoupdate(BuildObject):
Returns:
file name relative to static_image_dir on success.
"""
+ dest_path = os.path.join(static_image_dir, UPDATE_FILE)
+ dest_stateful = os.path.join(static_image_dir, STATEFUL_FILE)
+
if self.forced_payload:
# If the forced payload is not already in our static_image_dir,
# copy it there.
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):
@@ -556,7 +528,16 @@ class Autoupdate(BuildObject):
self.forced_image,
static_image_dir=static_image_dir)
elif self.serve_only:
- return self.GenerateImageFromZip(static_image_dir)
+ # Warn if update or stateful files can't be found.
+ if not os.path.exists(dest_path):
+ _LogMessage('WARN: %s not found. Expected for dev and test builds.' %
+ UPDATE_FILE)
+
+ if not os.path.exists(dest_stateful):
+ _LogMessage('WARN: %s not found. Expected for dev and test builds.' %
+ STATEFUL_FILE)
+
+ return UPDATE_FILE
else:
if board_id:
return self.GenerateLatestUpdateImage(board_id,
« 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