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

Side by Side 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: Nit Fix 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from buildutil import BuildObject 5 from buildutil import BuildObject
6 from xml.dom import minidom 6 from xml.dom import minidom
7 7
8 import cherrypy 8 import cherrypy
9 import os 9 import os
10 import shutil 10 import shutil
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 def GenerateUpdatePayloadForNonFactory(self, board_id, client_version, 522 def GenerateUpdatePayloadForNonFactory(self, board_id, client_version,
523 static_image_dir): 523 static_image_dir):
524 """Generates an update for non-factory image. 524 """Generates an update for non-factory image.
525 525
526 Returns: 526 Returns:
527 file name relative to static_image_dir on success. 527 file name relative to static_image_dir on success.
528 """ 528 """
529 if self.forced_payload: 529 if self.forced_payload:
530 # If the forced payload is not already in our static_image_dir, 530 # If the forced payload is not already in our static_image_dir,
531 # copy it there. 531 # copy it there.
532 if (os.path.dirname(os.path.abspath(self.forced_payload)) != 532 src_path = os.path.abspath(self.forced_payload)
533 os.path.abspath(static_image_dir)): 533 dest_path = os.path.join(static_image_dir, UPDATE_FILE)
534 self._Copy(self.forced_payload, os.path.join(static_image_dir,
535 UPDATE_FILE))
536 534
537 self._Copy(os.path.join(os.path.dirname(self.forced_payload), 535 src_stateful = os.path.join(os.path.dirname(src_path),
538 STATEFUL_FILE), 536 STATEFUL_FILE)
539 os.path.join(static_image_dir, 537 dest_stateful = os.path.join(static_image_dir,
540 STATEFUL_FILE)) 538 STATEFUL_FILE)
539
540 # If the files are already in the destination dir, don't copy them.
541 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.
542 self._Copy(src_path, dest_path)
543
544 # The stateful payload is optional.
545 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.
546 self._Copy(src_stateful, dest_stateful)
547 else:
548 # If the source doesn't exist, don't leave an outdated stateful
549 # file around.
550 if os.path.exists(dest_stateful):
551 os.remove(dest_stateful)
541 552
542 return UPDATE_FILE 553 return UPDATE_FILE
543 elif self.forced_image: 554 elif self.forced_image:
544 return self.GenerateUpdateImageWithCache( 555 return self.GenerateUpdateImageWithCache(
545 self.forced_image, 556 self.forced_image,
546 static_image_dir=static_image_dir) 557 static_image_dir=static_image_dir)
547 elif self.serve_only: 558 elif self.serve_only:
548 return self.GenerateImageFromZip(static_image_dir) 559 return self.GenerateImageFromZip(static_image_dir)
549 else: 560 else:
550 if board_id: 561 if board_id:
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 is_delta_format = self._IsDeltaFormatFile(filename) 648 is_delta_format = self._IsDeltaFormatFile(filename)
638 if label: 649 if label:
639 url = '%s/%s/%s' % (static_urlbase, label, payload_path) 650 url = '%s/%s/%s' % (static_urlbase, label, payload_path)
640 else: 651 else:
641 url = '%s/%s' % (static_urlbase, payload_path) 652 url = '%s/%s' % (static_urlbase, payload_path)
642 653
643 _LogMessage('Responding to client to use url %s to get image.' % url) 654 _LogMessage('Responding to client to use url %s to get image.' % url)
644 return self.GetUpdatePayload(hash, sha256, size, url, is_delta_format) 655 return self.GetUpdatePayload(hash, sha256, size, url, is_delta_format)
645 else: 656 else:
646 return self.GetNoUpdatePayload() 657 return self.GetNoUpdatePayload()
OLDNEW
« 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