Example #1
0
    def getBuildUrl(self, datestamp):
        if self.appName == 'fennec':
            repo = 'mobile'
        else:
            repo = 'firefox'
        url = "http://ftp.mozilla.org/pub/mozilla.org/" + repo + "/nightly/"
        year = str(datestamp.year)
        month = "%02d" % datestamp.month
        day = "%02d" % datestamp.day
        repo_name = self.repo_name or self.getRepoName(datestamp)
        url += year + "/" + month + "/"

        linkRegex = '^' + year + '-' + month + '-' + day + '-' + '[\d-]+' + repo_name + '/$'
        cachekey = year + '-' + month
        if cachekey in self._monthlinks:
            monthlinks = self._monthlinks[cachekey]
        else:
            monthlinks = urlLinks(url)
            self._monthlinks[cachekey] = monthlinks

        # first parse monthly list to get correct directory
        for dirlink in monthlinks:
            dirhref = dirlink.get("href")
            if re.match(linkRegex, dirhref):
                # now parse the page for the correct build url
                for link in urlLinks(url + dirhref):
                    href = link.get("href")
                    if re.match(self.buildRegex, href):
                        return url + dirhref + href
Example #2
0
    def getBuildUrl(self, date):
        url = "http://ftp.mozilla.org/pub/mozilla.org/" + self.appName + "/nightly/"
        year = str(date.year)
        month = "%02d" % date.month
        day = "%02d" % date.day
        repo_name = self.repo_name or self.getRepoName(date)
        url += year + "/" + month + "/"

        linkRegex = '^' + year + '-' + month + '-' + day + '-' + '[\d-]+' + repo_name + '/$'
        cachekey = year + '-' + month
        if cachekey in self._monthlinks:
            monthlinks = self._monthlinks[cachekey]
        else:
            monthlinks = urlLinks(url)
            self._monthlinks[cachekey] = monthlinks

        # first parse monthly list to get correct directory
        for dirlink in monthlinks:
            dirhref = dirlink.get("href")
            if re.match(linkRegex, dirhref):
                # now parse the page for the correct build url
                for link in urlLinks(url + dirhref):
                    href = link.get("href")
                    if re.match(self.buildRegex, href):
                        return url + dirhref + href

        return False
Example #3
0
def getInboundRevisions(startRev, endRev, appName='firefox', bits=mozinfo.bits, os=mozinfo.os):

    revisions = []
    r = requests.get('https://hg.mozilla.org/integration/mozilla-inbound/'
                     'json-pushes?fromchange=%s&tochange=%s'% (startRev,
                                                               endRev))
    pushlog = json.loads(r.content)
    for pushid in sorted(pushlog.keys()):
        push = pushlog[pushid]
        revisions.append((push['changesets'][-1], push['date']))

    revisions.sort(key=lambda r: r[1])
    if not revisions:
        return []
    starttime = revisions[0][1]
    endtime = revisions[-1][1]
    rawRevisions = map(lambda l: l[0], revisions)

    baseURL = getBuildBaseURL(appName=appName, bits=bits, os=os)
    range = 60*60*4 # anything within four hours is potentially within the range
    timestamps = map(lambda l: int(l.get('href').strip('/')),
                     urlLinks(baseURL))
    timestampsInRange = filter(lambda t: t > (starttime - range) and
                               t < (endtime + range), timestamps)
    revisions = [] # timestamp, order pairs
    for timestamp in timestampsInRange:
        for link in urlLinks("%s%s/" % (baseURL, timestamp)):
            href = link.get('href')
            if re.match('^.+\.txt$', href):
                url = "%s%s/%s" % (baseURL, timestamp, href)
                response = requests.get(url)
                remoteRevision = None
                for line in response.iter_lines():
                    # Filter out Keep-Alive new lines.
                    if not line:
                        continue
                    parts = line.split('/rev/')
                    if len(parts) == 2:
                        remoteRevision = parts[1]
                        break # for line
                if remoteRevision:
                    for (i, revision) in enumerate(rawRevisions):
                        if remoteRevision in revision:
                            revisions.append((revision, timestamp, i))
                break # for link

    return sorted(revisions, key=lambda r: r[2])
Example #4
0
 def getBuildUrl(self, timestamp):
     url = "%s%s/" % (getBuildBaseURL(appName=self.appName), timestamp)
     for link in urlLinks(url):
         href = link.get("href")
         if re.match(self.buildRegex, href):
             return url + href