def upgrade(self): """ Prepare precondition of upgrade """ # Remove last_bosp and bosp Utils.run(["rm", "-rf", OPTIONS.olderRoot], stdout=subprocess.PIPE).communicate() Utils.run(["rm", "-rf", OPTIONS.newerRoot], stdout=subprocess.PIPE).communicate() lastBoardZip = os.path.join(Config.PRJ_ROOT, "board/last_board.zip") boardZip = os.path.join(Config.PRJ_ROOT, "board/board.zip") if os.path.exists(lastBoardZip) and os.path.exists(boardZip): # Phase 1: prepare LAST_BOSP from last_board.zip Utils.decode(lastBoardZip, OPTIONS.olderRoot) # Phase 2: prepare BOSP from board.zip Utils.decode(boardZip, OPTIONS.newerRoot) # Phase 3: prepare patch XML ChangeList(OPTIONS.olderRoot, OPTIONS.newerRoot, OPTIONS.patchXml).make(force=True) else: if OPTIONS.commit1 is not None: self.baseDevice.setLastHead(OPTIONS.commit1) # Phase 1: get last and origin head from base device (lastHead, origHead) = self.baseDevice.getLastAndOrigHead() if lastHead == origHead: Log.w( TAG, Paint.red( "Nothing to upgrade. Did you forget to sync the %s ?" % OPTIONS.baseName)) Log.w( TAG, Paint.red( "In the root directory, try the following command to sync:" )) Log.w(TAG, Paint.red(" $ repo sync devices/%s" % OPTIONS.baseName)) # Phase 2: porting from last to origin head OPTIONS.commit1 = lastHead[0:7] OPTIONS.commit2 = origHead[0:7] self.porting()
def w(s): Log.w(SLog.TAG, s)