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
8c99c1ac
Commit
8c99c1ac
authored
Apr 10, 2013
by
Jondy Zhao
Committed by
Cédric de Saint Martin
Apr 12, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add option 'share'.
parent
55575006
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
7 deletions
+78
-7
slapos/recipe/cmmi/README.txt
slapos/recipe/cmmi/README.txt
+62
-0
slapos/recipe/cmmi/__init__.py
slapos/recipe/cmmi/__init__.py
+16
-7
No files found.
slapos/recipe/cmmi/README.txt
View file @
8c99c1ac
...
...
@@ -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
...
...
@@ -1062,6 +1077,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 @
8c99c1ac
...
...
@@ -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