]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Merge branch 'localdir'
authorTommi Virtanen <tommi.virtanen@dreamhost.com>
Wed, 13 Jul 2011 19:38:12 +0000 (12:38 -0700)
committerTommi Virtanen <tommi.virtanen@dreamhost.com>
Wed, 13 Jul 2011 19:38:12 +0000 (12:38 -0700)
Conflicts:
teuthology/task/ceph.py

1  2 
teuthology/task/ceph.py

index e599e1fe87cdea867c58c15db9c084e91d41701b,f12464b98e1f3e4243a0f139c523f044b97e82fc..b2b1c16120baa835bbe73df8fa64dbaed8ed437e
@@@ -101,36 -105,85 +105,86 @@@ def ship_utilities(ctx, config)
  
  @contextlib.contextmanager
  def binaries(ctx, config):
-     log.info('Unpacking ceph binaries...')
-     sha1, ceph_bindir_url = teuthology.get_ceph_binary_url(
-         branch=config.get('branch'),
-         tag=config.get('tag'),
-         sha1=config.get('sha1'),
-         flavor=config.get('flavor'),
-         )
-     ctx.summary['flavor'] = config.get('flavor', 'default')
-     ctx.summary['ceph-sha1'] = sha1
-     if ctx.archive is not None:
-         with file(os.path.join(ctx.archive, 'ceph-sha1'), 'w') as f:
-             f.write(sha1 + '\n')
-     ctx.cluster.run(
-         args=[
-             'install', '-d', '-m0755', '--', '/tmp/cephtest/binary',
-             run.Raw('&&'),
-             'uname', '-m',
-             run.Raw('|'),
-             'sed', '-e', 's/^/ceph./; s/$/.tgz/',
-             run.Raw('|'),
-             'wget',
-             '-nv',
-             '-O-',
-             '--base={url}'.format(url=ceph_bindir_url),
-             # need to use --input-file to make wget respect --base
-             '--input-file=-',
-             run.Raw('|'),
-             'tar', '-xzf', '-', '-C', '/tmp/cephtest/binary',
-             ],
-         )
+     path = config.get('path')
+     tmpdir = None
+     if path is None:
+         # fetch from gitbuilder gitbuilder
+         log.info('Fetching and unpacking ceph binaries from gitbuilder...')
+         sha1, ceph_bindir_url = teuthology.get_ceph_binary_url(
+             branch=config.get('branch'),
+             tag=config.get('tag'),
+             sha1=config.get('sha1'),
+             flavor=config.get('flavor'),
+             )
++        ctx.summary['ceph-sha1'] = sha1
+         if ctx.archive is not None:
+             with file(os.path.join(ctx.archive, 'ceph-sha1'), 'w') as f:
+                 f.write(sha1 + '\n')
+         ctx.cluster.run(
+             args=[
+                 'install', '-d', '-m0755', '--', '/tmp/cephtest/binary',
+                 run.Raw('&&'),
+                 'uname', '-m',
+                 run.Raw('|'),
+                 'sed', '-e', 's/^/ceph./; s/$/.tgz/',
+                 run.Raw('|'),
+                 'wget',
+                 '-nv',
+                 '-O-',
+                 '--base={url}'.format(url=ceph_bindir_url),
+                 # need to use --input-file to make wget respect --base
+                 '--input-file=-',
+                 run.Raw('|'),
+                 'tar', '-xzf', '-', '-C', '/tmp/cephtest/binary',
+                 ],
+             )
+     else:
+         with tempfile.TemporaryFile(prefix='teuthology-tarball-', suffix='.tgz') as tar_fp:
+             tmpdir = tempfile.mkdtemp(prefix='teuthology-tarball-')
+             try:
+                 log.info('Installing %s to %s...' % (path, tmpdir))
+                 subprocess.check_call(
+                     args=[
+                         'make',
+                         'install',
+                         'DESTDIR={tmpdir}'.format(tmpdir=tmpdir),
+                         ],
+                     cwd=path,
+                     )
+                 try:
+                     os.symlink('.', os.path.join(tmpdir, 'usr', 'local'))
+                 except OSError as e:
+                     if e.errno == errno.EEXIST:
+                         pass
+                     else:
+                         raise
+                 log.info('Building ceph binary tarball from %s...', tmpdir)
+                 subprocess.check_call(
+                     args=[
+                         'tar',
+                         'cz',
+                         '.',
+                         ],
+                     cwd=tmpdir,
+                     stdout=tar_fp,
+                     )
+             finally:
+                 shutil.rmtree(tmpdir, ignore_errors=True)
+             log.info('Pushing tarball...')
+             tar_fp.seek(0)
+             writes = ctx.cluster.run(
+                 args=[
+                     'install', '-d', '-m0755', '--', '/tmp/cephtest/binary',
+                     run.Raw('&&'),
+                     'tar', '-xzf', '-', '-C', '/tmp/cephtest/binary'
+                     ],
+                 stdin=run.PIPE,
+                 wait=False,
+                 )
+             teuthology.feed_many_stdins_and_close(tar_fp, writes)
+             run.wait(writes)
      try:
          yield
      finally:
@@@ -681,11 -708,10 +746,12 @@@ def task(ctx, config)
                  branch=config.get('branch'),
                  tag=config.get('tag'),
                  sha1=config.get('sha1'),
+                 path=config.get('path'),
                  flavor=flavor,
                  )),
 -        lambda: cluster(ctx=ctx, config=None),
 +        lambda: cluster(ctx=ctx, config=dict(
 +                conf=config.get('conf', {})
 +                )),
          lambda: mon(ctx=ctx, config=dict(
                  coverage=config.get('coverage'),
                  )),