def cdm_rtichk(ui, repo, **opts): '''check active bug/RFEs for approved RTIs Only works on SWAN.''' if opts.get('nocheck') or os.path.exists(repo.join('cdm/rtichk.NOT')): ui.status('Skipping RTI checks...\n') return 0 if not onSWAN(): ui.write('RTI checks only work on SWAN, skipping...\n') return 0 parent = wslist[repo].parent(opts.get('parent')) active = wslist[repo].active(parent) ui.write('RTI check:\n') bugs = [] for com in active.comments(): match = Comments.isBug(com) if match and match.group(1) not in bugs: bugs.append(match.group(1)) # RTI normalizes the gate path for us return int(not Rti.rti(bugs, gatePath=parent, output=ui))
def __init__(self, forceBoo=False): """Create a BugDB object. Keyword argument: forceBoo: use b.o.o even from SWAN (default=False) """ if forceBoo: self.__onSWAN = False else: self.__onSWAN = onSWAN() if self.__onSWAN: self.__m = Monaco()
def __init__(self, priority = ("bugster",), forceBoo=False): """Create a BugDB object. Keyword argument: forceBoo: use b.o.o even from SWAN (default=False) priority: use bug databases in this order """ self.__validBugDB = ["bugster"] self.__onSWAN = not forceBoo and onSWAN() for database in priority: if database not in self.__validBugDB: raise BugDBException, database self.__priority = priority
def ARC(arclist, arcPath=None): if not arcPath: if onSWAN(): arcPath = "http://candi.sfbay.sun.com/cgi-bin/arc.cgi" else: arcPath = "http://arc.opensolaris.org/cgi-bin/arc.cgi" fields = ["present", "arc", "year", "case", "status", "title"] opts = [("case", "%s/%s" % (a, c)) for a, c in arclist] req = urllib2.Request(arcPath, urllib.urlencode(opts)) try: data = urllib2.urlopen(req).readlines() except urllib2.HTTPError, e: print "ERROR: HTTP error at " + req.get_full_url() + \ " got error: " + str(e.code) raise e
def __init__(self, cr, gate=None, consolidation=None): """Create an Rti object for the specified change request. Argument: cr: change request id Keyword arguments, to limit scope of RTI search: gate: path to gate workspace (default=None) consolidation: consolidation name (default=None) """ bufSz = 1024 addr = (WEBRTI_HOST, WEBRTI_PORT) # If the passed 'cr' was given as an int, then wrap it # into a string to make our life easier if isinstance(cr, int): cr = str(cr) self.__queryCr = cr self.__queryGate = gate self.__queryConsolidation = consolidation self.__webRtiOutput = [] self.__mainCR = [] self.__rtiNumber = [] self.__consolidation = [] self.__project = [] self.__status = [] self.__rtiType = [] try: # try to use a direct connection to the # webrti server first sock = socket(AF_INET, SOCK_STREAM) sock.connect(addr) command = "WEBRTICLI/1.0\nRTIstatus\n%s\n" % cr if consolidation: command += "-c\n%s\n" % consolidation if gate: command += "-g\n%s\n" % gate command += "\n" sock.send(command) dataList = [] # keep receiving data from the socket until the # server closes the connection stillReceiving = True while stillReceiving: dataPiece = sock.recv(bufSz) if dataPiece: dataList.append(dataPiece) else: stillReceiving = False # create the lines, skipping the first # ("WEBRTCLI/1.0\n") data = '\n'.join(''.join(dataList).split('\n')[1:]) except: if not onSWAN(): raise RtiOffSwan(cr) if not os.path.exists(WEBRTICLI): raise RtiCallFailed('not found') # fallback to the "supported" webrticli interface command = WEBRTICLI if consolidation: command += " -c " + consolidation if gate: command += " -g " + gate command += " RTIstatus " + cr try: cliPipe = os.popen(command) except: # we couldn't call the webrticli for some # reason, so return a failure raise RtiCallFailed('unknown') data = cliPipe.readline() # parse the data to see if we got a return code # if we did, then that's bad. if we didn't, # then our call was successful m = returnCodeRe.search(data) if m: rc = m.group(1) # we got a return code, set it in our # object, set the webRtiOutput for debugging # or logging, and return a failure if rc in WEBRTI_ERRORS: exc = WEBRTI_ERRORS[rc] if exc == RtiBadGate: edata = gate else: edata = cr else: exc = RtiUnknownException edata = rc raise exc(edata) data = data.splitlines() # At this point, we should have valid data for line in data: line = line.rstrip('\r\n') self.__webRtiOutput.append(line) fields = line.split(':') self.__mainCR.append(fields[0]) self.__rtiNumber.append(fields[1]) self.__consolidation.append(fields[2]) self.__project.append(fields[3]) self.__status.append(fields[4]) self.__rtiType.append(fields[5])