コード例 #1
0
ファイル: tools.py プロジェクト: julienw/git-cinnabar
 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),
         )
コード例 #2
0
ファイル: tools.py プロジェクト: glandium/git-cinnabar
 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),
         )