If no download-cache is set, and shared is not a directory, an error is raised:
>>> write('buildout.cfg',
>>> write('buildout.cfg',
... """
... """
... [buildout]
... [buildout]
...
@@ -1032,42 +1027,111 @@ Use option ``share`` to install a share pacakge.
...
@@ -1032,42 +1027,111 @@ Use option ``share`` to install a share pacakge.
... [package]
... [package]
... recipe = slapos.recipe.cmmi
... recipe = slapos.recipe.cmmi
... url = file://%s/package-0.0.0.tar.gz
... url = file://%s/package-0.0.0.tar.gz
... share = /usr/local
... shared = True
... promises = ${:share}/bin/mypackage.exe
... """% src)
... """ % (src,))
>>> print system(buildout) #doctest:+ELLIPSIS
While:
Installing.
Getting section package.
Initializing section package.
...
ValueError: Set the 'shared' option of slapos.recipe.cmmi to an existing directory, or set ${buildout:download-cache}
>>> print system(buildout)
If download-cache is set and shared is True, package will be installed in download-cache/shared/a hash of the recipe's configuration options
>>> write('buildout.cfg',
... """
... [buildout]
... newest = false
... parts = package
... download-cache = %s
...
... [package]
... recipe = slapos.recipe.cmmi
... url = file://%s/package-0.0.0.tar.gz
... shared = True
... """ % (shared_dir, src))
>>> print system(buildout) #doctest:+ELLIPSIS
package: download cache directory .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/68cc2396fae62c7a9fad281b967f313c set for package
Uninstalling package.
Uninstalling package.
Uninstalling package-2.
Uninstalling package-2.
Installing package.
Installing package.
package: Checking whether package is installed at share path: /usr/local
package: Checking whether package is installed at shared path: .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/68cc2396fae62c7a9fad281b967f313c
package: could not find promise "/usr/local/bin/mypackage.exe"
package: could not find promise "/usr/local/bin/mypackage.exe"
Do nothing if one package has been installed.
If shared and download-cache are set to 2 different location, package will be installed in shared_location/shared/a hash of the recipe's configuration options
package: download cache directory .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/59a2b0f2f9d5d62ddc81ced2b16cc3a6 set for package
Uninstalling package.
Uninstalling package.
Installing package.
Installing package.
package: Checking whether package is installed at share path: /usr/local/bin
package: Checking whether package is installed at shared path: .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/59a2b0f2f9d5d62ddc81ced2b16cc3a6
package: download cache directory .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/59a2b0f2f9d5d62ddc81ced2b16cc3a6 set for package
Installing package.
package: Checking whether package is installed at shared path: .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/59a2b0f2f9d5d62ddc81ced2b16cc3a6
package: This shared package has been installed by other package
package: This shared package has been installed by other package
If options change, reinstall in different location:
>>> write('buildout.cfg',
... """
... [buildout]
... newest = false
... parts = package
...
... [package]
... recipe = slapos.recipe.cmmi
... url = file://%s/package-0.0.0.tar.gz
... shared = %s
... change = True
... """ % (src, shared_dir))
>>> print system(buildout) #doctest:+ELLIPSIS
package: download cache directory .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/a70df36830ef6cd53abe3e4fb8789d20 set for package
Uninstalling package.
Installing package.
package: Checking whether package is installed at shared path: .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/a70df36830ef6cd53abe3e4fb8789d20