This commit is contained in:
Mike Hommey 2014-03-06 08:05:48 +09:00
Родитель 0395ae0802
Коммит 294f8e47ed
1 изменённых файлов: 4 добавлений и 15 удалений

Просмотреть файл

@ -217,17 +217,13 @@ def hash_key(program, args, preprocessed):
return '%s/%s/%s/%s' % (digest[0], digest[1], digest[2], digest)
def cache_store(stderr, path, cache_data, key):
def cache_store(path, cache_data, key):
bucket = Bucket()
try:
bucket.put(key, cache_data.data)
return True
except:
stderr.write('sccache: Failure caching %s as %s to cache [%d]\n' %
(path, key, bucket.status))
return
stderr.write('sccache: Cached %s as %s\n' %
(path, key))
return False
def get_result(command, stdout=sys.stdout, stderr=sys.stderr,
cwd=None):
@ -256,7 +252,6 @@ def get_result(command, stdout=sys.stdout, stderr=sys.stderr,
if stderr_data:
stderr.write(stderr_data)
if ret:
stderr.write('sccache: Preprocessor failed\n')
return ret
bucket = None
@ -270,8 +265,6 @@ def get_result(command, stdout=sys.stdout, stderr=sys.stderr,
cache = bucket.get(key)
if cache:
cache.dump(output_from_cwd)
stderr.write('sccache: Using cache %s for %s\n' %
(key, output))
return 0
proc = subprocess.Popen([program, '-c', '-x', file_type, '-', '-o', output]
@ -284,8 +277,6 @@ def get_result(command, stdout=sys.stdout, stderr=sys.stderr,
stderr.write(stderr_data)
if ret or not os.path.exists(output_from_cwd):
stderr.write('sccache: Compilation failed for %s\n' %
(output))
return ret
return 0, output, key
@ -300,7 +291,7 @@ def main(command, stdout=sys.stdout, stderr=sys.stderr):
cache = CacheData.from_object(output)
conn.send('')
conn.close()
cache_store(stderr, output, cache, key)
cache_store(output, cache, key)
from multiprocessing import Process, Pipe
parent_conn, child_conn = Pipe()
@ -308,8 +299,6 @@ def main(command, stdout=sys.stdout, stderr=sys.stderr):
parent_conn.recv()
parent_conn.close()
stderr.write('sccache: Caching %s as %s\n' % (output, key))
return result