From: Tommi Virtanen Date: Wed, 13 Jul 2011 19:38:12 +0000 (-0700) Subject: Merge branch 'localdir' X-Git-Tag: 1.1.0~2907 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=c88ef9e7f7cbe7b2ae8d4bc4e1d3794619e33cd3;p=teuthology.git Merge branch 'localdir' Conflicts: teuthology/task/ceph.py --- c88ef9e7f7cbe7b2ae8d4bc4e1d3794619e33cd3 diff --cc teuthology/task/ceph.py index e599e1fe87,f12464b98e..b2b1c16120 --- a/teuthology/task/ceph.py +++ b/teuthology/task/ceph.py @@@ -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'), )),