Пример #1
0
 def __init__(self, version):
     sha1 = git_rev_parse(version)
     expireIn = '26 weeks'
     if version == TC_COMMIT or len(version) == 40:
         if version == TC_COMMIT:
             download = Helper.install('linux')
         else:
             download = Helper.install('linux.old:{}'.format(version))
         expireIn = '26 weeks'
     elif parse_version(version) > parse_version('0.5.0a'):
         download = ['repo/git-cinnabar download']
     elif parse_version(version) == parse_version('0.4.0'):
         download = ['(cd repo ; ./git-cinnabar download)']
     else:
         download = []
     if (parse_version(version) < parse_version('0.5.0b3')
             and version != TC_COMMIT):
         hg = '4.3.3'
     else:
         hg = MERCURIAL_VERSION
     if REPO == DEFAULT_REPO:
         index = 'bundle.{}'.format(sha1)
     else:
         index = 'bundle.{}.{}'.format(hashlib.sha1(REPO).hexdigest(), sha1)
     TestTask.__init__(
         self,
         hg=hg,
         description='clone w/ {}'.format(version),
         index=index,
         expireIn=expireIn,
         helper=download,
         commit=sha1,
         clone=False,
         command=[
             'PATH=$PWD/repo:$PATH'
             ' git -c fetch.prune=true clone -n hg::$REPO hg.old.git',
             'git -C hg.old.git bundle create $ARTIFACTS/bundle.git --all',
         ],
         artifact='bundle.git',
         env={
             'REPO': REPO,
         },
         priority='high',
     )
Пример #2
0
 def __init__(self, version):
     sha1 = git_rev_parse(version)
     expireIn = '26 weeks'
     if version == TC_COMMIT or len(version) == 40:
         if version == TC_COMMIT:
             download = Helper.install('linux')
         else:
             download = Helper.install('linux.old:{}'.format(version))
         expireIn = '26 weeks'
     elif parse_version(version) > parse_version('0.5.0a'):
         download = ['repo/git-cinnabar download']
     elif parse_version(version) == parse_version('0.4.0'):
         download = ['(cd repo ; ./git-cinnabar download)']
     else:
         download = []
     if (parse_version(version) < parse_version('0.5.0b3') and
             version != TC_COMMIT):
         hg = '4.3.3'
     else:
         hg = MERCURIAL_VERSION
     if REPO == DEFAULT_REPO:
         index = 'bundle.{}'.format(sha1)
     else:
         index = 'bundle.{}.{}'.format(hashlib.sha1(REPO).hexdigest(), sha1)
     TestTask.__init__(
         self,
         hg=hg,
         description='clone w/ {}'.format(version),
         index=index,
         expireIn=expireIn,
         helper=download,
         commit=sha1,
         clone=False,
         command=[
             'PATH=$PWD/repo:$PATH'
             ' git -c fetch.prune=true clone -n hg::$REPO hg.old.git',
             'git -C hg.old.git bundle create $ARTIFACTS/bundle.git --all',
         ],
         artifact='bundle.git',
         env={
             'REPO': REPO,
         },
     )
Пример #3
0
    def __init__(self, **kwargs):
        git = kwargs.pop('git', GIT_VERSION)
        hg = kwargs.pop('hg', MERCURIAL_VERSION)
        commit = kwargs.pop('commit', None)
        task_env = kwargs.pop('task_env', 'linux')
        variant = kwargs.pop('variant', None)
        helper = kwargs.pop('helper', None)
        clone = kwargs.pop('clone', TC_COMMIT)
        desc = kwargs.pop('description', None)
        extra_desc = kwargs.pop('extra_desc', None)
        pre_command = kwargs.pop('pre_command', None)
        if helper is None:
            helper = '{}.{}'.format(task_env, variant) if variant else task_env
            helper = Helper.install(helper)
        if variant:
            kwargs.setdefault('env', {})['VARIANT'] = variant
        env = TaskEnvironment.by_name('{}.test'.format(task_env))
        command = []
        if pre_command:
            command.extend(pre_command)
        if hg:
            command.extend(Hg.install('{}.{}'.format(task_env, hg)))
            command.append('hg --version')
            try:
                if StrictVersion(hg) < '3.6':
                    kwargs.setdefault('env', {})['NO_CLONEBUNDLES'] = '1'
            except ValueError:
                # `hg` is a sha1 for trunk, which means it's >= 3.6
                pass
        if git:
            command.extend(Git.install('{}.{}'.format(task_env, git)))
            command.append('git --version')
        command.extend(Task.checkout(commit=commit))
        command.extend(helper)
        if clone:
            command.extend([
                'curl -L {{{}.artifact}} -o repo/bundle.git'.format(
                    Clone.by_name(clone)),
                'git init repo/hg.old.git',
                'git -C repo/hg.old.git fetch ../bundle.git refs/*:refs/*',
                'git -C repo/hg.old.git remote add origin hg::$REPO',
                'git -C repo/hg.old.git symbolic-ref HEAD'
                ' refs/heads/branches/default/tip',
            ])
            kwargs.setdefault('env', {})['REPO'] = REPO
        if variant == 'coverage':
            command = [
                'export GIT_CINNABAR_COVERAGE=1',
                'export COVERAGE_FILE=$PWD/repo/.coverage',
            ] + command

        if 'command' in kwargs:
            kwargs['command'] = command + kwargs['command']
        else:
            if commit:
                # Always use the current CI scripts
                command.append('git -C repo checkout {} CI'.format(TC_COMMIT))
            kwargs['command'] = command + [
                'make -C repo -f CI/tests.mk',
            ]

        if variant == 'coverage':
            kwargs['command'].extend([
                'shopt -s nullglob',
                'for f in repo/git-core/{{cinnabar,connect,hg}}*.gcda',
                'do mv $f repo/helper',
                'done',
                'cd repo',
                'zip $ARTIFACTS/coverage.zip .coverage'
                ' helper/{{cinnabar,connect,hg}}*.gcda',
                'cd ..',
                'shopt -u nullglob',
            ])
            artifact = kwargs.pop('artifact', None)
            artifacts = kwargs.setdefault('artifacts', [])
            assert not (artifacts and artifact)
            if artifact:
                artifacts.push(artifact)
            artifacts.append('coverage.zip')
            self.coverage.append(self)
        if not desc:
            desc = 'test w/ git-{} hg-{}'.format(
                git, 'r' + hg if len(hg) == 40 else hg)
            if variant and variant != 'coverage':
                desc = ' '.join((desc, variant))
        if extra_desc:
            desc = ' '.join((desc, extra_desc))
        if task_env != 'linux':
            desc = ' '.join((desc, env.os, env.cpu))
        kwargs['description'] = desc
        Task.__init__(self, task_env=env, **kwargs)
Пример #4
0
 def __init__(self, **kwargs):
     git = kwargs.pop('git', GIT_VERSION)
     hg = kwargs.pop('hg', MERCURIAL_VERSION)
     commit = kwargs.pop('commit', None)
     task_env = kwargs.pop('task_env', 'linux')
     variant = kwargs.pop('variant', None)
     helper = kwargs.pop('helper', None)
     clone = kwargs.pop('clone', TC_COMMIT)
     desc = kwargs.pop('description', None)
     extra_desc = kwargs.pop('extra_desc', None)
     if helper is None:
         helper = '{}.{}'.format(task_env, variant) if variant else task_env
         helper = Helper.install(helper)
     if variant:
         kwargs.setdefault('env', {})['VARIANT'] = variant
     env = TaskEnvironment.by_name('{}.test'.format(task_env))
     command = []
     if hg:
         command.extend(Hg.install('{}.{}'.format(task_env, hg)))
         command.append('hg --version')
     if git:
         command.extend(Git.install('{}.{}'.format(task_env, git)))
         command.append('git --version')
     command.extend(Task.checkout(commit=commit))
     command.extend(helper)
     if clone:
         command.extend([
             'curl -L {{{}.artifact}} -o clone.tar.xz'.format(
                 Clone.by_name(clone)),
             'tar -C repo -Jxf clone.tar.xz',
         ])
     if 'command' in kwargs:
         kwargs['command'] = command + kwargs['command']
     else:
         if commit:
             # Always use the current CI scripts
             command.append('git -C repo checkout {} CI'.format(TC_COMMIT))
         kwargs['command'] = command + [
             'make -C repo -f CI/tests.mk',
         ]
     if variant == 'coverage':
         kwargs['command'].extend([
             'shopt -s nullglob',
             'for f in repo/git-core/{{cinnabar,connect,hg}}*.gcda',
             'do mv $f repo/helper',
             'done',
             'cd repo',
             'tar -Jcf $ARTIFACTS/coverage.tar.xz .coverage'
             ' helper/{{cinnabar,connect,hg}}*.gcda',
             'cd ..',
             'shopt -u nullglob',
         ])
         artifact = kwargs.pop('artifact', None)
         artifacts = kwargs.setdefault('artifacts', [])
         assert not (artifacts and artifact)
         if artifact:
             artifacts.push(artifact)
         artifacts.append('coverage.tar.xz')
         self.coverage.append(self)
     if not desc:
         desc = 'test w/ git-{} hg-{}'.format(
             git, 'r' + hg if len(hg) == 40 else hg)
         if variant and variant != 'coverage':
             desc = ' '.join((desc, variant))
     if extra_desc:
         desc = ' '.join((desc, extra_desc))
     if task_env != 'linux':
         desc = ' '.join((desc, env.os, env.cpu))
     kwargs['description'] = desc
     Task.__init__(self, task_env=env, **kwargs)
Пример #5
0
 def __init__(self, **kwargs):
     git = kwargs.pop('git', GIT_VERSION)
     hg = kwargs.pop('hg', MERCURIAL_VERSION)
     commit = kwargs.pop('commit', None)
     task_env = kwargs.pop('task_env', 'linux')
     variant = kwargs.pop('variant', None)
     helper = kwargs.pop('helper', None)
     clone = kwargs.pop('clone', TC_COMMIT)
     desc = kwargs.pop('description', None)
     extra_desc = kwargs.pop('extra_desc', None)
     pre_command = kwargs.pop('pre_command', None)
     if helper is None:
         helper = '{}.{}'.format(task_env, variant) if variant else task_env
         helper = Helper.install(helper)
     if variant:
         kwargs.setdefault('env', {})['VARIANT'] = variant
     env = TaskEnvironment.by_name('{}.test'.format(task_env))
     command = []
     if pre_command:
         command.extend(pre_command)
     if hg:
         command.extend(Hg.install('{}.{}'.format(task_env, hg)))
         command.append('hg --version')
         if LooseVersion(hg) < '3.6':
             kwargs.setdefault('env', {})['NO_CLONEBUNDLES'] = '1'
     if git:
         command.extend(Git.install('{}.{}'.format(task_env, git)))
         command.append('git --version')
     command.extend(Task.checkout(commit=commit))
     command.extend(helper)
     if clone:
         command.extend([
             'curl -L {{{}.artifact}} -o repo/bundle.git'.format(
                 Clone.by_name(clone)),
             'git init repo/hg.old.git',
             'git -C repo/hg.old.git fetch ../bundle.git refs/*:refs/*',
             'git -C repo/hg.old.git remote add origin hg::$REPO',
             'git -C repo/hg.old.git symbolic-ref HEAD'
             ' refs/heads/branches/default/tip',
         ])
         kwargs.setdefault('env', {})['REPO'] = REPO
     if 'command' in kwargs:
         kwargs['command'] = command + kwargs['command']
     else:
         if commit:
             # Always use the current CI scripts
             command.append('git -C repo checkout {} CI'.format(TC_COMMIT))
         kwargs['command'] = command + [
             'make -C repo -f CI/tests.mk',
         ]
     if variant == 'coverage':
         kwargs['command'].extend([
             'shopt -s nullglob',
             'for f in repo/git-core/{{cinnabar,connect,hg}}*.gcda',
             'do mv $f repo/helper',
             'done',
             'cd repo',
             'tar -Jcf $ARTIFACTS/coverage.tar.xz .coverage'
             ' helper/{{cinnabar,connect,hg}}*.gcda',
             'cd ..',
             'shopt -u nullglob',
         ])
         artifact = kwargs.pop('artifact', None)
         artifacts = kwargs.setdefault('artifacts', [])
         assert not(artifacts and artifact)
         if artifact:
             artifacts.push(artifact)
         artifacts.append('coverage.tar.xz')
         self.coverage.append(self)
     if not desc:
         desc = 'test w/ git-{} hg-{}'.format(
             git, 'r' + hg if len(hg) == 40 else hg)
         if variant and variant != 'coverage':
             desc = ' '.join((desc, variant))
     if extra_desc:
         desc = ' '.join((desc, extra_desc))
     if task_env != 'linux':
         desc = ' '.join((desc, env.os, env.cpu))
     kwargs['description'] = desc
     Task.__init__(self, task_env=env, **kwargs)