Changeset 62544 in vbox
- Timestamp:
- Jul 25, 2016 3:58:37 PM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 109113
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testmanager/batch/check_for_deleted_builds.py
r62540 r62544 5 5 6 6 """ 7 Interface used by the tinderbox server side software to add a fresh build. 7 Admin job for checking detecting deleted builds. 8 9 This is necessary when the tinderbox <-> test manager interface was 10 busted and the build info in is out of sync. The result is generally 11 a lot of skipped tests because of missing builds, typically during 12 bisecting problems. 8 13 """ 9 14 … … 42 47 # Test Manager imports 43 48 from testmanager.core.db import TMDatabaseConnection; 44 from testmanager.core.build import Build DataEx, BuildLogic, BuildCategoryData;49 from testmanager.core.build import BuildLogic; 45 50 46 class Build (object): # pylint: disable=R090351 class BuildChecker(object): # pylint: disable=R0903 47 52 """ 48 53 Add build info into Test Manager database. … … 55 60 56 61 oParser = OptionParser(); 57 oParser.add_option('-q', '--quiet', dest = 'fQuiet', action = 'store_true', 62 oParser.add_option('-q', '--quiet', dest = 'fQuiet', action = 'store_true', default = False, 58 63 help = 'Quiet execution'); 59 oParser.add_option('-b', '--branch', dest = 'sBranch', metavar = '<branch>', 60 help = 'branch name (default: trunk)', default = 'trunk'); 61 oParser.add_option('-p', '--product', dest = 'sProductName', metavar = '<name>', 62 help = 'The product name.'); 63 oParser.add_option('-r', '--revision', dest = 'iRevision', metavar = '<rev>', 64 help = 'revision number'); 65 oParser.add_option('-R', '--repository', dest = 'sRepository', metavar = '<repository>', 66 help = 'Version control repository name.'); 67 oParser.add_option('-t', '--type', dest = 'sBuildType', metavar = '<type>', 68 help = 'build type (debug, release etc.)'); 69 oParser.add_option('-v', '--version', dest = 'sProductVersion', metavar = '<ver>', 70 help = 'The product version number (suitable for RTStrVersionCompare)'); 71 oParser.add_option('-o', '--os-arch', dest = 'asTargetOsArches', metavar = '<os.arch>', action = 'append', 72 help = 'Target OS and architecture. This option can be repeated.'); 73 oParser.add_option('-l', '--log', dest = 'sBuildLogPath', metavar = '<url>', 74 help = 'URL to the build logs (optional).'); 75 oParser.add_option('-f', '--file', dest = 'asFiles', metavar = '<file|url>', action = 'append', 76 help = 'URLs or build share relative path to a build output file. This option can be repeated.'); 64 oParser.add_option('--dry-run', dest = 'fRealRun', action = 'store_false', default = False, 65 help = 'Dry run'); 66 oParser.add_option('--real-run', dest = 'fRealRun', action = 'store_true', default = False, 67 help = 'Real run'); 77 68 78 69 (self.oConfig, _) = oParser.parse_args(); 70 if not self.oConfig.fQuiet: 71 if not self.oConfig.fRealRun: 72 print 'Dry run.'; 73 else: 74 print 'Real run! Will commit findings!'; 79 75 80 # Check command line81 asMissing = [];82 if self.oConfig.sBranch is None: asMissing.append('--branch');83 if self.oConfig.iRevision is None: asMissing.append('--revision');84 if self.oConfig.sProductVersion is None: asMissing.append('--version');85 if self.oConfig.sProductName is None: asMissing.append('--product');86 if self.oConfig.sBuildType is None: asMissing.append('--type');87 if self.oConfig.asTargetOsArches is None: asMissing.append('--os-arch');88 if self.oConfig.asFiles is None: asMissing.append('--file');89 if len(asMissing) > 0:90 sys.stderr.write('syntax error: Missing: %s\n' % (asMissing,));91 sys.exit(1);92 # Temporary default.93 if self.oConfig.sRepository is None:94 self.oConfig.sRepository = 'vbox';95 76 96 def add(self):77 def checkBuilds(self): 97 78 """ 98 79 Add build data record into database. 99 80 """ 100 oDb = TMDatabaseConnection() 81 oDb = TMDatabaseConnection(); 82 oBuildLogic = BuildLogic(oDb); 101 83 102 # Assemble the build data. 103 oBuildData = BuildDataEx() 104 oBuildData.idBuildCategory = None; 105 oBuildData.iRevision = self.oConfig.iRevision 106 oBuildData.sVersion = self.oConfig.sProductVersion 107 oBuildData.sLogUrl = self.oConfig.sBuildLogPath 108 oBuildData.sBinaries = ','.join(self.oConfig.asFiles); 109 oBuildData.oCat = BuildCategoryData().initFromValues(sProduct = self.oConfig.sProductName, 110 sRepository = self.oConfig.sRepository, 111 sBranch = self.oConfig.sBranch, 112 sType = self.oConfig.sBuildType, 113 asOsArches = self.oConfig.asTargetOsArches); 84 tsNow = oDb.getCurrentTimestamp(); 85 cMaxRows = 1024; 86 iStart = 0; 87 while True: 88 aoBuilds = oBuildLogic.fetchForListing(iStart, cMaxRows, tsNow); 89 for oBuild in aoBuilds: 90 if oBuild.fBinariesDeleted is False: 91 rc = oBuild.areFilesStillThere(); 92 if rc is False: 93 if not self.oConfig.fQuiet: 94 print 'missing files for build #%s' % (oBuild.idBuild,); 95 if self.oConfig.fRealRun is True: 96 oBuild.fBinariesDeleted = True; 97 oBuildLogic.editEntry(oBuild, fCommit = True); 114 98 115 # Add record to database 116 try: 117 BuildLogic(oDb).addEntry(oBuildData, fCommit = True); 118 except: 119 if self.oConfig.fQuiet: 120 sys.exit(1); 121 raise; 99 # advance 100 if len(aoBuilds) < cMaxRows: 101 break; 102 iStart += len(aoBuilds); 103 122 104 oDb.close(); 123 105 return 0; 124 106 125 107 if __name__ == '__main__': 126 sys.exit(Build ().add());108 sys.exit(BuildChecker().checkBuilds()); 127 109
Note:
See TracChangeset
for help on using the changeset viewer.