def __printTGlobalCompare__(self, testClient, installname, outputDir): connection = testClient.getConnection() connection.expect("Select Installation") connection.send("Compare Transport Global\r") connection.expect("Select INSTALL NAME") connection.send(installname + "\r") connection.expect("Type of Compare") connection.send("1\r") connection.expect("DEVICE") connection.send("HFS\r") connection.expect("HOST FILE NAME") logfile = os.path.join( outputDir, installNameToDirName(installname) + "Compare.log") if testClient.isCache(): logfile = os.path.normpath(logfile) connection.send(logfile + "\r") connection.expect("PARAMETERS") if testClient.isCache(): connection.send("\r") else: connection.send("NEWVERSION:NOREADONLY:VARIABLE\r") index = connection.expect(["Select Installation", "overwrite it"], 600) if index == 0: connection.send("?\r") else: connection.send('\r')
def __printTGlobalCompare__(self,testClient,installname,outputDir): connection = testClient.getConnection() connection.expect("Select Installation") connection.send("Compare Transport Global\r") connection.expect("Select INSTALL NAME") connection.send(installname +"\r") connection.expect("Type of Compare") connection.send("1\r") connection.expect("DEVICE") connection.send("HFS\r") connection.expect("HOST FILE NAME") logfile=os.path.join(outputDir,installNameToDirName(installname)+"Compare.log") if testClient.isCache(): logfile=os.path.normpath(logfile) connection.send(logfile+"\r") connection.expect("PARAMETERS") if testClient.isCache(): connection.send("\r") else: connection.send("NEWVERSION:NOREADONLY:VARIABLE\r") index = connection.expect(["Select Installation","overwrite it"],600) if index == 0: connection.send("?\r") else: connection.send('\r')
def __printTGlobalChecksums__(self, testClient, installname, outputDir): connection = testClient.getConnection() connection.expect("Select Installation") connection.send("Verify Checksums\r") connection.expect("Select INSTALL NAME") connection.send(installname + "\r") connection.expect("Want each Routine Listed with Checksums") connection.send("YES\r") connection.expect("DEVICE") connection.send("HFS\r") connection.expect("HOST FILE NAME") logfile = os.path.join( outputDir, installNameToDirName(installname) + "Checksums.log") if testClient.isCache(): logfile = os.path.normpath(logfile) connection.send(logfile + "\r") connection.expect("PARAMETERS") if testClient.isCache(): connection.send("\r") else: connection.send("NEWVERSION:NOREADONLY:VARIABLE\r") index = connection.expect(["Select Installation", "overwrite it"], 600) if index == 0: connection.send("?\r") else: connection.send('\r')
def __onNewRoutineStart__(self, section, lines, result, kidsBuild): routineName = result.group('Name') assert (self._curRoutine == None or self._curRoutine.name != routineName) if self._curRoutine: self.__onCurrentRoutineEnd__(kidsBuild) self._curRoutine = Routine() self._curRoutine.name = routineName # format is flag^install order^AfterCheckSum^BeforeCheckSum propInfo = lines[1].split('^') assert len(propInfo) > 1 flag = int(propInfo[0]) self._curRoutine.flag = flag if flag == Routine.DELETE: # need to be deleted self._curRoutine.expectCheckSum = 0 return patchDir = installNameToDirName(kidsBuild.installName) if self._outDir: destDir = os.path.join(self._outDir, patchDir) if not os.path.exists(destDir): os.mkdir(destDir) routineDest = os.path.join(destDir, "%s.m" % routineName) self._fileHandler = open(routineDest, 'w') # open for write if len(propInfo) > 2: try: self._curRoutine.expectCheckSum = int(propInfo[2][1:]) except ValueError as err: logger.error(err) logger.error("Invalid Routine Line %s, %s" % (lines[0], lines[1])) self._curRoutine.expectCheckSum = 0 else: logger.error("Invalid Routine Line %s, %s" % (lines[0], lines[1])) self._curRoutine.expectCheckSum = 0
def __printTGlobalChecksums__(self,testClient,installname,outputDir): connection = testClient.getConnection() connection.expect("Select Installation") connection.send("Verify Checksums\r") connection.expect("Select INSTALL NAME") connection.send(installname +"\r") connection.expect("Want each Routine Listed with Checksums") connection.send("YES\r") connection.expect("DEVICE") connection.send("HFS\r") connection.expect("HOST FILE NAME") logfile=os.path.join(outputDir,installNameToDirName(installname)+"Checksums.log") if testClient.isCache(): logfile=os.path.normpath(logfile) connection.send(logfile+"\r") connection.expect("PARAMETERS") if testClient.isCache(): connection.send("\r") else: connection.send("NEWVERSION:NOREADONLY:VARIABLE\r") index = connection.expect(["Select Installation","overwrite it"],600) if index == 0: connection.send("?\r") else: connection.send('\r')
def XINDEXParser(outputDir,installname): NEKsearchstring = "^>>" Routinenamestring= "INDEX OF [A-Z0-9]" sourcefile= os.path.join(outputDir,installNameToDirName(installname)) try: NEKoutputDir= os.path.join(outputDir,"NotExplicitlyKilled") os.mkdir(NEKoutputDir) except: pass outputfile= os.path.join(NEKoutputDir,installNameToDirName(installname)) xindexoutput = open(sourcefile + ".log",'r') notexplicitlykilled = open(outputfile + "NEK.log",'w') for line in xindexoutput: if re.search(Routinenamestring,line) or re.search(NEKsearchstring,line): notexplicitlykilled.write(line + "\r") elif re.search("CROSS-REFERENCING ALL ROUTINES",line): break
def PrintChecksumsbyBuildname(testClient, name, outputDir): resultsfolder = os.path.join(outputDir, "ChecksumResults") try: os.mkdir(resultsfolder) except: pass logpath = os.path.join(resultsfolder, installNameToDirName(name)) testClient.setLogFile(logpath + "PostChecksums.log") connection = testClient.getConnection() connection.send("D CHECK1^XTSUMBLD\r") connection.expect("Build from") connection.send("Build\r") connection.expect("Select BUILD NAME") connection.send(name + "\r") testClient.waitForPrompt() connection.send("\r")
def PrintChecksumsbyBuildname(testClient,name,outputDir): resultsfolder= os.path.join(outputDir,"ChecksumResults") try: os.mkdir(resultsfolder) except: pass logpath = os.path.join(resultsfolder,installNameToDirName(name)) testClient.setLogFile(logpath+"PostChecksums.log") connection = testClient.getConnection() connection.send("D CHECK1^XTSUMBLD\r") connection.expect("Build from") connection.send("Build\r") connection.expect("Select BUILD NAME") connection.send(name + "\r") testClient.waitForPrompt() connection.send("\r")
def XINDEXbyBuildname(testclient, installname, outputDir): resultsfolder = os.path.join(outputDir, "XINDEXResults") try: os.mkdir(resultsfolder) except: pass logpath = os.path.join(resultsfolder, installNameToDirName(installname)) testclient.setLogFile(logpath + ".log") connection = testclient.getConnection() connection.send("D ^XINDEX\r") if testclient.isCache(): connection.expect("All Routines") connection.send("N\r") connection.expect("Routine") connection.send("\r") connection.expect("BUILD NAME") connection.send(installname + "\r") connection.expect("Include the compiled template routines") connection.send("N\r") connection.expect("Print more than compiled errors and warnings") connection.send("\r") connection.expect("Print summary only") connection.send("\r") connection.expect("Print routines") connection.send("No\r") connection.expect("Print the DDs, Functions, and Options") connection.send("\r") connection.expect("Print errors and warnings with each routine") connection.send("\r") connection.expect("Save parameters in ROUTINE file") connection.send("\r") connection.expect("Index all called routines") connection.send("N\r") connection.expect("DEVICE") connection.send(';;9999\r') if testclient.isCache(): connection.expect('Right Margin:') connection.send('\r') connection.send('\r') connection.expect('continue:') connection.send('\r') connection.expect('--- END ---', 120) XINDEXParser(resultsfolder, installname)
def XINDEXbyBuildname(testclient,installname,outputDir): resultsfolder= os.path.join(outputDir,"XINDEXResults") try: os.mkdir(resultsfolder) except: pass logpath = os.path.join(resultsfolder,installNameToDirName(installname)) testclient.setLogFile(logpath+".log") connection = testclient.getConnection() connection.send("D ^XINDEX\r") if testclient.isCache(): connection.expect("All Routines") connection.send("N\r") connection.expect("Routine") connection.send("\r") connection.expect("BUILD NAME") connection.send(installname+"\r") connection.expect("Include the compiled template routines") connection.send("N\r") connection.expect("Print more than compiled errors and warnings") connection.send("\r") connection.expect("Print summary only") connection.send("\r") connection.expect("Print routines") connection.send("No\r") connection.expect("Print the DDs, Functions, and Options") connection.send("\r") connection.expect("Print errors and warnings with each routine") connection.send("\r") connection.expect("Save parameters in ROUTINE file") connection.send("\r") connection.expect("Index all called routines") connection.send("N\r") connection.expect("DEVICE") connection.send(';;9999\r') if testclient.isCache(): connection.expect('Right Margin:') connection.send('\r') connection.send('\r') connection.expect('continue:') connection.send('\r') connection.expect('--- END ---',120) XINDEXParser(resultsfolder,installname)
def populate(input): packages, namespaces = populatePackageMapByCSV(input) #--------------------------------------------------------------------------- # Collect all KIDS and info files under the current directory recursively #--------------------------------------------------------------------------- curDir = os.getcwd() patchOrderGen = PatchOrderGenerator() patchOrder = patchOrderGen.generatePatchOrder(curDir) patchInfoDict = patchOrderGen.getPatchInfoDict() patchInfoSet = set(patchInfoDict.keys()) patchList = patchInfoDict.values() noKidsInfoDict = patchOrderGen.getNoKidsBuildInfoDict() noKidsInfoSet = set(noKidsInfoDict.keys()) noKidsPatchList = noKidsInfoDict.values() leftoverTxtFiles = patchOrderGen.getInvalidInfoFiles() #--------------------------------------------------------------------------- # place multiBuilds KIDS Build under MultiBuilds directory #--------------------------------------------------------------------------- multiBuildSet = set([x.installName for x in patchList if x.isMultiBuilds]) for info in multiBuildSet: logger.info("Handling Multibuilds Kids %s" % info) patchInfo = patchInfoDict[info] src = patchInfo.kidsFilePath dest = os.path.normpath(os.path.join(curDir, "MultiBuilds", os.path.basename(src))) if src != dest: place(src,dest) if isValidKIDSBuildHeaderSuffix(dest): " add to ignore list if not there" addToGitIgnoreList(dest[0:dest.rfind('.')]) src = patchInfo.kidsSha1Path if not src: continue dest = os.path.normpath(os.path.join(curDir, "MultiBuilds", os.path.basename(src))) if src != dest: place(src,dest) # Map by package namespace (prefix). for ns in sorted(namespaces.keys(),order_long_to_short): path = namespaces[ns] nsPatchList = [x.installName for x in patchList if x.namespace==ns] for patch in nsPatchList: logger.info("Handling Kids %s" % patch) patchInfo = patchInfoDict[patch] patchDir = os.path.join(path, "Patches", installNameToDirName(patch)) placePatchInfo(patchInfo, curDir, patchDir) # Map KIDS Info Files that do not have associated KIDS Build Files nsNoKidsList = [x.installName for x in noKidsPatchList if x.namespace==ns] for patch in nsNoKidsList: logger.info("Handling No Kids info File %s" % patch) patchInfo = noKidsInfoDict[patch] patchDir = os.path.join(path, "Patches", installNameToDirName(patch)) placePatchInfo(patchInfo, curDir, patchDir) patchInfoSet.difference_update(nsPatchList) noKidsInfoSet.difference_update(nsNoKidsList) # Put leftover kids files in Uncategorized package. for patch in patchInfoSet: logger.info("Handling left over Kids File %s" % patch) patchInfo = patchInfoDict[patch] placePatchInfo(patchInfo, curDir, 'Uncategorized') for patch in noKidsInfoSet: logger.info("Handling left over no Kids Info File %s" % patch) patchInfo = noKidsInfoDict[patch] placePatchInfo(patchInfo, curDir, 'Uncategorized') # Put invalid kids info files in Uncategorized package. for src in leftoverTxtFiles: logger.info("Handling left over files: %s" % src) from KIDSAssociatedFilesMapping import getAssociatedInstallName installName = getAssociatedInstallName(src) if installName == "MultiBuilds": # put in Multibuilds directory dest = os.path.normpath(os.path.join(curDir, "MultiBuilds", os.path.basename(src))) if src != dest: place(src,dest) continue dirName = os.path.dirname(src) if not dirName.endswith("Packages"): logger.debug("Do not move %s" % src) continue dest = os.path.normpath(os.path.join(curDir, 'Uncategorized', os.path.basename(src))) if src != dest: place(src,dest)
def populate(input): packages, namespaces = populatePackageMapByCSV(input) #--------------------------------------------------------------------------- # Collect all KIDS and info files under the current directory recursively #--------------------------------------------------------------------------- curDir = os.getcwd() patchOrderGen = PatchOrderGenerator() patchOrder = patchOrderGen.generatePatchOrder(curDir) patchInfoDict = patchOrderGen.getPatchInfoDict() patchInfoSet = set(patchInfoDict.keys()) patchList = patchInfoDict.values() noKidsInfoDict = patchOrderGen.getNoKidsBuildInfoDict() noKidsInfoSet = set(noKidsInfoDict.keys()) noKidsPatchList = noKidsInfoDict.values() leftoverTxtFiles = patchOrderGen.getInvalidInfoFiles() #--------------------------------------------------------------------------- # place multiBuilds KIDS Build under MultiBuilds directory #--------------------------------------------------------------------------- multiBuildSet = set([x.installName for x in patchList if x.isMultiBuilds]) for info in multiBuildSet: logger.info("Handling Multibuilds Kids %s" % info) patchInfo = patchInfoDict[info] src = patchInfo.kidsFilePath dest = os.path.normpath( os.path.join(curDir, "MultiBuilds", os.path.basename(src))) if src != dest: place(src, dest) if isValidKIDSBuildHeaderSuffix(dest): " add to ignore list if not there" addToGitIgnoreList(dest[0:dest.rfind('.')]) src = patchInfo.kidsSha1Path if not src: continue dest = os.path.normpath( os.path.join(curDir, "MultiBuilds", os.path.basename(src))) if src != dest: place(src, dest) # Map by package namespace (prefix). for ns in sorted(namespaces.keys(), order_long_to_short): path = namespaces[ns] nsPatchList = [x.installName for x in patchList if x.namespace == ns] for patch in nsPatchList: logger.info("Handling Kids %s" % patch) patchInfo = patchInfoDict[patch] patchDir = os.path.join(path, "Patches", installNameToDirName(patch)) placePatchInfo(patchInfo, curDir, patchDir) # Map KIDS Info Files that do not have associated KIDS Build Files nsNoKidsList = [ x.installName for x in noKidsPatchList if x.namespace == ns ] for patch in nsNoKidsList: logger.info("Handling No Kids info File %s" % patch) patchInfo = noKidsInfoDict[patch] patchDir = os.path.join(path, "Patches", installNameToDirName(patch)) placePatchInfo(patchInfo, curDir, patchDir) patchInfoSet.difference_update(nsPatchList) noKidsInfoSet.difference_update(nsNoKidsList) # Put leftover kids files in Uncategorized package. for patch in patchInfoSet: logger.info("Handling left over Kids File %s" % patch) patchInfo = patchInfoDict[patch] placePatchInfo(patchInfo, curDir, 'Uncategorized') for patch in noKidsInfoSet: logger.info("Handling left over no Kids Info File %s" % patch) patchInfo = noKidsInfoDict[patch] placePatchInfo(patchInfo, curDir, 'Uncategorized') # Put invalid kids info files in Uncategorized package. for src in leftoverTxtFiles: logger.info("Handling left over files: %s" % src) from KIDSAssociatedFilesMapping import getAssociatedInstallName installName = getAssociatedInstallName(src) if installName == "MultiBuilds": # put in Multibuilds directory dest = os.path.normpath( os.path.join(curDir, "MultiBuilds", os.path.basename(src))) if src != dest: place(src, dest) continue dirName = os.path.dirname(src) if not dirName.endswith("Packages"): logger.debug("Do not move %s" % src) continue dest = os.path.normpath( os.path.join(curDir, 'Uncategorized', os.path.basename(src))) if src != dest: place(src, dest)
def getDefaultCommitMsgFileByPatchInfo(patchInfo, dir=None): outputFile = installNameToDirName(patchInfo.installName) + ".msg" if dir is None: return getTempLogFile(outputFile) else: return os.path.join(dir, outputFile)