diff --git a/ybd/__main__.py b/ybd/__main__.py index 4e4bb9a..46f8047 100755 --- a/ybd/__main__.py +++ b/ybd/__main__.py @@ -51,8 +51,6 @@ defs = Definitions() with app.timer('CACHE-KEYS', 'cache-key calculations'): cache.cache_key(defs, app.config['target']) - if app.config.get('mode', 'normal') == 'keys-only': - os._exit(0) cache.cull(app.config['artifacts']) target = defs.get(app.config['target']) @@ -61,6 +59,9 @@ app.exit('ARCH', 'ERROR: no definitions found for', app.config['arch']) defs.save_trees() + if app.config.get('mode', 'normal') == 'keys-only': + print target['cache'] + os._exit(0) sandbox.executor = sandboxlib.executor_for_platform() app.log(app.config['target'], 'Sandbox using %s' % sandbox.executor) diff --git a/ybd/definitions.py b/ybd/definitions.py index af1d5be..c451b9d 100644 --- a/ybd/definitions.py +++ b/ybd/definitions.py @@ -255,13 +255,17 @@ def save_trees(self): checksum for the state of the working subdirectories ''' with app.chdir(app.config['defdir']): - checksum = check_output('ls -lRA */', shell=True) + try: + checksum = check_output('ls -lRA */', shell=True) + except: + checksum = check_output('ls -lRA .', shell=True) checksum = hashlib.md5(checksum).hexdigest() self._trees = {'.checksum': checksum} for name in self._definitions: if self._definitions[name].get('tree') is not None: self._trees[name] = [self._definitions[name]['ref'], - self._definitions[name]['tree']] + self._definitions[name]['tree'], + self._definitions[name].get('cache')] with open(os.path.join(os.getcwd(), '.trees'), 'w') as f: f.write(yaml.safe_dump(self._trees, default_flow_style=False))