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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xavier Thompson
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
Hide 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):
...
@@ -44,10 +44,7 @@ class Recipe(object):
platform_options
=
buildout
.
get
(
platform_options
=
buildout
.
get
(
"%s:%s:%s"
%
(
name
,
sys
.
platform
,
self
.
get_machine
()),
"%s:%s:%s"
%
(
name
,
sys
.
platform
,
self
.
get_machine
()),
buildout
.
get
(
"%s:%s"
%
(
name
,
sys
.
platform
)))
buildout
.
get
(
"%s:%s"
%
(
name
,
sys
.
platform
)))
if
platform_options
is
None
:
if
platform_options
is
not
None
:
self
.
original_options
=
options
else
:
self
.
original_options
=
options
.
copy
()
options
.
update
(
platform_options
)
options
.
update
(
platform_options
)
environment_section
=
options
.
get
(
'environment-section'
)
environment_section
=
options
.
get
(
'environment-section'
)
...
@@ -92,28 +89,24 @@ class Recipe(object):
...
@@ -92,28 +89,24 @@ class Recipe(object):
buildout
[
'buildout'
][
'parts-directory'
],
buildout
[
'buildout'
][
'parts-directory'
],
self
.
name
)
self
.
name
)
prefix
=
options
.
get
(
'prefix'
,
''
).
strip
()
self
.
buildout_prefix
=
''
if
prefix
==
''
:
prefix
=
options
.
get
(
'prefix'
)
prefix
=
self
.
buildout_prefix
=
buildout
[
'buildout'
].
get
(
'prefix'
,
''
).
strip
()
if
not
prefix
:
if
'cygwin'
!=
sys
.
platform
:
prefix
=
buildout
[
'buildout'
].
get
(
'prefix'
)
self
.
buildout_prefix
=
''
if
prefix
and
'cygwin'
==
sys
.
platform
:
else
:
self
.
buildout_prefix
=
prefix
self
.
buildout_prefix
=
''
options
[
'prefix'
]
=
prefix
or
location
options
[
'prefix'
]
=
prefix
or
location
options
[
'url'
]
=
options
.
get
(
'url'
,
''
).
strip
()
url
=
options
.
get
(
'url'
)
options
[
'path'
]
=
options
.
get
(
'path'
,
''
).
strip
()
path
=
options
.
get
(
'path'
)
options
[
'promises'
]
=
options
.
get
(
'promises'
,
''
)
if
url
:
options
[
'strip-top-level-dir'
]
=
options
.
get
(
'strip-top-level-dir'
,
'false'
).
strip
()
if
path
:
raise
UserError
(
'You must provide either "url" or "path".'
)
if
options
[
'url'
]
and
options
[
'path'
]:
raise
UserError
(
'You must use either "url" or "path", not both!'
)
if
not
(
options
[
'url'
]
or
options
[
'path'
]):
raise
UserError
(
'You must provide either "url" or "path".'
)
if
options
[
'url'
]:
options
[
'compile-directory'
]
=
os
.
path
.
join
(
location
,
'.build'
)
options
[
'compile-directory'
]
=
os
.
path
.
join
(
location
,
'.build'
)
elif
path
:
options
[
'compile-directory'
]
=
path
else
:
else
:
options
[
'compile-directory'
]
=
options
[
'path'
]
raise
UserError
(
'You must use either "url" or "path", not both!'
)
for
k
,
v
in
list
(
options
.
items
()):
for
k
,
v
in
list
(
options
.
items
()):
if
'@@LOCATION@@'
in
v
:
if
'@@LOCATION@@'
in
v
:
...
@@ -205,7 +198,7 @@ class Recipe(object):
...
@@ -205,7 +198,7 @@ class Recipe(object):
def
check_promises
(
self
):
def
check_promises
(
self
):
result
=
True
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
):
if
path
and
not
os
.
path
.
exists
(
path
):
result
=
False
result
=
False
self
.
logger
.
warning
(
'could not find promise %r'
,
path
)
self
.
logger
.
warning
(
'could not find promise %r'
,
path
)
...
@@ -298,6 +291,7 @@ class Recipe(object):
...
@@ -298,6 +291,7 @@ class Recipe(object):
log
.
info
(
'[ENV] %s = %s'
,
key
,
self
.
environ
[
key
])
log
.
info
(
'[ENV] %s = %s'
,
key
,
self
.
environ
[
key
])
current_dir
=
os
.
getcwd
()
current_dir
=
os
.
getcwd
()
url
=
self
.
options
.
get
(
'url'
)
compile_dir
=
self
.
options
[
'compile-directory'
]
compile_dir
=
self
.
options
[
'compile-directory'
]
location
=
self
.
options
[
'location'
]
location
=
self
.
options
[
'location'
]
# Clean the install directory if it already exists as it is
# Clean the install directory if it already exists as it is
...
@@ -308,13 +302,15 @@ class Recipe(object):
...
@@ -308,13 +302,15 @@ class Recipe(object):
try
:
try
:
os
.
makedirs
(
location
)
os
.
makedirs
(
location
)
# Download the source using slapos.recipe.downloadunpacked
# Download the source using slapos.recipe.downloadunpacked
if
self
.
options
[
'url'
]
:
if
url
:
os
.
mkdir
(
compile_dir
)
os
.
mkdir
(
compile_dir
)
self
.
options
.
get
(
'md5sum'
)
# so that buildout does not complain "unused option md5sum"
self
.
options
.
get
(
'md5sum'
)
# so that buildout does not complain "unused option md5sum"
opt
=
self
.
options
.
copy
()
opt
=
self
.
options
.
copy
()
opt
[
'destination'
]
=
compile_dir
opt
[
'destination'
]
=
compile_dir
# no need to shared build for compile dir
# no need to shared build for compile dir
opt
[
'shared'
]
=
'false'
opt
[
'shared'
]
=
'false'
opt
[
'strip-top-level-dir'
]
=
opt
.
get
(
'strip-top-level-dir'
)
or
'false'
downloadunpacked
.
Recipe
(
self
.
buildout
,
self
.
name
,
opt
).
install
()
downloadunpacked
.
Recipe
(
self
.
buildout
,
self
.
name
,
opt
).
install
()
else
:
else
:
log
.
info
(
'Using local source directory: %s'
,
compile_dir
)
log
.
info
(
'Using local source directory: %s'
,
compile_dir
)
...
@@ -408,7 +404,7 @@ echo %s
...
@@ -408,7 +404,7 @@ echo %s
finally
:
finally
:
os
.
chdir
(
current_dir
)
os
.
chdir
(
current_dir
)
if
self
.
options
[
'url'
]
:
if
url
:
if
(
self
.
options
.
get
(
'keep-compile-dir'
)
or
if
(
self
.
options
.
get
(
'keep-compile-dir'
)
or
self
.
buildout
[
'buildout'
].
get
(
'keep-compile-dir'
)
or
self
.
buildout
[
'buildout'
].
get
(
'keep-compile-dir'
)
or
''
).
lower
()
not
in
(
'true'
,
'yes'
,
'1'
,
'on'
):
''
).
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