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
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
slapos.recipe.cmmi
Commits
d6fe5d64
Commit
d6fe5d64
authored
Sep 23, 2021
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up reading of options
In particular, buildout already strips values.
parent
509ee4a0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
27 deletions
+23
-27
slapos/recipe/cmmi/__init__.py
slapos/recipe/cmmi/__init__.py
+23
-27
No files found.
slapos/recipe/cmmi/__init__.py
View file @
d6fe5d64
...
...
@@ -44,10 +44,7 @@ class Recipe(object):
platform_options
=
buildout
.
get
(
"%s:%s:%s"
%
(
name
,
sys
.
platform
,
self
.
get_machine
()),
buildout
.
get
(
"%s:%s"
%
(
name
,
sys
.
platform
)))
if
platform_options
is
None
:
self
.
original_options
=
options
else
:
self
.
original_options
=
options
.
copy
()
if
platform_options
is
not
None
:
options
.
update
(
platform_options
)
environment_section
=
options
.
get
(
'environment-section'
)
...
...
@@ -92,28 +89,24 @@ class Recipe(object):
buildout
[
'buildout'
][
'parts-directory'
],
self
.
name
)
prefix
=
options
.
get
(
'prefix'
,
''
).
strip
()
if
prefix
==
''
:
prefix
=
self
.
buildout_prefix
=
buildout
[
'buildout'
].
get
(
'prefix'
,
''
).
strip
()
if
'cygwin'
!=
sys
.
platform
:
self
.
buildout_prefix
=
''
else
:
self
.
buildout_prefix
=
''
prefix
=
options
.
get
(
'prefix'
)
if
not
prefix
:
prefix
=
buildout
[
'buildout'
].
get
(
'prefix'
)
if
prefix
and
'cygwin'
==
sys
.
platform
:
self
.
buildout_prefix
=
prefix
options
[
'prefix'
]
=
prefix
or
location
options
[
'url'
]
=
options
.
get
(
'url'
,
''
).
strip
()
options
[
'path'
]
=
options
.
get
(
'path'
,
''
).
strip
()
options
[
'promises'
]
=
options
.
get
(
'promises'
,
''
)
options
[
'strip-top-level-dir'
]
=
options
.
get
(
'strip-top-level-dir'
,
'false'
).
strip
()
if
options
[
'url'
]
and
options
[
'path'
]:
raise
UserError
(
'You must use either "url" or "path", not both!'
)
if
not
(
options
[
'url'
]
or
options
[
'path'
]):
url
=
options
.
get
(
'url'
)
path
=
options
.
get
(
'path'
)
if
url
:
if
path
:
raise
UserError
(
'You must provide either "url" or "path".'
)
if
options
[
'url'
]:
options
[
'compile-directory'
]
=
os
.
path
.
join
(
location
,
'.build'
)
elif
path
:
options
[
'compile-directory'
]
=
path
else
:
options
[
'compile-directory'
]
=
options
[
'path'
]
raise
UserError
(
'You must use either "url" or "path", not both!'
)
for
k
,
v
in
list
(
options
.
items
()):
if
'@@LOCATION@@'
in
v
:
...
...
@@ -205,7 +198,7 @@ class Recipe(object):
def
check_promises
(
self
):
result
=
True
for
path
in
self
.
options
[
'promises'
]
.
splitlines
():
for
path
in
self
.
options
.
get
(
'promises'
,
''
)
.
splitlines
():
if
path
and
not
os
.
path
.
exists
(
path
):
result
=
False
self
.
logger
.
warning
(
'could not find promise %r'
,
path
)
...
...
@@ -298,6 +291,7 @@ class Recipe(object):
log
.
info
(
'[ENV] %s = %s'
,
key
,
self
.
environ
[
key
])
current_dir
=
os
.
getcwd
()
url
=
self
.
options
.
get
(
'url'
)
compile_dir
=
self
.
options
[
'compile-directory'
]
location
=
self
.
options
[
'location'
]
# Clean the install directory if it already exists as it is
...
...
@@ -308,13 +302,15 @@ class Recipe(object):
try
:
os
.
makedirs
(
location
)
# Download the source using slapos.recipe.downloadunpacked
if
self
.
options
[
'url'
]
:
if
url
:
os
.
mkdir
(
compile_dir
)
self
.
options
.
get
(
'md5sum'
)
# so that buildout does not complain "unused option md5sum"
opt
=
self
.
options
.
copy
()
opt
[
'destination'
]
=
compile_dir
# no need to shared build for compile dir
opt
[
'shared'
]
=
'false'
opt
[
'strip-top-level-dir'
]
=
opt
.
get
(
'strip-top-level-dir'
)
or
'false'
downloadunpacked
.
Recipe
(
self
.
buildout
,
self
.
name
,
opt
).
install
()
else
:
log
.
info
(
'Using local source directory: %s'
,
compile_dir
)
...
...
@@ -408,7 +404,7 @@ echo %s
finally
:
os
.
chdir
(
current_dir
)
if
self
.
options
[
'url'
]
:
if
url
:
if
(
self
.
options
.
get
(
'keep-compile-dir'
)
or
self
.
buildout
[
'buildout'
].
get
(
'keep-compile-dir'
)
or
''
).
lower
()
not
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