def _getURLForBuildWithBuildername(self, builder_name, build_number): # dont use this API. this URL is not supported # its here waiting for getURLForThing removal or switch to deferred prefix = self.getBuildbotURL() return prefix + "#builders/%s/builds/%d" % ( urlquote(builder_name, safe=''), build_number)
def _getURLForBuildWithBuildername(self, builder_name, build_number): # don't use this API. this URL is not supported # its here waiting for getURLForThing removal or switch to deferred prefix = self.getBuildbotURL() return prefix + "#builders/%s/builds/%d" % ( urlquote(builder_name, safe=''), build_number)
def getURLForThing(self, thing): prefix = self.getBuildbotURL() if not prefix: return None if interfaces.IStatus.providedBy(thing): return prefix if interfaces.ISchedulerStatus.providedBy(thing): pass if interfaces.IBuilderStatus.providedBy(thing): bldr = thing return prefix + "#builders/%s" % ( urlquote(bldr.getName(), safe=''), ) if interfaces.IBuildStatus.providedBy(thing): build = thing bldr = build.getBuilder() # should be: # builderid = yield bldr.getBuilderId() # return self.getURLForBuild(self, builderid, build.getNumber()) return self._getURLForBuildWithBuildername(bldr.getName(), build.getNumber()) if interfaces.IBuildStepStatus.providedBy(thing): step = thing build = step.getBuild() bldr = build.getBuilder() return prefix + "#builders/%s/builds/%d/steps/%s" % ( urlquote(bldr.getName(), safe=''), build.getNumber(), urlquote(step.getName(), safe='')) # IBuildSetStatus # IBuildRequestStatus # IWorkerStatus if interfaces.IWorkerStatus.providedBy(thing): worker = thing return prefix + "#workers/%s" % ( urlquote(worker.getName(), safe=''), ) # IStatusEvent if interfaces.IStatusEvent.providedBy(thing): # TODO: this is goofy, create IChange or something if isinstance(thing, changes.Change): change = thing return "%s#changes/%d" % (prefix, change.number)
def getURLForThing(self, thing): prefix = self.getBuildbotURL() if not prefix: return None if interfaces.IStatus.providedBy(thing): return prefix if interfaces.ISchedulerStatus.providedBy(thing): pass if interfaces.IBuilderStatus.providedBy(thing): bldr = thing return prefix + "#builders/%s" % ( urlquote(bldr.getName(), safe=''), ) if interfaces.IBuildStatus.providedBy(thing): build = thing bldr = build.getBuilder() # should be: # builderid = yield bldr.getBuilderId() # return self.getURLForBuild(self, builderid, build.getNumber()) return self._getURLForBuildWithBuildername(bldr.getName(), build.getNumber()) if interfaces.IBuildStepStatus.providedBy(thing): step = thing build = step.getBuild() bldr = build.getBuilder() return prefix + "#builders/%s/builds/%d/steps/%s" % ( urlquote(bldr.getName(), safe=''), build.getNumber(), urlquote(step.getName(), safe='')) # IBuildSetStatus # IBuildRequestStatus # IWorkerStatus if interfaces.IWorkerStatus.providedBy(thing): worker = thing return prefix + "#buildslaves/%s" % ( urlquote(worker.getName(), safe=''), ) # IStatusEvent if interfaces.IStatusEvent.providedBy(thing): # TODO: this is goofy, create IChange or something if isinstance(thing, changes.Change): change = thing return "%s#changes/%d" % (prefix, change.number)
def svnUriCanonicalize(uri): collapse = re.compile(r'([^/]+/\.\./?|/\./|//|/\.$|/\.\.$|^/\.\.)') server_authority = re.compile(r'^(?:([^@]+)@)?([^:]+)(?::(.+))?$') default_port = {'http': '80', 'https': '443', 'svn': '3690'} relative_schemes = ['http', 'https', 'svn'] quote = lambda uri: urlquote(uri, "!$&'()*+,-./:=@_~") if len(uri) == 0 or uri == '/': return uri (scheme, authority, path, parameters, query, fragment) = urlparse(uri) scheme = scheme.lower() if authority: mo = server_authority.match(authority) if not mo: return uri # give up userinfo, host, port = mo.groups() if host[-1] == '.': host = host[:-1] authority = host.lower() if userinfo: authority = "%s@%s" % (userinfo, authority) if port and port != default_port.get(scheme, None): authority = "%s:%s" % (authority, port) if scheme in relative_schemes: last_path = path while True: path = collapse.sub('/', path, 1) if last_path == path: break last_path = path path = quote(urlunquote(path)) canonical_uri = urlunparse( (scheme, authority, path, parameters, query, fragment)) if canonical_uri == '/': return canonical_uri elif canonical_uri[-1] == '/' and canonical_uri[-2] != '/': return canonical_uri[:-1] else: return canonical_uri
def svnUriCanonicalize(uri): collapse = re.compile(r'([^/]+/\.\./?|/\./|//|/\.$|/\.\.$|^/\.\.)') server_authority = re.compile(r'^(?:([^@]+)@)?([^:]+)(?::(.+))?$') default_port = {'http': '80', 'https': '443', 'svn': '3690'} relative_schemes = ['http', 'https', 'svn'] quote = lambda uri: urlquote(uri, "!$&'()*+,-./:=@_~") if len(uri) == 0 or uri == '/': return uri (scheme, authority, path, parameters, query, fragment) = urlparse(uri) scheme = lower(scheme) if authority: mo = server_authority.match(authority) if not mo: return uri # give up userinfo, host, port = mo.groups() if host[-1] == '.': host = host[:-1] authority = lower(host) if userinfo: authority = "%s@%s" % (userinfo, authority) if port and port != default_port.get(scheme, None): authority = "%s:%s" % (authority, port) if scheme in relative_schemes: last_path = path while True: path = collapse.sub('/', path, 1) if last_path == path: break last_path = path path = quote(urlunquote(path)) canonical_uri = urlunparse((scheme, authority, path, parameters, query, fragment)) if canonical_uri == '/': return canonical_uri elif canonical_uri[-1] == '/' and canonical_uri[-2] != '/': return canonical_uri[:-1] else: return canonical_uri
def _trackerBranch(self, branch): return u"refs/buildbot/{}/{}".format(urlquote(self.repourl, ''), self._removeHeads(branch))
def _trackerBranch(self, branch): return "refs/buildbot/%s/%s" % (urlquote(self.repourl, ''), self._removeHeads(branch))