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
12a26264
Commit
12a26264
authored
Apr 09, 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 'promises'
parent
864e286f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
2 deletions
+50
-2
slapos/recipe/cmmi/README.txt
slapos/recipe/cmmi/README.txt
+36
-1
slapos/recipe/cmmi/__init__.py
slapos/recipe/cmmi/__init__.py
+14
-1
No files found.
slapos/recipe/cmmi/README.txt
View file @
12a26264
...
...
@@ -158,6 +158,14 @@ Supported options
compile directory is stored in ``options['compile-directory']``.
Accepted values are ``true`` or ``false``, defaults to ``false``.
``promises``
List the pathes and files should be existed after install part. The
file or path must be absolute path. One line one item
If any item doesn't exist, the recipe shows a warning message. The
default value is empty.
``dependencies``
List all the depended parts:
...
...
@@ -279,7 +287,7 @@ Let's create a buildout to build and install the package.
>>> write('buildout.cfg',
... """
... [buildout]
... newest =
fals
e
... newest =
tru
e
... parts = package
...
... [package]
...
...
@@ -298,6 +306,33 @@ default build options.
building package
installing package
Check option "promises"
>>> write('buildout.cfg',
... """
... [buildout]
... newest = false
... parts = packagex
...
... [packagex]
... recipe = slapos.recipe.cmmi
... url = file://%s/package-0.0.0.tar.gz
... promises = /usr/bin/myfoo
... """ % src)
This will download, extract and build our demo package with the
default build options.
>>> print system(buildout)
Uninstalling package.
Installing packagex.
packagex: [ENV] TMP = /sample_buildout/parts/packagex/tmp
packagex: Extracting package to /sample_buildout/parts/packagex__compile__
configure --prefix=/sample_buildout/parts/packagex
building package
installing package
packagex: could not find promise "/usr/bin/myfoo"
As we can see the configure script was called with the ``--prefix``
option by default followed by calls to ``make`` and ``make install``.
...
...
slapos/recipe/cmmi/__init__.py
View file @
12a26264
...
...
@@ -43,6 +43,7 @@ class Recipe(object):
options
[
'prefix'
]
=
options
[
'location'
]
if
prefix
==
''
else
prefix
options
[
'url'
]
=
options
.
get
(
'url'
,
''
).
strip
()
options
[
'path'
]
=
options
.
get
(
'path'
,
''
).
strip
()
options
[
'promises'
]
=
options
.
get
(
'promises'
,
''
)
# Check dependencies, all the dependent parts will be installed first. It
# seems once part is referenced, for example, self.buildout[part], it will
...
...
@@ -179,7 +180,16 @@ class Recipe(object):
log
.
error
(
'Command failed: %s: %s'
%
(
e
,
cmd
))
raise
zc
.
buildout
.
UserError
(
'System error'
)
return
files
.
split
()
def
check_promises
(
self
):
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
)
return
result
def
call_script
(
self
,
script
):
"""This method is copied from z3c.recipe.runscript.
...
...
@@ -342,6 +352,9 @@ class Recipe(object):
os
.
chdir
(
current_dir
)
shutil
.
rmtree
(
tmp_path
)
# Check promises
self
.
check_promises
()
if
self
.
options
[
'url'
]:
if
self
.
options
.
get
(
'keep-compile-dir'
,
self
.
buildout
[
'buildout'
].
get
(
'keep-compile-dir'
,
''
)).
lower
()
in
(
'true'
,
'yes'
,
'1'
,
'on'
):
...
...
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