Exemple #1
0
    def displayStatusLine(self, builderList, allBuilds, revision, debugInfo):
        """Display the boxes that represent the status of each builder in the
        first build "revision" was in. Returns an HTML list of errors that
        happened during these builds."""

        details = []
        nbSlaves = 0
        for category in builderList:
            nbSlaves += len(builderList[category])

        # Sort the categories.
        categories = builderList.keys()
        categories.sort()
        
        builds = {}
  
        # Display the boxes by category group.
        for category in categories:
  
            builds[category] = []
            
            # Display the boxes for each builder in this category.
            for builder in builderList[category]:
                introducedIn = None
                firstNotIn = None

                # Find the first build that does not include the revision.
                for build in allBuilds[builder]:
                    if self.comparator.isRevisionEarlier(build, revision):
                        firstNotIn = build
                        break
                    else:
                        introducedIn = build
                        
                # Get the results of the first build with the revision, and the
                # first build that does not include the revision.
                results = None
                previousResults = None
                if introducedIn:
                    results = introducedIn.results
                if firstNotIn:
                    previousResults = firstNotIn.results

                isRunning = False
                if introducedIn and not introducedIn.isFinished:
                    isRunning = True

                url = "./waterfall"
                pageTitle = builder
                tag = ""
                current_details = {}
                if introducedIn:
                    current_details = introducedIn.details or ""
                    url = "./buildstatus?builder=%s&number=%s" % (urllib.quote(builder),
                                                                  introducedIn.number)
                    pageTitle += " "
                    pageTitle += urllib.quote(' '.join(introducedIn.text), ' \n\\/:')

                    builderStrip = builder.replace(' ', '')
                    builderStrip = builderStrip.replace('(', '')
                    builderStrip = builderStrip.replace(')', '')
                    builderStrip = builderStrip.replace('.', '')
                    tag = "Tag%s%s" % (builderStrip, introducedIn.number)

                if isRunning:
                    pageTitle += ' ETA: %ds' % (introducedIn.eta or 0)
                    
                resultsClass = getResultsClass(results, previousResults, isRunning)

                b = {}                
                b["url"] = url
                b["pageTitle"] = pageTitle
                b["color"] = resultsClass
                b["tag"] = tag

                builds[category].append(b)

                # If the box is red, we add the explaination in the details
                # section.
                if current_details and resultsClass == "failure":
                    details.append(current_details)

        return (builds, details)
Exemple #2
0
    def displayStatusLine(self, builderList, allBuilds, revision, debugInfo):
        """Display the boxes that represent the status of each builder in the
        first build "revision" was in. Returns an HTML list of errors that
        happened during these builds."""

        details = []
        nbSlaves = 0
        for category in builderList:
            nbSlaves += len(builderList[category])

        # Sort the categories.
        categories = builderList.keys()
        categories.sort()

        builds = {}

        # Display the boxes by category group.
        for category in categories:

            builds[category] = []

            # Display the boxes for each builder in this category.
            for builder in builderList[category]:
                introducedIn = None
                firstNotIn = None

                cached_value = self.cache.get(builder, revision.revision)
                if cached_value:
                    debugInfo["from_cache"] += 1

                    b = {}
                    b["url"] = cached_value.url
                    b["pageTitle"] = cached_value.pageTitle
                    b["color"] = cached_value.color
                    b["tag"] = cached_value.tag
                    b["builderName"] = cached_value.builderName

                    builds[category].append(b)

                    if cached_value.details and cached_value.color == "failure":
                        details.append(cached_value.details)

                    continue

                # Find the first build that does not include the revision.
                for build in allBuilds[builder]:
                    if self.comparator.isRevisionEarlier(build, revision):
                        firstNotIn = build
                        break
                    else:
                        introducedIn = build

                # Get the results of the first build with the revision, and the
                # first build that does not include the revision.
                results = None
                inProgressResults = None
                previousResults = None
                if introducedIn:
                    results = introducedIn.results
                    inProgressResults = introducedIn.inProgressResults
                if firstNotIn:
                    previousResults = firstNotIn.results

                isRunning = False
                if introducedIn and not introducedIn.isFinished:
                    isRunning = True

                url = "./waterfall"
                pageTitle = builder
                tag = ""
                current_details = {}
                if introducedIn:
                    current_details = introducedIn.details or ""
                    url = "./buildstatus?builder=%s&number=%s" % (
                        urllib.quote(builder), introducedIn.number)
                    pageTitle += " "
                    pageTitle += urllib.quote(' '.join(introducedIn.text),
                                              ' \n\\/:')

                    builderStrip = builder.replace(' ', '')
                    builderStrip = builderStrip.replace('(', '')
                    builderStrip = builderStrip.replace(')', '')
                    builderStrip = builderStrip.replace('.', '')
                    tag = "Tag%s%s" % (builderStrip, introducedIn.number)

                if isRunning:
                    pageTitle += ' ETA: %ds' % (introducedIn.eta or 0)

                resultsClass = getResultsClass(results, previousResults,
                                               isRunning, inProgressResults)

                b = {}
                b["url"] = url
                b["pageTitle"] = pageTitle
                b["color"] = resultsClass
                b["tag"] = tag
                b["builderName"] = builder

                builds[category].append(b)

                # If the box is red, we add the explaination in the details
                # section.
                if current_details and resultsClass == "failure":
                    details.append(current_details)

                # Add this box to the cache if it's completed so we don't have
                # to compute it again.
                if resultsClass not in ("running", "running_failure",
                                        "notstarted"):
                    debugInfo["added_blocks"] += 1
                    self.cache.insert(builder, revision.revision, resultsClass,
                                      pageTitle, current_details, url, tag)

        return (builds, details)
Exemple #3
0
    def displayStatusLine(self, builderList, allBuilds, revision, debugInfo):
        """Display the boxes that represent the status of each builder in the
        first build "revision" was in. Returns an HTML list of errors that
        happened during these builds."""

        details = []
        nbSlaves = 0
        for category in builderList:
            nbSlaves += len(builderList[category])

        # Sort the categories.
        categories = builderList.keys()
        categories.sort()

        builds = {}

        # Display the boxes by category group.
        for category in categories:

            builds[category] = []

            # Display the boxes for each builder in this category.
            for builder in builderList[category]:
                introducedIn = None
                firstNotIn = None

                cached_value = self.cache.get(builder, revision.revision)
                if cached_value:
                    debugInfo["from_cache"] += 1

                    b = {}
                    b["url"] = cached_value.url
                    b["pageTitle"] = cached_value.pageTitle
                    b["color"] = cached_value.color
                    b["tag"] = cached_value.tag
                    b["builderName"] = cached_value.builderName
                    b["buildNumber"] = cached_value.buildNumber

                    builds[category].append(b)

                    if cached_value.details and cached_value.color == "failure":
                         details.append(cached_value.details)

                    continue

                # Find the first build that does not include the revision.
                for build in allBuilds[builder]:
                    if self.comparator.isRevisionEarlier(build, revision):
                        firstNotIn = build
                        break
                    else:
                        introducedIn = build

                # Get the results of the first build with the revision, and the
                # first build that does not include the revision.
                results = None
                inProgressResults = None
                previousResults = None
                if introducedIn:
                    results = introducedIn.results
                    inProgressResults = introducedIn.inProgressResults
                if firstNotIn:
                    previousResults = firstNotIn.results

                isRunning = False
                if introducedIn and not introducedIn.isFinished:
                    isRunning = True

                url = "./waterfall"
                pageTitle = builder
                tag = ""
                current_details = {}
                buildNumber = None
                if introducedIn:
                    current_details = introducedIn.details or ""
                    url = "./buildstatus?builder=%s&number=%s" % (
                        urllib.quote(builder, safe=''),
                        introducedIn.number)
                    buildNumber = introducedIn.number
                    pageTitle += " "
                    pageTitle += urllib.quote(' '.join(introducedIn.text), ' \n\\/:')

                    builderStrip = builder.replace(' ', '')
                    builderStrip = builderStrip.replace('(', '')
                    builderStrip = builderStrip.replace(')', '')
                    builderStrip = builderStrip.replace('.', '')
                    tag = "Tag%s%s" % (builderStrip, introducedIn.number)

                if isRunning:
                    pageTitle += ' ETA: %ds' % (introducedIn.eta or 0)

                resultsClass = getResultsClass(results, previousResults, isRunning,
                                               inProgressResults)

                b = {}
                b["url"] = url
                b["pageTitle"] = pageTitle
                b["color"] = resultsClass
                b["tag"] = tag
                b["builderName"] = builder
                b["buildNumber"] = buildNumber
                builds[category].append(b)

                # If the box is red, we add the explaination in the details
                # section.
                if current_details and resultsClass == "failure":
                    details.append(current_details)

                # Add this box to the cache if it's completed so we don't have
                # to compute it again.
                if resultsClass not in ("running", "running_failure",
                                        "notstarted"):
                  debugInfo["added_blocks"] += 1
                  self.cache.insert(builder, revision.revision, resultsClass,
                                    pageTitle, current_details, url, tag,
                                    buildNumber)

        return (builds, details)
Exemple #4
0
    def displayStatusLine(self,
                          builderList,
                          allBuilds,
                          revision,
                          tempCache,
                          debugInfo,
                          subs,
                          jsonFormat=False):
        """Display the boxes that represent the status of each builder in the
        first build "revision" was in. Returns an HTML list of errors that
        happened during these builds."""

        data = ""
        json = ""

        # Display the first TD (empty) element.
        subs["last"] = ""
        if len(builderList) == 1:
            subs["last"] = "last"
        data += res.main_line_status_header.substitute(subs)

        details = ""
        nbSlaves = 0
        subs["first"] = ""
        for category in builderList:
            nbSlaves += len(builderList[category])

        i = 0
        # Sort the categories.
        categories = builderList.keys()
        categories.sort()
        json += '['

        # Display the boxes by category group.
        for category in categories:
            # Last category? We set the "last" flag.
            subs["last"] = ""
            if i == len(builderList) - 1:
                subs["last"] = "last"

            # Not the first category? We add the spacing between 2 categories.
            if i != 0:
                data += res.main_line_status_section.substitute(subs)
            i += 1

            # Display the boxes for each builder in this category.
            for builder in builderList[category]:
                introducedIn = None
                firstNotIn = None

                cached_value = self.cache.get(builder, revision.revision)
                if cached_value:
                    debugInfo["from_cache"] += 1
                    subs["url"] = cached_value.url
                    subs["title"] = cached_value.title
                    subs["color"] = cached_value.color
                    subs["tag"] = cached_value.tag
                    data += res.main_line_status_box.substitute(subs)

                    json += ("{'url': '%s', 'title': '%s', 'color': '%s',"
                             " 'name': '%s'}," %
                             (subs["url"], subs["title"], subs["color"],
                              urllib.quote(builder)))

                    # If the box is red, we add the explaination in the details
                    # section.
                    if cached_value.details and cached_value.color == "failure":
                        details += cached_value.details

                    continue

                # Find the first build that does not include the revision.
                for build in allBuilds[builder]:
                    if self.comparator.isRevisionEarlier(build, revision):
                        firstNotIn = build
                        break
                    else:
                        introducedIn = build

                # Get the results of the first build with the revision, and the
                # first build that does not include the revision.
                results = None
                inProgressResults = None
                previousResults = None
                if introducedIn:
                    results = introducedIn.results
                    inProgressResults = introducedIn.inProgressResults
                if firstNotIn:
                    previousResults = firstNotIn.results

                isRunning = False
                if introducedIn and not introducedIn.isFinished:
                    isRunning = True

                url = "./waterfall"
                title = builder
                tag = ""
                current_details = None
                if introducedIn:
                    current_details = introducedIn.details or ""
                    url = "./buildstatus?builder=%s&number=%s" % (
                        urllib.quote(builder), introducedIn.number)
                    title += " "
                    title += urllib.quote(' '.join(introducedIn.text),
                                          ' \n\\/:')

                    builderStrip = builder.replace(' ', '')
                    builderStrip = builderStrip.replace('(', '')
                    builderStrip = builderStrip.replace(')', '')
                    builderStrip = builderStrip.replace('.', '')
                    tag = "Tag%s%s" % (builderStrip, introducedIn.number)

                if isRunning:
                    title += ' ETA: %ds' % (introducedIn.eta or 0)

                resultsClass = getResultsClass(results, previousResults,
                                               isRunning, inProgressResults)
                subs["url"] = url
                subs["title"] = title
                subs["color"] = resultsClass
                subs["tag"] = tag

                json += ("{'url': '%s', 'title': '%s', 'color': '%s',"
                         " 'name': '%s'}," %
                         (url, title, resultsClass, urllib.quote(builder)))
                data += res.main_line_status_box.substitute(subs)

                # If the box is red, we add the explaination in the details
                # section.
                if current_details and resultsClass == "failure":
                    details += current_details

                # Add this box to the cache if it's completed so we don't have
                # to compute it again.
                if resultsClass != "running" and \
                      resultsClass != "running_failure" and \
                      resultsClass != "notstarted":
                    debugInfo["added_blocks"] += 1
                    self.cache.insert(builder, revision.revision, resultsClass,
                                      title, current_details, url, tag)
                    tempCache.insert(builder, revision.revision)

        json += ']'
        data += res.main_line_status_footer.substitute(subs)

        if jsonFormat:
            return (json, details)

        return (data, details)
Exemple #5
0
    def displayStatusLine(self, builderList, allBuilds, revision, debugInfo,
                          subs):
        """Display the boxes that represent the status of each builder in the
        first build "revision" was in. Returns an HTML list of errors that
        happened during these builds."""

        data = ""

        # Display the first TD (empty) element.
        subs["last"] = ""
        if len(builderList) == 1:
          subs["last"] = "last"
        data += res.main_line_status_header.substitute(subs)

        details = ""
        nbSlaves = 0
        subs["first"] = ""
        for category in builderList:
            nbSlaves += len(builderList[category])

        i = 0
        # Sort the categories.
        categories = builderList.keys()
        categories.sort()
  
        # Display the boxes by category group.
        for category in categories:
            # Last category? We set the "last" flag.
            subs["last"] = ""
            if i == len(builderList) - 1:
                subs["last"] = "last"

            # Not the first category? We add the spacing between 2 categories.
            if i != 0:
                data += res.main_line_status_section.substitute(subs)
            i += 1

            # Display the boxes for each builder in this category.
            for builder in builderList[category]:
                introducedIn = None
                firstNotIn = None

                # Find the first build that does not include the revision.
                for build in allBuilds[builder]:
                    if self.comparator.isRevisionEarlier(build, revision):
                        firstNotIn = build
                        break
                    else:
                        introducedIn = build
                        
                # Get the results of the first build with the revision, and the
                # first build that does not include the revision.
                results = None
                previousResults = None
                if introducedIn:
                    results = introducedIn.results
                if firstNotIn:
                    previousResults = firstNotIn.results

                isRunning = False
                if introducedIn and not introducedIn.isFinished:
                    isRunning = True

                url = "./waterfall"
                title = builder
                tag = ""
                current_details = None
                if introducedIn:
                    current_details = introducedIn.details or ""
                    url = "./buildstatus?builder=%s&number=%s" % (urllib.quote(builder),
                                                                  introducedIn.number)
                    title += " "
                    title += urllib.quote(' '.join(introducedIn.text), ' \n\\/:')

                    builderStrip = builder.replace(' ', '')
                    builderStrip = builderStrip.replace('(', '')
                    builderStrip = builderStrip.replace(')', '')
                    builderStrip = builderStrip.replace('.', '')
                    tag = "Tag%s%s" % (builderStrip, introducedIn.number)

                if isRunning:
                    title += ' ETA: %ds' % (introducedIn.eta or 0)

                resultsClass = getResultsClass(results, previousResults, isRunning)
                subs["url"] = url
                subs["title"] = title
                subs["color"] = resultsClass
                subs["tag"] = tag

                data += res.main_line_status_box.substitute(subs)

                # If the box is red, we add the explaination in the details
                # section.
                if current_details and resultsClass == "failure":
                    details += current_details

        data += res.main_line_status_footer.substitute(subs)
        return (data, details)