def __init__(self, name): cpu = self.cpu create_commands = ( 'pacman-key --init', 'pacman-key --populate msys2', 'pacman --noconfirm -Sy --force --asdeps pacman-mirrors', 'pacman --noconfirm -Sy tar {}'.format( ' '.join(self.packages(name))), 'rm -rf /var/cache/pacman/pkg', 'python -m pip install pip==10.0.1 --upgrade', 'pip install wheel', 'mv {}/{}/bin/{{{{mingw32-,}}}}make.exe'.format(msys(cpu), mingw(cpu)), 'tar -jcf msys2.tar.bz2 --hard-dereference {}'.format(msys(cpu)), ) env = MsysBase.by_name(cpu) h = hashlib.sha1(env.hexdigest.encode()) h.update(';'.join(create_commands).encode()) self.hexdigest = h.hexdigest() Task.__init__( self, task_env=env, description='msys2 image: {} {}'.format(name, cpu), index=self.index, expireIn='26 weeks', command=create_commands, artifact='msys2.tar.bz2', )
def __init__(self, os_and_version): (os, version) = os_and_version.split('.', 1) env = TaskEnvironment.by_name('{}.build'.format(os)) desc = 'hg v{}'.format(version) if os == 'linux': artifact = 'mercurial-{}-cp27-none-linux_x86_64.whl' else: desc = '{} {} {}'.format(desc, env.os, env.cpu) artifact = 'mercurial-{}-cp27-cp27m-mingw.whl' # 2.6.2 is the first version available on pypi if parse_version('2.6.2') <= parse_version(version): source = 'mercurial=={}' else: source = 'https://mercurial-scm.org/release/mercurial-{}.tar.gz' Task.__init__( self, task_env=env, description=desc, index='{}.hg.v{}'.format(env.hexdigest, version), expireIn='26 weeks', command=( 'pip wheel -v --build-option -b --build-option $PWD/wheel' ' -w $ARTIFACTS {}'.format(source.format(version)), ), artifact=artifact.format(version), )
def __init__(self, name): cpu = self.cpu create_commands = ( 'pacman-key --init', 'pacman-key --populate msys2', 'sed -i s,://repo.msys2.org/,' '://mirrors.zju.edu.cn/msys2/, /etc/pacman.d/mirrorlist.*', 'pacman --noconfirm -Sy tar {}'.format(' '.join( self.packages(name))), 'rm -rf /var/cache/pacman/pkg', 'python -m pip install pip==19.2.2 --upgrade', 'pip install wheel', 'mv {}/{}/bin/{{{{mingw32-,}}}}make.exe'.format( msys(cpu), mingw(cpu)), 'tar -jcf msys2.tar.bz2 --hard-dereference {}'.format(msys(cpu)), ) env = MsysBase.by_name(cpu) h = hashlib.sha1(env.hexdigest.encode()) h.update(';'.join(create_commands).encode()) self.hexdigest = h.hexdigest() Task.__init__( self, task_env=env, description='msys2 image: {} {}'.format(name, cpu), index=self.index, expireIn='26 weeks', command=create_commands, artifact='msys2.tar.bz2', )
def __init__(self, name): cpu = self.cpu create_commands = ( 'pacman-key --init', 'pacman-key --populate msys2', 'pacman --noconfirm -Sy --force --asdeps pacman-mirrors', 'pacman --noconfirm -Sy tar {}'.format( ' '.join(self.packages(name))), 'rm -rf /var/cache/pacman/pkg', 'python -m pip install pip==10.0.1 --upgrade', 'pip install wheel', 'mv {}/{}/bin/{{{{mingw32-,}}}}make.exe'.format(msys(cpu), mingw(cpu)), 'tar -jcf msys2.tar.bz2 {}'.format(msys(cpu)), ) env = MsysBase.by_name(cpu) h = hashlib.sha1(env.hexdigest) h.update(';'.join(create_commands)) self.hexdigest = h.hexdigest() Task.__init__( self, task_env=env, description='msys2 image: {} {}'.format(name, cpu), index=self.index, expireIn='26 weeks', command=create_commands, artifact='msys2.tar.bz2', )
def __init__(self, os_and_variant): os, variant = (os_and_variant.split('.', 2) + [''])[:2] env = TaskEnvironment.by_name('{}.build'.format(os)) artifact = 'git-cinnabar-helper' if os != 'linux': artifact += '.exe' artifacts = [artifact] def prefix(p, s): return p + s if s else s make_flags = [] hash = None head = None desc_variant = variant extra_commands = [] if variant == 'asan': make_flags.append('CFLAGS="-O2 -g -fsanitize=address"') make_flags.append('LDFLAGS=-static-libasan') elif variant == 'coverage': make_flags.append('CFLAGS="-coverage"') artifacts += ['coverage.tar.xz'] extra_commands = [ 'mv repo/git-core/{{cinnabar,connect,hg}}*.gcno repo/helper', '(cd repo && tar -Jcf $ARTIFACTS/coverage.tar.xz' ' helper/{{cinnabar,connect,hg}}*.gcno)', ] elif variant == 'old': head = old_helper_head() hash = old_helper_hash(head) variant = '' elif variant: raise Exception('Unknown variant: {}'.format(variant)) if os == 'linux': make_flags.append('CURL_COMPAT=1') else: make_flags.append('USE_LIBPCRE1=YesPlease') make_flags.append('USE_LIBPCRE2=') make_flags.append('CFLAGS+=-DCURLOPT_PROXY_CAINFO=246') hash = hash or helper_hash() Task.__init__( self, task_env=env, description='helper {} {}{}'.format( env.os, env.cpu, prefix(' ', desc_variant)), index='helper.{}.{}.{}{}'.format( hash, env.os, env.cpu, prefix('.', variant)), expireIn='26 weeks', command=Task.checkout(commit=head) + [ 'make -C repo -j $(nproc) helper prefix=/usr{}'.format( prefix(' ', ' '.join(make_flags))), 'mv repo/{} $ARTIFACTS/'.format(artifact), ] + extra_commands, artifacts=artifacts, )
def __init__(self, os_and_version): (os, version) = os_and_version.split('.', 1) if os.startswith('osx'): build_image = TaskEnvironment.by_name('osx10_10.build') else: build_image = DockerImage.by_name('build') if os == 'linux' or os.startswith('osx'): h = hashlib.sha1(build_image.hexdigest) h.update('v2') if os == 'linux': description = 'git v{}'.format(version) else: env = build_image description = 'git v{} {} {}'.format(version, env.os, env.cpu) Task.__init__( self, task_env=build_image, description=description, index='{}.git.v{}'.format(h.hexdigest(), version), expireIn='26 weeks', command=Task.checkout( 'git://git.kernel.org/pub/scm/git/git.git', 'v{}'.format(version)) + [ 'make -C repo -j$(nproc) install prefix=/' ' NO_GETTEXT=1 NO_OPENSSL=1 NO_TCLTK=1' ' DESTDIR=$PWD/git', 'tar -Jcf $ARTIFACTS/git-{}.tar.xz git'.format(version), ], artifact='git-{}.tar.xz'.format(version), ) else: env = TaskEnvironment.by_name('{}.build'.format(os)) raw_version = version if 'windows' not in version: version = { version: version + '.windows.1', '2.17.1': '2.17.1.windows.2', }.get(version) if version.endswith('.windows.1'): min_ver = version[:-len('.windows.1')] else: min_ver = version.replace('windows.', '') Task.__init__( self, task_env=build_image, description='git v{} {} {}'.format(version, env.os, env.cpu), index='{}.git.v{}'.format(os, raw_version), expireIn='26 weeks', command=[ 'curl -L https://github.com/git-for-windows/git/releases/' 'download/v{}/MinGit-{}-{}-bit.zip' ' -o git.zip'.format(version, min_ver, msys.bits(env.cpu)), 'unzip -d git git.zip', 'tar -jcf $ARTIFACTS/git-{}.tar.bz2 git'.format( raw_version), ], artifact='git-{}.tar.bz2'.format(raw_version), )
def __init__(self, os_and_version): (os, version) = os_and_version.split('.', 1) env = TaskEnvironment.by_name('{}.build'.format(os)) kwargs = {} if len(version) == 40: # Assume it's a sha1 pretty_version = 'r{}'.format(version) artifact_version = 'unknown' expire = '2 weeks' else: pretty_version = 'v{}'.format(version) artifact_version = version expire = '26 weeks' desc = 'hg {}'.format(pretty_version) if os == 'linux': artifact = 'mercurial-{}-cp27-none-linux_x86_64.whl' else: desc = '{} {} {}'.format(desc, env.os, env.cpu) if os.startswith('osx'): artifact = ('mercurial-{{}}-cp27-cp27m-macosx_{}_intel.whl' .format(os[3:])) kwargs.setdefault('env', {})['MACOSX_DEPLOYMENT_TARGET'] = \ '10.10' else: artifact = 'mercurial-{}-cp27-cp27m-mingw.whl' pre_command = [] if len(version) == 40: source = './hg' pre_command.extend( self.install('{}.{}'.format(os, MERCURIAL_VERSION))) pre_command.extend([ 'hg clone https://www.mercurial-scm.org/repo/hg -r {}' .format(version), 'rm -rf hg/.hg', ]) # 2.6.2 is the first version available on pypi elif parse_version('2.6.2') <= parse_version(version): source = 'mercurial=={}' else: source = 'https://mercurial-scm.org/release/mercurial-{}.tar.gz' Task.__init__( self, task_env=env, description=desc, index='{}.hg.{}'.format(env.hexdigest, pretty_version), expireIn=expire, command=pre_command + [ 'python -m pip wheel -v --build-option -b --build-option' ' $PWD/wheel -w $ARTIFACTS {}'.format(source.format(version)), ], artifact=artifact.format(artifact_version), **kwargs )
def __init__(self, msg=None): Task.__init__(self, msg) self.map_tasks = {} self.reduce_tasks = {} self.im = self.intermediate self.im.task_id = msg self.im.reducers = self.reducers self.maptask = MapWrapper(self.map('MapTask'), self.im, self) self.reducetask = ReduceWrapper(self.reduce('ReduceTask'), self.im, self) for src in self.datasources.itervalues(): src.connect()
def __init__(self, msg=None): Task.__init__(self, msg) self.__lock = Lock() self.map_tasks = {} self.reduce_tasks = {} self.im = self.intermediate self.im.task_id = msg self.im.reducers = self.reducers self.maptask = MapWrapper(self.map("MapTask"), self.im, self) self.reducetask = ReduceWrapper(self.reduce("ReduceTask"), self.im, self) for src in self.datasources.itervalues(): src.open()
def __init__(self, cpu): assert cpu in CPUS _create_command = ( 'curl -L http://repo.msys2.org/distrib/{cpu}' '/msys2-base-{cpu}-{version}.tar.xz | xz -cd | bzip2 -c' ' > $ARTIFACTS/msys2.tar.bz2'.format(cpu=cpu, version=MSYS_VERSION)) h = hashlib.sha1(_create_command) self.hexdigest = h.hexdigest() self.cpu = cpu Task.__init__( self, task_env=DockerImage.by_name('base'), description='msys2 image: base {}'.format(cpu), index=self.index, expireIn='26 weeks', command=[_create_command], artifact='msys2.tar.bz2', )
def __init__(self, cpu): assert cpu in CPUS _create_command = ( 'curl -L http://repo.msys2.org/distrib/{cpu}' '/msys2-base-{cpu}-{version}.tar.xz | xz -cd | bzip2 -c' ' > $ARTIFACTS/msys2.tar.bz2'.format( cpu=msys_cpu(cpu), version=MSYS_VERSION) ) h = hashlib.sha1(_create_command.encode()) self.hexdigest = h.hexdigest() self.cpu = cpu Task.__init__( self, task_env=DockerImage.by_name('base'), description='msys2 image: base {}'.format(cpu), index=self.index, expireIn='26 weeks', command=[_create_command], artifact='msys2.tar.bz2', )
def __init__(self, name): super(DockerImageTask, self).__init__(name) kwargs = {} if isinstance(self.base, DockerImage): kwargs['dependencies'] = [self.base] Task.__init__(self, task_env=self, description='docker image: {}'.format(name), index=self.index, expireIn='26 weeks', image='python:2.7', dind=True, command=Task.checkout() + [ 'pip install requests-unixsocket zstandard==0.8.1', 'python2.7 repo/CI/docker.py build {}'.format(name), 'python2.7 repo/CI/docker.py save {}' ' > $ARTIFACTS/image.tar.zst'.format(name), ], artifact='image.tar.zst', **kwargs)
def __init__(self, name): super(DockerImageTask, self).__init__(name) kwargs = {} if isinstance(self.base, DockerImage): kwargs['dependencies'] = [self.base] Task.__init__( self, task_env=self, description='docker image: {}'.format(name), index=self.index, expireIn='26 weeks', image='python:3.7', dind=True, command=Task.checkout() + [ 'pip install requests-unixsocket zstandard==0.8.1', 'python repo/CI/docker.py build {}' .format(name), 'python repo/CI/docker.py save {}' ' > $ARTIFACTS/image.tar.zst'.format(name), ], artifact='image.tar.zst', **kwargs )
def __init__(self, os_and_variant): os, variant = (os_and_variant.split('.', 2) + [''])[:2] if variant == 'asan' and os == 'osx10_10': os = 'osx10_11' env = TaskEnvironment.by_name('{}.build'.format(os)) artifact = 'git-cinnabar-helper' if os.startswith('mingw'): artifact += '.exe' artifacts = [artifact] def prefix(p, s): return p + s if s else s make_flags = [] hash = None head = None desc_variant = variant extra_commands = [] if variant == 'asan': if os.startswith('osx'): opt = '-O2' else: opt = '-Og' make_flags.append('LDFLAGS=-static-libasan') make_flags.append( 'CFLAGS="{} -g -fsanitize=address -fno-omit-frame-pointer"' .format(opt)) elif variant == 'coverage': make_flags.append('CFLAGS="-coverage"') artifacts += ['coverage.tar.xz'] extra_commands = [ 'mv repo/git-core/{{cinnabar,connect,hg}}*.gcno repo/helper', '(cd repo && tar -Jcf $ARTIFACTS/coverage.tar.xz' ' helper/{{cinnabar,connect,hg}}*.gcno)', ] elif variant == 'old' or variant.startswith('old:'): if len(variant) > 3: head = variant[4:] else: head = old_helper_head() hash = helper_hash(head) variant = '' elif variant: raise Exception('Unknown variant: {}'.format(variant)) if os == 'linux': make_flags.append('CURL_COMPAT=1') elif not os.startswith('osx'): make_flags.append('USE_LIBPCRE1=YesPlease') make_flags.append('USE_LIBPCRE2=') make_flags.append('CFLAGS+=-DCURLOPT_PROXY_CAINFO=246') hash = hash or helper_hash() Task.__init__( self, task_env=env, description='helper {} {}{}'.format( env.os, env.cpu, prefix(' ', desc_variant)), index='helper.{}.{}.{}{}'.format( hash, env.os, env.cpu, prefix('.', variant)), expireIn='26 weeks', command=Task.checkout(commit=head) + [ 'make -C repo helper -j $({}) prefix=/usr{} V=1'.format( nproc(env), prefix(' ', ' '.join(make_flags))), 'mv repo/{} $ARTIFACTS/'.format(artifact), ] + extra_commands, artifacts=artifacts, )
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)
def __init__(self, os_and_variant): os, variant = (os_and_variant.split('.', 2) + [''])[:2] if os.startswith('osx'): os = 'osx' env = TaskEnvironment.by_name('{}.build'.format(os)) artifact = 'git-cinnabar-helper' if os.startswith('mingw'): artifact += '.exe' artifacts = [artifact] def prefix(p, s): return p + s if s else s make_flags = [] hash = None head = None desc_variant = variant extra_commands = [] if variant == 'asan': if os.startswith('osx'): opt = '-O2' else: opt = '-Og' make_flags.append('LDFLAGS=-static-libasan') make_flags.append( 'CFLAGS="{} -g -fsanitize=address -fno-omit-frame-pointer"'. format(opt)) elif variant == 'coverage': make_flags.append('CFLAGS="-coverage"') artifacts += ['coverage.zip'] extra_commands = [ 'mv repo/git-core/{{cinnabar,connect,hg}}*.gcno repo/helper', '(cd repo && zip $ARTIFACTS/coverage.zip' ' helper/{{cinnabar,connect,hg}}*.gcno)', ] elif variant == 'old' or variant.startswith('old:'): if len(variant) > 3: head = variant[4:] else: head = old_helper_head() hash = helper_hash(head) variant = '' elif variant: raise Exception('Unknown variant: {}'.format(variant)) if os == 'linux': make_flags.append('CURL_COMPAT=1') elif os == 'arm64-osx': make_flags.append('CFLAGS+="-arch {}"'.format(env.cpu)) make_flags.append('LDFLAGS+="-arch {}"'.format(env.cpu)) elif not os.startswith('osx'): make_flags.append('USE_LIBPCRE1=YesPlease') make_flags.append('USE_LIBPCRE2=') make_flags.append('CFLAGS+=-DCURLOPT_PROXY_CAINFO=246') hash = hash or helper_hash() kwargs = {} if os.startswith('osx'): kwargs.setdefault('env', {}).setdefault('MACOSX_DEPLOYMENT_TARGET', '10.7') Task.__init__( self, task_env=env, description='helper {} {}{}'.format(env.os, env.cpu, prefix(' ', desc_variant)), index='helper.{}.{}.{}{}'.format(hash, env.os, env.cpu, prefix('.', variant)), expireIn='26 weeks', command=Task.checkout(commit=head) + [ 'make -C repo helper -j $({}) prefix=/usr{} V=1'.format( nproc(env), prefix(' ', ' '.join(make_flags))), 'mv repo/{} $ARTIFACTS/'.format(artifact), ] + extra_commands, artifacts=artifacts, **kwargs, )
def __init__(self, os_and_version): (os, version) = os_and_version.split('.', 1) (version, suffix, _) = version.partition('.py3') if suffix: python = 'python3' else: python = 'python' env = TaskEnvironment.by_name('{}.build'.format(os)) kwargs = {} if len(version) == 40: # Assume it's a sha1 pretty_version = 'r{}{}'.format(version, suffix) artifact_version = 'unknown' expire = '2 weeks' else: pretty_version = 'v{}{}'.format(version, suffix) artifact_version = version expire = '26 weeks' desc = 'hg {}'.format(pretty_version) if os == 'linux': if python == 'python3': artifact = 'mercurial-{}-cp35-cp35m-linux_x86_64.whl' else: artifact = 'mercurial-{}-cp27-cp27mu-linux_x86_64.whl' else: desc = '{} {} {}'.format(desc, env.os, env.cpu) if os.startswith('osx'): wheel_cpu = 'x86_64' artifact = ( 'mercurial-{{}}-cp27-cp27m-macosx_{}_{}.whl'.format( env.os_version.replace('.', '_'), wheel_cpu)) else: artifact = 'mercurial-{}-cp27-cp27m-mingw.whl' pre_command = [] if len(version) == 40: source = './hg' pre_command.extend( self.install('{}.{}'.format(os, MERCURIAL_VERSION))) pre_command.extend([ 'hg clone https://www.mercurial-scm.org/repo/hg -r {}'.format( version), 'rm -rf hg/.hg', ]) # 2.6.2 is the first version available on pypi elif parse_version('2.6.2') <= parse_version(version): source = 'mercurial=={}' else: source = 'https://mercurial-scm.org/release/mercurial-{}.tar.gz' h = hashlib.sha1(env.hexdigest.encode()) h.update(artifact.encode()) Task.__init__(self, task_env=env, description=desc, index='{}.hg.{}'.format(h.hexdigest(), pretty_version), expireIn=expire, command=pre_command + [ '{} -m pip wheel -v --build-option -b --build-option' ' $PWD/wheel -w $ARTIFACTS {}'.format( python, source.format(version)), ], artifact=artifact.format(artifact_version), **kwargs)
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)
def __init__(self, os_and_version): (os, version) = os_and_version.split('.', 1) if os.startswith('osx'): build_image = TaskEnvironment.by_name('osx10_10.build') else: build_image = DockerImage.by_name('build') if os == 'linux' or os.startswith('osx'): h = hashlib.sha1(build_image.hexdigest.encode()) h.update(b'v2') if os == 'linux': description = 'git v{}'.format(version) else: env = build_image description = 'git v{} {} {}'.format(version, env.os, env.cpu) Task.__init__( self, task_env=build_image, description=description, index='{}.git.v{}'.format(h.hexdigest(), version), expireIn='26 weeks', command=Task.checkout( 'git://git.kernel.org/pub/scm/git/git.git', 'v{}'.format(version) ) + [ 'make -C repo -j$({}) install prefix=/ NO_GETTEXT=1' ' NO_OPENSSL=1 NO_TCLTK=1 DESTDIR=$PWD/git'.format( nproc(build_image)), 'tar -Jcf $ARTIFACTS/git-{}.tar.xz git' .format(version), ], artifact='git-{}.tar.xz'.format(version), ) else: env = TaskEnvironment.by_name('{}.build'.format(os)) raw_version = version if 'windows' not in version: version = { version: version + '.windows.1', '2.17.1': '2.17.1.windows.2', }.get(version) if version.endswith('.windows.1'): min_ver = version[:-len('.windows.1')] else: min_ver = version.replace('windows.', '') Task.__init__( self, task_env=build_image, description='git v{} {} {}'.format(version, env.os, env.cpu), index='{}.git.v{}'.format(os, raw_version), expireIn='26 weeks', command=[ 'curl -L https://github.com/git-for-windows/git/releases/' 'download/v{}/MinGit-{}-{}-bit.zip' ' -o git.zip'.format(version, min_ver, msys.bits(env.cpu)), 'unzip -d git git.zip', 'curl -L https://github.com/git-for-windows/git/releases/' 'download/v{}/Git-{}-{}-bit.tar.bz2 | ' 'tar -C git -jx {}/libexec/git-core/git-http-backend.exe' .format(version, min_ver, msys.bits(env.cpu), msys.mingw(env.cpu).lower()), 'tar -jcf $ARTIFACTS/git-{}.tar.bz2 git'.format( raw_version), ], artifact='git-{}.tar.bz2'.format(raw_version), )
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', GITHUB_HEAD_SHA) 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 = install_helper(helper) if variant: kwargs.setdefault('env', {})['VARIANT'] = variant env = TaskEnvironment.by_name('{}.test'.format(task_env)) command = [] if hg: command.extend(install_hg('{}.{}'.format(task_env, hg))) if git: command.extend(install_git('{}.{}'.format(task_env, git))) 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: kwargs['command'] = command + [ 'make -C repo -f CI.mk script', 'make -C repo -f CI.mk script NO_BUNDLE2=1 UPGRADE_FROM=', ] 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, 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)