Commit 8053d0af authored by Nicolas Wavrant's avatar Nicolas Wavrant

Adds a link verb to buildout allowing to just link to local buildout directories

if the current buildout is already compiled
parent ca6a2f94
......@@ -1799,6 +1799,17 @@ def _open(base, filename, seen, dl_options, override, downloaded):
os.remove(downloaded_filename)
options = result.get('buildout', {})
link = options.pop('link', "")
shared_path = shared_stack_path(link)
if link and shared_path:
shared_item_set = set(os.listdir(shared_path))
current_item_set = set(os.listdir('.'))
for item in shared_item_set - current_item_set:
os.symlink(os.path.join(shared_path, item), item)
Buildout.install = lambda *args : None
elif link:
options['extends'] = link
extends = options.pop('extends', None)
if 'extended-by' in options:
raise zc.buildout.UserError(
......@@ -1833,6 +1844,12 @@ def _open(base, filename, seen, dl_options, override, downloaded):
seen.pop()
return result
def shared_stack_path(link):
# md5digest copied from slapos.core. Better to copy/paste more than adding
# dependencies to buildout
link_md5 = md5(link).hexdigest()
shared_stack_path = os.path.join('/', 'opt', 'slapgrid', link_md5)
return (shared_stack_path if os.path.exists(shared_stack_path) else None)
ignore_directories = '.svn', 'CVS', '__pycache__'
_dir_hashes = {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment