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
d6ddf139
Commit
d6ddf139
authored
Jul 11, 2013
by
Jondy Zhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set the value of 'location' as 'share' in case 'share' is not blank
parent
ae9f451f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
18 deletions
+26
-18
slapos/recipe/cmmi/README.txt
slapos/recipe/cmmi/README.txt
+9
-4
slapos/recipe/cmmi/__init__.py
slapos/recipe/cmmi/__init__.py
+17
-14
No files found.
slapos/recipe/cmmi/README.txt
View file @
d6ddf139
...
@@ -37,6 +37,11 @@ Supported options
...
@@ -37,6 +37,11 @@ Supported options
In share mode, ``promises`` should be set so that recipe can tell
In share mode, ``promises`` should be set so that recipe can tell
whether the package is installed. Otherwise nohting to do.
whether the package is installed. Otherwise nohting to do.
If ``share`` is not empty, ``location`` will be set to value of
``share``, and remove trailing '/'. So in case ``share`` is '/',
``location`` will be set to blank. Thus any reference like
"${part:location}/bin" in other parts will get the correct value.
This option is experiment now. Recipe doesn't try to set prefix
This option is experiment now. Recipe doesn't try to set prefix
with the valule of this opton in the configure or make command,
with the valule of this opton in the configure or make command,
you should specify them accordingly by yourself.
you should specify them accordingly by yourself.
...
@@ -1078,19 +1083,19 @@ Use option ``share`` to install a share pacakge.
...
@@ -1078,19 +1083,19 @@ 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
/bin
... share = /usr/local
... promises = ${:share}/mypackage.exe
... promises = ${:share}/
bin/
mypackage.exe
... """ % (src,))
... """ % (src,))
>>> print system(buildout)
>>> print system(buildout)
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
/bin
package: Checking whether package is installed at share path: /usr/local
package: could not find promise "/usr/local/bin/mypackage.exe"
package: could not find promise "/usr/local/bin/mypackage.exe"
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__
package: Extracting package to /sample_buildout/parts/package__compile__
configure --prefix=/
sample_buildout/parts/package
configure --prefix=/
usr/local
building package
building package
installing package
installing package
package: could not find promise "/usr/local/bin/mypackage.exe"
package: could not find promise "/usr/local/bin/mypackage.exe"
...
...
slapos/recipe/cmmi/__init__.py
View file @
d6ddf139
...
@@ -30,9 +30,13 @@ class Recipe(object):
...
@@ -30,9 +30,13 @@ class Recipe(object):
self
.
original_options
=
options
.
copy
()
self
.
original_options
=
options
.
copy
()
options
.
update
(
platform_options
)
options
.
update
(
platform_options
)
options
[
'location'
]
=
os
.
path
.
join
(
options
[
'share'
]
=
options
.
get
(
'share'
,
''
).
strip
()
options
[
'default-location'
]
=
os
.
path
.
join
(
buildout
[
'buildout'
][
'parts-directory'
],
buildout
[
'buildout'
][
'parts-directory'
],
self
.
name
)
self
.
name
)
share
=
options
[
'share'
]
options
[
'location'
]
=
options
[
'default-location'
]
if
share
==
''
else
share
.
rstrip
(
'/'
)
prefix
=
options
.
get
(
'prefix'
,
''
).
strip
()
prefix
=
options
.
get
(
'prefix'
,
''
).
strip
()
if
prefix
==
''
:
if
prefix
==
''
:
prefix
=
self
.
buildout_prefix
=
buildout
[
'buildout'
].
get
(
'prefix'
,
''
).
strip
()
prefix
=
self
.
buildout_prefix
=
buildout
[
'buildout'
].
get
(
'prefix'
,
''
).
strip
()
...
@@ -44,7 +48,6 @@ class Recipe(object):
...
@@ -44,7 +48,6 @@ class Recipe(object):
options
[
'url'
]
=
options
.
get
(
'url'
,
''
).
strip
()
options
[
'url'
]
=
options
.
get
(
'url'
,
''
).
strip
()
options
[
'path'
]
=
options
.
get
(
'path'
,
''
).
strip
()
options
[
'path'
]
=
options
.
get
(
'path'
,
''
).
strip
()
options
[
'promises'
]
=
options
.
get
(
'promises'
,
''
)
options
[
'promises'
]
=
options
.
get
(
'promises'
,
''
)
options
[
'share'
]
=
options
.
get
(
'share'
,
''
).
strip
()
# Check dependencies, all the dependent parts will be installed first. It
# Check dependencies, all the dependent parts will be installed first. It
# seems once part is referenced, for example, self.buildout[part], it will
# seems once part is referenced, for example, self.buildout[part], it will
...
@@ -71,7 +74,7 @@ class Recipe(object):
...
@@ -71,7 +74,7 @@ class Recipe(object):
raise
zc
.
buildout
.
UserError
(
'You must provide either "url" or "path".'
)
raise
zc
.
buildout
.
UserError
(
'You must provide either "url" or "path".'
)
if
options
[
'url'
]:
if
options
[
'url'
]:
options
[
'compile-directory'
]
=
'%s__compile__'
%
options
[
'location'
]
options
[
'compile-directory'
]
=
'%s__compile__'
%
options
[
'
default-
location'
]
else
:
else
:
options
[
'compile-directory'
]
=
options
[
'path'
]
options
[
'compile-directory'
]
=
options
[
'path'
]
...
@@ -101,7 +104,7 @@ class Recipe(object):
...
@@ -101,7 +104,7 @@ class Recipe(object):
# environment.
# environment.
for
key
in
self
.
environ
:
for
key
in
self
.
environ
:
self
.
environ
[
key
]
=
self
.
environ
[
key
]
%
os
.
environ
self
.
environ
[
key
]
=
self
.
environ
[
key
]
%
os
.
environ
self
.
environ
[
'TMP'
]
=
os
.
path
.
join
(
options
[
'location'
],
'tmp'
)
self
.
environ
[
'TMP'
]
=
os
.
path
.
join
(
options
[
'
default-
location'
],
'tmp'
)
def
augmented_environment
(
self
):
def
augmented_environment
(
self
):
"""Returns a dictionary containing the current environment variables
"""Returns a dictionary containing the current environment variables
...
@@ -286,7 +289,7 @@ class Recipe(object):
...
@@ -286,7 +289,7 @@ class Recipe(object):
current_dir
=
os
.
getcwd
()
current_dir
=
os
.
getcwd
()
try
:
try
:
os
.
mkdir
(
self
.
options
[
'location'
])
os
.
mkdir
(
self
.
options
[
'
default-
location'
])
except
OSError
as
e
:
except
OSError
as
e
:
if
e
.
errno
==
errno
.
EEXIST
:
if
e
.
errno
==
errno
.
EEXIST
:
pass
pass
...
@@ -377,5 +380,5 @@ class Recipe(object):
...
@@ -377,5 +380,5 @@ class Recipe(object):
del
self
.
options
[
'compile-directory'
]
del
self
.
options
[
'compile-directory'
]
if
self
.
options
[
'share'
]
==
''
:
if
self
.
options
[
'share'
]
==
''
:
parts
.
append
(
self
.
options
[
'location'
])
parts
.
append
(
self
.
options
[
'
default-
location'
])
return
parts
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