def showUserInputHint(self): """ Show user input hint """ for i in range(0, len(self.commitIDs)): commitID = self.commitIDs[i] comment = self.comments[i] print " %s %s" % (Paint.bold(commitID), comment) deviceName = self.baseDevice.name() oneCommit = Paint.bold(self.commitIDs[0]) twoCommits = "%s %s" % (Paint.bold( self.commitIDs[-1]), Paint.bold(self.commitIDs[0])) print " ________________________________________________________________________________________" print " " print " Each 7 bits SHA1 code identify a commit on %s," % Paint.blue( deviceName), print " You could input: " print " - Only one single commit, like: %s" % oneCommit print " will porting changes between the selected and the latest from %s to your device" % Paint.blue( deviceName) print " - Two commits as a range, like: %s" % twoCommits print " will porting changes between the two selected from %s to your device" % Paint.blue( deviceName) print " ________________________________________________________________________________________" print " "
def usage(): help_model = __create() print " " print Paint.bold(help_model.get("help_usage").detail.strip()) print " " print help_model.get("help_license").detail.strip() print " " print help_model.get("help_cmds").detail.strip() # help print Paint.bold("* flyme help [ACTION]") print " " print " ", help_model.get("help").detail.strip() print " " # action print Paint.bold("* flyme [ACTION]") print " " actions = ("config", "newproject", "patchall", "fullota", "upgrade", "porting", "clean", "cleanall") for action in actions: print Paint.bold(action).rjust(20), "\t", help_model.get( action).detail.strip() print " " # fire #print Paint.bold("* flyme fire") #print " ", help_model.get("fire").detail.strip() print ""
def show(item, attrib=None): """ Show the help item. """ if item == None: return if attrib == "solution": if item.solution != None: print item.solution.replace("\t", "") elif attrib == "detail": if item.detail != None: print item.detail.replace("\t", "") else: print Paint.bold("%s\t%s\n" % (item.code, item.name)) Help.showDetail(item) print " "
def handleLightFix(self): target = os.path.relpath(self.rejSmali.getPath(), utils.REJECT) print " " print " %s %s" % (Paint.bold("FIX CONFLICTS IN"), target) for mEntry in self.mBSLib.getEntryList(self.getRejectEntryList()): (canReplaceEntry, canNotReplaceEntry) = self.mTSLib.getCanReplaceEntry( self.mBSLib, self.rejSmali.getClassName(), [mEntry], False) if utils.has(canReplaceEntry, mEntry): print " %s %s" % (Paint.green("[PASS]"), mEntry.getName()) utils.SLog.ok("\n>>>> Fix reject %s %s in %s: " % (mEntry.getType(), mEntry.getName(), self.rejSmali.getPath())) self.replaceEntryToBosp(mEntry) for entry in canReplaceEntry: if entry != mEntry: self.replaceEntryToBosp(entry) if len(canNotReplaceEntry) > 0: self.mCanNotReplaceEntry.extend(canNotReplaceEntry) if utils.has(canNotReplaceEntry, mEntry): print " %s %s" % (Paint.red("[FAIL]"), mEntry.getName()) utils.SLog.fail(" %s" % target) #utils.SLog.fail(" CONFLICTS: %s %s in %s" % (mEntry.getType(), mEntry.getName(), self.getRealTargetPath(self.mTSLib.getSmali(mEntry.getClassName())))) #utils.SLog.fail(" Can not be replaced by bosp, because of the follows:") for entry in canNotReplaceEntry: #utils.SLog.fail(" %s %s in %s" % (entry.getType(), entry.getName(), self.getRealTargetPath(self.mTSLib.getSmali(entry.getClassName())))) pass
def showall(): helpEntry = HelpFactory.createHelp() for code in sorted(helpEntry.CODE_TO_NAME.keys()): if code == 255: continue item = helpEntry.get(code) if item.detail != None: print "%s(%d)\n%s" % (Paint.bold(item.name), item.code, item.detail.replace("\t", "").strip()) print " "
def autocom(vendorDir, aospDir, bospDir, mergedDir, outdir, comModuleList): sReplace = Replace.Replace(vendorDir, aospDir, bospDir, mergedDir) for module in comModuleList: print Paint.bold(" Complete missed method in %s") % module needComleteDir = '%s/%s' % (mergedDir, module) sDict = utils.getSmaliDict(needComleteDir) for clsName in sDict.keys(): mSmali = sReplace.mMSLib.getSmali(clsName) if mSmali is None: utils.SLog.d("can not get class: %s" % clsName) continue (canReplaceEntryList, canNotReplaceEntryList) = sReplace.preReplaceCheck(mSmali) for entry in canReplaceEntryList: sReplace.replaceEntryInFile(entry, SAutoCom.getAutocomPartPath(sReplace, entry, outdir)) for entry in canNotReplaceEntryList: sReplace.appendBlankEntry(entry, SAutoCom.getAutocomPartPath(sReplace, entry, outdir))
def showStatistic(): for key in Error.FILENOTFOUND_STATISTIC.keys(): print "%3d files not found in %s" % ( Error.FILENOTFOUND_STATISTIC[key], key) if Error.TOTAL_FILENOTFOUND > 0: print Paint.bold( "%3d files not found totally, they might be removed or moved to other place by vendor?" % Error.TOTAL_FILENOTFOUND) print " " for key in Error.CONFLICT_STATISTIC.keys(): print "%3d conflicts in %s " % (Error.CONFLICT_STATISTIC[key], key) if Error.TOTAL_CONFLICTS > 0: print Paint.bold( "%3d conflicts in %d files, go through the reject files in 'autopatch/reject' to find them out" % (Error.TOTAL_CONFLICTS, Error.CONFLICT_FILE_NUM)) print Paint.red( "\n Ask for advice? Please type 'coron help CONFLICTS_HAPPENED' \n" )
def readUserInput(self): """ Read user input """ self.showUserInputHint() userInput = raw_input( Paint.bold(">>> Input the 7 bits SHA1 commit ID (q to exit): ")) if userInput in ("q", "Q"): sys.exit() commits = userInput.split() size = len(commits) commit1 = commit2 = None if size > 0: commit1 = commits[0] if size > 1: commit2 = commits[1] return (commit1, commit2)
def show(key, category=None): """ Show the help item :param key: name or code of the help item :param category: help category, like config, newproject """ item = __get_item(key, category) if item is None: return if item.detail is not None: print "%s: %s" % (Paint.bold(item.name), item.detail.replace("\t", "").strip()) if item.solution is not None: print Paint.green(item.solution.replace("\t", "").lstrip()) print ""
def usage(): help_model = __create() print Paint.bold("An open source project for Android ROM porting.") print "Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) " print " " print "COMMANDs are: " # help print Paint.bold("* flyme help [NAME]") print " ", help_model.get("help").detail.strip() print " " # action print Paint.bold("* flyme ACTION") print " Run the action separately." print " " print Paint.bold("ACTION").rjust(20), "\t", Paint.bold("Description") actions = ("config", "newproject", "patchall", "fullota", "upgrade", "porting", "clean", "cleanall") for action in actions: print Paint.bold(action).rjust(20), "\t", help_model.get( action).detail.strip() print " " # fire print Paint.bold("* flyme fire") print " ", help_model.get("fire").detail.strip() print ""
def coronUsage(): helpEntry = HelpFactory.createHelp() print Paint.bold("Coron - an open source project for Android ROM porting.") print "Copyright 2014 Baidu Cloud OS <rom.baidu.com> " print "Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) " print " " print "COMMANDs are: " # Coron help print Paint.bold("* coron help [NAME]") print " ", helpEntry.get("help").detail.strip() print " " # Coron action print Paint.bold("* coron ACTION") print " Run the action separately." print " " print Paint.bold("ACTION").rjust(20), "\t", Paint.bold("Description") ACTIONS = ("config", "newproject", "patchall", "autofix", "fullota", "upgrade", "clean", "cleanall") for action in ACTIONS: item = helpEntry.get(action) print Paint.bold(action).rjust(20), "\t", item.detail.strip() print " " # Coron fire print Paint.bold("* coron fire") print " ", helpEntry.get("fire").detail.strip() print " "