Ejemplo n.º 1
0
    def fetch_next_commit(self, server_config, last_fetched):
        if not last_fetched:
            # FIXME: This is a problematic if dashboard can get results for revisions older than oldest_revision
            # in the future because we never refetch older revisions.
            last_fetched = self.fetch_revision_from_dasbhoard(
                server_config, 'oldest')

        revision_to_fetch = int(last_fetched) + 1

        args = [
            'svn', 'log', '--revision',
            str(revision_to_fetch), '--xml', self._svn_url, '--non-interactive'
        ]
        if self._use_server_auth and 'auth' in server_config['server']:
            server_auth = server_config['server']['auth']
            args += [
                '--no-auth-cache', '--username', server_auth['username'],
                '--password', server_auth['password']
            ]
        if self._should_trust_certificate:
            args += ['--trust-server-cert']

        try:
            output = subprocess.check_output(args, stderr=subprocess.STDOUT)
        except subprocess.CalledProcessError as error:
            if (': No such revision ' +
                    str(revision_to_fetch)) in error.output:
                return None
            raise error

        xml = parseXmlString(output)
        time = text_content(xml.getElementsByTagName("date")[0])
        author_elements = xml.getElementsByTagName("author")
        author_account = text_content(
            author_elements[0]) if author_elements.length else None
        message = text_content(xml.getElementsByTagName("msg")[0])

        name = self._resolve_author_name(
            author_account
        ) if author_account and self._account_name_script_path else None

        result = {
            'repository': self._name,
            'revision': revision_to_fetch,
            'time': time,
            'message': message,
        }

        if author_account:
            result['author'] = {'account': author_account, 'name': name}

        return result
Ejemplo n.º 2
0
def fetch_commit(repository_name, repository_url, revision):
    args = ['svn', 'log', '--revision', str(revision), '--xml', repository_url]
    try:
        output = subprocess.check_output(args, stderr=subprocess.STDOUT)
    except subprocess.CalledProcessError as error:
        if (': No such revision ' + str(revision)) in error.output:
            return None
        raise error
    xml = parseXmlString(output)
    time = text_content(xml.getElementsByTagName("date")[0])
    author_account = text_content(xml.getElementsByTagName("author")[0])
    message = text_content(xml.getElementsByTagName("msg")[0])
    return {
        'repository': repository_name,
        'revision': revision,
        'time': time,
        'author': {'account': author_account},
        'message': message,
    }
Ejemplo n.º 3
0
def fetch_commit(repository, revision):
    args = ['svn', 'log', '--revision', str(revision), '--xml', repository['url'], '--non-interactive']
    if 'username' in repository and 'password' in repository:
        args += ['--no-auth-cache', '--username', repository['username'], '--password', repository['password']]
    if repository.get('trustCertificate', False):
        args += ['--trust-server-cert']

    try:
        output = subprocess.check_output(args, stderr=subprocess.STDOUT)
    except subprocess.CalledProcessError as error:
        if (': No such revision ' + str(revision)) in error.output:
            return None
        raise error
    xml = parseXmlString(output)
    time = text_content(xml.getElementsByTagName("date")[0])
    author_account = text_content(xml.getElementsByTagName("author")[0])
    message = text_content(xml.getElementsByTagName("msg")[0])
    return {
        'repository': repository['name'],
        'revision': revision,
        'time': time,
        'author': {'account': author_account},
        'message': message,
    }
Ejemplo n.º 4
0
    def fetch_commit(self, server_config, last_fetched):
        if not last_fetched:
            # FIXME: This is a problematic if dashboard can get results for revisions older than oldest_revision
            # in the future because we never refetch older revisions.
            last_fetched = self.fetch_revision_from_dasbhoard(server_config, 'oldest')

        revision_to_fetch = int(last_fetched) + 1

        args = ['svn', 'log', '--revision', str(revision_to_fetch), '--xml', self._svn_url, '--non-interactive']
        if self._use_server_auth and 'auth' in server_config['server']:
            server_auth = server_config['server']['auth']
            args += ['--no-auth-cache', '--username', server_auth['username'], '--password', server_auth['password']]
        if self._should_trust_certificate:
            args += ['--trust-server-cert']

        try:
            output = subprocess.check_output(args, stderr=subprocess.STDOUT)
        except subprocess.CalledProcessError as error:
            if (': No such revision ' + str(revision_to_fetch)) in error.output:
                return None
            raise error

        xml = parseXmlString(output)
        time = text_content(xml.getElementsByTagName("date")[0])
        author_account = text_content(xml.getElementsByTagName("author")[0])
        message = text_content(xml.getElementsByTagName("msg")[0])

        name = self._resolve_author_name(author_account) if self._account_name_script_path else None

        return {
            'repository': self._name,
            'revision': revision_to_fetch,
            'time': time,
            'author': {'account': author_account, 'name': name},
            'message': message,
        }
Ejemplo n.º 5
0
        output = subprocess.check_output(command, stderr=subprocess.STDOUT)
    except subprocess.CalledProcessError as error:
        print "Failed:", str(error)

    regex = re.compile(lines_to_ignore)
    return [{'repository': repository_name, 'revision': line} for line in output.split('\n') if not regex.match(line)]


def fetch_available_builds(repository_name, url, train_version_map):
    output = urllib2.urlopen(url).read()
    try:
        xml = parseXmlString(output)
    except Exception, error:
        raise Exception(error, output)
    available_builds = []
    for image in xml.getElementsByTagName('baseASR'):
        id = text_content(image.getElementsByTagName('id')[0])
        train = text_content(image.getElementsByTagName('train')[0])
        build = text_content(image.getElementsByTagName('build')[0])
        if train not in train_version_map:
            continue
        available_builds.append({
            'repository': repository_name,
            'revision': train_version_map[train] + ' ' + build})

    return available_builds


if __name__ == "__main__":
    main(sys.argv)
Ejemplo n.º 6
0
    except subprocess.CalledProcessError as error:
        print "Failed:", str(error)
        return []

    regex = re.compile(lines_to_ignore)
    return [{'repository': repository_name, 'revision': line} for line in output.split('\n') if not regex.match(line)]


def fetch_available_builds(repository_name, url, train_version_map):
    output = urllib2.urlopen(url).read()
    try:
        xml = parseXmlString(output)
    except Exception, error:
        raise Exception(error, output)
    available_builds = []
    for image in xml.getElementsByTagName('baseASR'):
        id = text_content(image.getElementsByTagName('id')[0])
        train = text_content(image.getElementsByTagName('train')[0])
        build = text_content(image.getElementsByTagName('build')[0])
        if train not in train_version_map:
            continue
        available_builds.append({
            'repository': repository_name,
            'revision': train_version_map[train] + ' ' + build})

    return available_builds


if __name__ == "__main__":
    main(sys.argv)