Commit 5962845b authored by Jondy Zhao's avatar Jondy Zhao

Change platform section name from [arch-platform-name] to [name:platform]

parent 3fddde03
...@@ -227,11 +227,7 @@ Supported options ...@@ -227,11 +227,7 @@ Supported options
the former will be overridden by the latter allowing per-part customization. the former will be overridden by the latter allowing per-part customization.
The recipe uses separated part to support custom options in different The recipe uses separated part to support custom options in different
platforms. These platform's part has a pattern "platform-part" or platforms. These platform's part has a pattern "part:platform".
"arch-platform-part".
arch could be 'x86', 'x86_64', 'ia64' ... which equals
platform.machine().
platform could be 'linux', 'cygwin', 'macos', 'sunos', 'freebsd', platform could be 'linux', 'cygwin', 'macos', 'sunos', 'freebsd',
'netbsd', 'unixware' ... which equals a formatted sys.platform. 'netbsd', 'unixware' ... which equals a formatted sys.platform.
...@@ -241,10 +237,10 @@ For example, ...@@ -241,10 +237,10 @@ For example,
[bzip2] [bzip2]
recipe = slapos.recipe.cmmi recipe = slapos.recipe.cmmi
[x86-cygwin-bzip2] [bzip2:cygwin]
patches = cygwin-bzip2-1.0.6.src.patch patches = cygwin-bzip2-1.0.6.src.patch
All the options in the platform-part have high priority level. All the options in the [part:platform] have high priority level.
The recipe first searches the exact match, if no found. Ignore arch The recipe first searches the exact match, if no found. Ignore arch
and search again, if still found nothing. Use no platform part. and search again, if still found nothing. Use no platform part.
...@@ -376,7 +372,7 @@ a custom location within the buildout:: ...@@ -376,7 +372,7 @@ a custom location within the buildout::
... """ % src) ... """ % src)
>>> print(system(buildout)) >>> print(system(buildout))
Uninstalling package. Uninstalling packagex.
Installing foobar. Installing foobar.
foobar: [ENV] TMP = /sample_buildout/parts/foobar/tmp foobar: [ENV] TMP = /sample_buildout/parts/foobar/tmp
foobar: Extracting package to /sample_buildout/parts/foobar__compile__ foobar: Extracting package to /sample_buildout/parts/foobar__compile__
...@@ -675,7 +671,7 @@ The recipe can specify build options for each platform. For example, ...@@ -675,7 +671,7 @@ The recipe can specify build options for each platform. For example,
... pre-configure = echo "Configure in common platform" ... pre-configure = echo "Configure in common platform"
... post-install = echo "Finished." ... post-install = echo "Finished."
... ...
... [cygwin-package] ... [package:cygwin]
... pre-configure = echo "Configure in the CYGWIN platform" ... pre-configure = echo "Configure in the CYGWIN platform"
... pre-install = echo "Installing in the CYGWIN" ... pre-install = echo "Installing in the CYGWIN"
... post-install = echo -n "CYGWIN " && ${package:post-install} ... post-install = echo -n "CYGWIN " && ${package:post-install}
...@@ -698,7 +694,7 @@ are only ``pre-configure`` and ``post-install``. the output will be ...@@ -698,7 +694,7 @@ are only ``pre-configure`` and ``post-install``. the output will be
Finished. Finished.
In the cygwin, the recipe merges the options in the parts 'package' In the cygwin, the recipe merges the options in the parts 'package'
and 'cygwin-package'. The output will be and 'package:cygwin'. The output will be
>>> print system(buildout) >>> print system(buildout)
Uninstalling package. Uninstalling package.
...@@ -715,14 +711,6 @@ and 'cygwin-package'. The output will be ...@@ -715,14 +711,6 @@ and 'cygwin-package'. The output will be
package: Executing post-install package: Executing post-install
CYGWIN Finished. CYGWIN Finished.
Arch is supported either, For example,
[x86-cygwin-package]
...
The recipe will first search part looks like "arch-platform-part",
then "platform-part".
Union prefix Union prefix
============ ============
...@@ -1116,7 +1104,7 @@ Do nothing if one package has been installed. ...@@ -1116,7 +1104,7 @@ Do nothing if one package has been installed.
... 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/bin ... share = /usr/local/bin
... promises = ... promises =
... """ % (src,)) ... """ % (src,))
>>> print system(buildout) >>> print system(buildout)
......
...@@ -23,7 +23,7 @@ class Recipe(object): ...@@ -23,7 +23,7 @@ class Recipe(object):
self.name = name self.name = name
# Merge options if there is a matched platform section # Merge options if there is a matched platform section
platform_options = self.get_platform_options() platform_options = self.buildout.get("%s:%s" % (name, sys.platform))
if platform_options is None: if platform_options is None:
self.original_options = options self.original_options = options
else: else:
......
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