def fetch(pythonCallInfo): outfd = logger.getOutFd(pythonCallInfo.target.name, "fetch") if git.isGitRepo(pythonCallInfo.target.path): if not git.gitCheckout(pythonCallInfo.target.path, pythonCallInfo.target.outputPath): pythonCallInfo.logger.writeError("Given Git repo '" + pythonCallInfo.target.path +"' was unable to be checked out") pythonCallInfo.success = False else: pythonCallInfo.target.path = pythonCallInfo.target.outputPath pythonCallInfo.success = True elif hg.isHgRepo(pythonCallInfo.target.path): if not hg.hgCheckout(pythonCallInfo.target.path, pythonCallInfo.target.outputPath): pythonCallInfo.logger.writeError("Given Hg repo '" + pythonCallInfo.target.path +"' was unable to be checked out") pythonCallInfo.success = False else: pythonCallInfo.target.path = pythonCallInfo.target.outputPath pythonCallInfo.success = True elif svn.isSvnRepo(pythonCallInfo.target.path): if not svn.svnCheckout(pythonCallInfo.target.path, pythonCallInfo.target.outputPath, outfd): pythonCallInfo.logger.writeError("Given Svn repo '" + pythonCallInfo.target.path +"' was unable to be checked out") pythonCallInfo.success = False else: pythonCallInfo.target.path = pythonCallInfo.target.outputPath pythonCallInfo.success = True elif utilityFunctions.isURL(pythonCallInfo.target.path): filenamePath = os.path.join(pythonCallInfo.options.downloadDir, utilityFunctions.URLToFilename(pythonCallInfo.target.path)) if not os.path.exists(pythonCallInfo.options.downloadDir): os.mkdir(pythonCallInfo.options.downloadDir) urllib.urlretrieve(pythonCallInfo.target.path, filenamePath) pythonCallInfo.target.path = filenamePath pythonCallInfo.success = True elif os.path.isdir(pythonCallInfo.target.path): if pythonCallInfo.target.outputPathSpecified and \ os.path.abspath(pythonCallInfo.target.path) != os.path.abspath(pythonCallInfo.target.outputPath): distutils.dir_util.copy_tree(pythonCallInfo.target.path, pythonCallInfo.target.outputPath) pythonCallInfo.target.path = pythonCallInfo.target.outputPath pythonCallInfo.success = True elif os.path.isfile(pythonCallInfo.target.path): pythonCallInfo.success = True return pythonCallInfo
def buildStepActor(target, options, project, lock=None): if target.isStepToBeSkipped(target.currBuildStep.name): try: if lock: lock.acquire() logger.reportSkipped(target.name, target.currBuildStep.name, "Target specified to skip step") finally: if lock: lock.release() return True if target.isStepPreviouslyDone(target.currBuildStep.name): try: if lock: lock.acquire() logger.reportSkipped( target.name, target.currBuildStep.name, "Build step successfully built in previous MixDown build" ) finally: if lock: lock.release() return True try: if lock: lock.acquire() logger.reportStart(target.name, target.currBuildStep.name) # Refresh defines before start of every step project.setTargetFieldsAsDefines(options.defines) finally: if lock: lock.release() returnCode = None timeStart = time.time() command = options.defines.expand(target.currBuildStep.command) isPythonCommand, namespace, function = python.parsePythonCommand(command) if isPythonCommand: success = python.callPythonCommand(namespace, function, target, options, project) if not success: returnCode = 1 else: returnCode = 0 else: try: if lock: lock.acquire() logger.writeMessage("Executing command: " + command, target.name, target.currBuildStep.name, True) finally: if lock: lock.release() if not os.path.exists(target.path): logger.writeError( target.name + "'s path does not exist when about to execute build command in step " + target.currBuildStep.name + ".", filePath=target.path, ) returnCode = 1 else: outFd = logger.getOutFd(target.name, target.currBuildStep.name) returnCode = utilityFunctions.executeSubProcess(command, target.path, outFd) timeFinished = time.time() timeElapsed = timeFinished - timeStart if returnCode != 0: target.currBuildStep.success = False try: if lock: lock.acquire() logger.reportFailure(target.name, target.currBuildStep.name, timeElapsed, returnCode) finally: if lock: lock.release() return False target.currBuildStep.success = True try: if lock: lock.acquire() logger.reportSuccess(target.name, target.currBuildStep.name, timeElapsed) finally: if lock: lock.release() return True
def buildStepActor(target, options, project, lock=None): if target.isStepToBeSkipped(target.currBuildStep.name): try: if lock: lock.acquire() logger.reportSkipped(target.name, target.currBuildStep.name, "Target specified to skip step") finally: if lock: lock.release() return True if target.isStepPreviouslyDone(target.currBuildStep.name): try: if lock: lock.acquire() logger.reportSkipped( target.name, target.currBuildStep.name, "Build step successfully built in previous MixDown build") finally: if lock: lock.release() return True try: if lock: lock.acquire() logger.reportStart(target.name, target.currBuildStep.name) #Refresh defines before start of every step project.setTargetFieldsAsDefines(options.defines) finally: if lock: lock.release() returnCode = None timeStart = time.time() command = options.defines.expand(target.currBuildStep.command) isPythonCommand, namespace, function = python.parsePythonCommand(command) if isPythonCommand: success = python.callPythonCommand(namespace, function, target, options, project) if not success: returnCode = 1 else: returnCode = 0 else: try: if lock: lock.acquire() logger.writeMessage("Executing command: " + command, target.name, target.currBuildStep.name, True) finally: if lock: lock.release() if not os.path.exists(target.path): logger.writeError( target.name + "'s path does not exist when about to execute build command in step " + target.currBuildStep.name + ".", filePath=target.path) returnCode = 1 else: outFd = logger.getOutFd(target.name, target.currBuildStep.name) returnCode = utilityFunctions.executeSubProcess( command, target.path, outFd) timeFinished = time.time() timeElapsed = timeFinished - timeStart if returnCode != 0: target.currBuildStep.success = False try: if lock: lock.acquire() logger.reportFailure(target.name, target.currBuildStep.name, timeElapsed, returnCode) finally: if lock: lock.release() return False target.currBuildStep.success = True try: if lock: lock.acquire() logger.reportSuccess(target.name, target.currBuildStep.name, timeElapsed) finally: if lock: lock.release() return True