Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.recipe.cmmi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
slapos.recipe.cmmi
Commits
fc93b83f
Commit
fc93b83f
authored
Jul 11, 2013
by
Jondy Zhao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'share-install'
parents
5b03245c
e296d03b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
26 deletions
+85
-26
slapos/recipe/cmmi/README.txt
slapos/recipe/cmmi/README.txt
+68
-18
slapos/recipe/cmmi/__init__.py
slapos/recipe/cmmi/__init__.py
+17
-8
No files found.
slapos/recipe/cmmi/README.txt
View file @
fc93b83f
...
...
@@ -26,6 +26,21 @@ Supported options
``--prefix`` injection takes place. You can also set the ``--prefix``
parameter explicitly in ``configure-options``.
``share``
Specify the path in which this package is shared by many other
packages. When it's unset or blank, it means the package isn't
shared. Otherwise, it shared by many packages. Recipe will return
an empty list so that buildout will not uninstall the package when
uninstalling part.
In share mode, ``promises`` should be set so that recipe can tell
whether the package is installed. Otherwise nohting to do.
This option is experiment now. Recipe doesn't try to set prefix
with the valule of this opton in the configure or make command,
you should specify them accordingly by yourself.
``md5sum``
MD5 checksum for the package file. If available the MD5
...
...
@@ -212,11 +227,7 @@ Supported options
the former will be overridden by the latter allowing per-part customization.
The recipe uses separated part to support custom options in different
platforms. These platform's part has a pattern "platform-part" or
"arch-platform-part".
arch could be 'x86', 'x86_64', 'ia64' ... which equals
platform.machine().
platforms. These platform's part has a pattern "part:platform".
platform could be 'linux', 'cygwin', 'macos', 'sunos', 'freebsd',
'netbsd', 'unixware' ... which equals a formatted sys.platform.
...
...
@@ -226,10 +237,10 @@ For example,
[bzip2]
recipe = slapos.recipe.cmmi
[
x86-cygwin-bzip2
]
[
bzip2:cygwin
]
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
and search again, if still found nothing. Use no platform part.
...
...
@@ -361,7 +372,7 @@ a custom location within the buildout::
... """ % src)
>>> print(system(buildout))
Uninstalling package.
Uninstalling package
x
.
Installing foobar.
foobar: [ENV] TMP = /sample_buildout/parts/foobar/tmp
foobar: Extracting package to /sample_buildout/parts/foobar__compile__
...
...
@@ -660,7 +671,7 @@ The recipe can specify build options for each platform. For example,
... pre-configure = echo "Configure in common platform"
... post-install = echo "Finished."
...
... [
cygwin-package
]
... [
package:cygwin
]
... pre-configure = echo "Configure in the CYGWIN platform"
... pre-install = echo "Installing in the CYGWIN"
... post-install = echo -n "CYGWIN " && ${package:post-install}
...
...
@@ -683,7 +694,7 @@ are only ``pre-configure`` and ``post-install``. the output will be
Finished.
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)
Uninstalling package.
...
...
@@ -700,14 +711,6 @@ and 'cygwin-package'. The output will be
package: Executing post-install
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
============
...
...
@@ -1062,6 +1065,53 @@ Look, "package" is reinstalled either:
building package
installing package
Install share package
=====================
Use option ``share`` to install a share pacakge.
>>> write('buildout.cfg',
... """
... [buildout]
... newest = false
... parts = package
...
... [package]
... recipe = slapos.recipe.cmmi
... url = file://%s/package-0.0.0.tar.gz
... share = /usr/local/bin
... promises = ${:share}/mypackage.exe
... """ % (src,))
>>> print system(buildout)
Uninstalling package.
Uninstalling package-2.
Installing package.
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__
configure --prefix=/sample_buildout/parts/package
building package
installing package
package: could not find promise "/usr/local/bin/mypackage.exe"
Do nothing if one package has been installed.
>>> write('buildout.cfg',
... """
... [buildout]
... newest = false
... parts = package
...
... [package]
... recipe = slapos.recipe.cmmi
... url = file://%s/package-0.0.0.tar.gz
... share = /usr/local/bin
... promises =
... """ % (src,))
>>> print system(buildout)
Uninstalling package.
Installing package.
package: This shared package has been installed by other package
For even more specific needs you can write your own recipe that uses
``slapos.recipe.cmmi`` and set the ``keep-compile-dir`` option to ``true``.
You can then continue from where this recipe finished by reading the location
...
...
slapos/recipe/cmmi/__init__.py
View file @
fc93b83f
...
...
@@ -23,7 +23,7 @@ class Recipe(object):
self
.
name
=
name
# 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
:
self
.
original_options
=
options
else
:
...
...
@@ -44,7 +44,8 @@ class Recipe(object):
options
[
'url'
]
=
options
.
get
(
'url'
,
''
).
strip
()
options
[
'path'
]
=
options
.
get
(
'path'
,
''
).
strip
()
options
[
'promises'
]
=
options
.
get
(
'promises'
,
''
)
options
[
'share'
]
=
options
.
get
(
'share'
,
''
).
strip
()
# Check dependencies, all the dependent parts will be installed first. It
# seems once part is referenced, for example, self.buildout[part], it will
# be appended as an install part.
...
...
@@ -181,13 +182,13 @@ class Recipe(object):
raise
zc
.
buildout
.
UserError
(
'System error'
)
return
files
.
split
()
def
check_promises
(
self
):
def
check_promises
(
self
,
log
=
None
):
result
=
True
log
=
logging
.
getLogger
(
self
.
name
)
for
path
in
self
.
options
[
'promises'
].
splitlines
():
if
not
os
.
path
.
exists
(
path
):
result
=
False
log
.
warning
(
'could not find promise "%s"'
%
path
)
if
log
is
not
None
:
log
.
warning
(
'could not find promise "%s"'
%
path
)
return
result
def
call_script
(
self
,
script
):
...
...
@@ -232,6 +233,11 @@ class Recipe(object):
log
=
logging
.
getLogger
(
self
.
name
)
parts
=
[]
# In share mode, do nothing if package has been installed.
if
(
not
self
.
options
[
'share'
]
==
''
)
and
self
.
check_promises
():
log
.
info
(
'This shared package has been installed by other package'
)
return
parts
make_cmd
=
self
.
options
.
get
(
'make-binary'
,
'make'
).
strip
()
make_options
=
' '
.
join
(
self
.
options
.
get
(
'make-options'
,
''
).
split
())
make_targets
=
' '
.
join
(
self
.
options
.
get
(
'make-targets'
,
'install'
).
split
())
...
...
@@ -341,7 +347,9 @@ class Recipe(object):
if
post_install_cmd
!=
''
:
log
.
info
(
'Executing post-install'
)
self
.
run
(
post_install_cmd
)
if
self
.
buildout_prefix
!=
''
and
os
.
path
.
exists
(
self
.
buildout_prefix
):
if
(
self
.
buildout_prefix
!=
''
and
self
.
options
[
'share'
]
==
''
and
os
.
path
.
exists
(
self
.
buildout_prefix
)):
log
.
info
(
'Getting installed file lists'
)
parts
.
extend
(
self
.
get_installed_files
(
tmp_path
))
except
:
...
...
@@ -353,7 +361,7 @@ class Recipe(object):
shutil
.
rmtree
(
tmp_path
)
# Check promises
self
.
check_promises
()
self
.
check_promises
(
log
)
if
self
.
options
[
'url'
]:
if
self
.
options
.
get
(
'keep-compile-dir'
,
...
...
@@ -366,5 +374,6 @@ class Recipe(object):
shutil
.
rmtree
(
compile_dir
)
del
self
.
options
[
'compile-directory'
]
parts
.
append
(
self
.
options
[
'location'
])
if
self
.
options
[
'share'
]
==
''
:
parts
.
append
(
self
.
options
[
'location'
])
return
parts
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment