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
772a4579
Commit
772a4579
authored
Mar 30, 2020
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small clean-up
parent
2b2df332
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
24 deletions
+22
-24
slapos/recipe/cmmi/__init__.py
slapos/recipe/cmmi/__init__.py
+22
-24
No files found.
slapos/recipe/cmmi/__init__.py
View file @
772a4579
...
...
@@ -31,9 +31,9 @@ class Recipe(object):
self
.
name
=
name
log
=
logging
.
getLogger
(
self
.
name
)
# Merge options if there is a matched platform section
platform_options
=
self
.
buildout
.
get
(
platform_options
=
buildout
.
get
(
"%s:%s:%s"
%
(
name
,
sys
.
platform
,
self
.
get_machine
()),
self
.
buildout
.
get
(
"%s:%s"
%
(
name
,
sys
.
platform
)))
buildout
.
get
(
"%s:%s"
%
(
name
,
sys
.
platform
)))
if
platform_options
is
None
:
self
.
original_options
=
options
else
:
...
...
@@ -43,7 +43,8 @@ class Recipe(object):
shared
=
((
options
.
get
(
'shared'
,
''
).
lower
()
==
'true'
)
and
buildout
[
'buildout'
].
get
(
'shared-part-list'
,
None
))
if
shared
:
self
.
_signature
=
slapos
.
recipe
.
downloadunpacked
.
Signature
(
'.slapos.recipe.cmmi.signature'
)
self
.
_signature
=
slapos
.
recipe
.
downloadunpacked
.
Signature
(
'.slapos.recipe.cmmi.signature'
)
buildout_directory
=
buildout
[
'buildout'
][
'directory'
]
profile_base_location
=
options
.
get
(
'_profile_base_location_'
,
''
)
for
k
,
v
in
sorted
(
options
.
items
()):
...
...
@@ -52,24 +53,22 @@ class Recipe(object):
v
=
v
.
replace
(
profile_base_location
,
'${:_profile_base_location_}'
)
self
.
_signature
.
update
(
k
,
v
)
shared_parts
=
[
part
.
strip
().
rstrip
(
'/'
)
for
part
in
buildout
[
'buildout'
][
'shared-part-list'
].
splitlines
()
if
part
.
strip
()]
for
shared
in
shared_parts
:
shared
=
os
.
path
.
join
(
os
.
path
.
join
(
shared
,
self
.
name
),
self
.
_signature
.
hexdigest
())
if
os
.
path
.
exists
(
shared
):
break
else
:
shared
=
os
.
path
.
join
(
os
.
path
.
join
(
shared_parts
[
-
1
],
self
.
name
),
self
.
_signature
.
hexdigest
())
log
.
info
(
'shared directory %s set for %s'
,
shared
,
self
.
name
)
signature_digest
=
self
.
_signature
.
hexdigest
()
for
x
in
shared
.
splitlines
():
x
=
x
.
strip
().
rstrip
(
'/'
)
if
x
:
shared
=
os
.
path
.
join
(
os
.
path
.
join
(
x
,
self
.
name
),
signature_digest
)
if
os
.
path
.
exists
(
shared
):
break
log
.
info
(
'shared at %s'
,
shared
)
else
:
shared
=
''
options
[
'shared'
]
=
shared
default_location
=
options
[
'default-location'
]
=
os
.
path
.
join
(
location
=
options
[
'location'
]
=
shared
or
os
.
path
.
join
(
buildout
[
'buildout'
][
'parts-directory'
],
self
.
name
)
if
shared
==
''
else
shared
options
[
'location'
]
=
options
[
'default-location'
]
self
.
name
)
prefix
=
options
.
get
(
'prefix'
,
''
).
strip
()
if
prefix
==
''
:
...
...
@@ -78,7 +77,7 @@ class Recipe(object):
self
.
buildout_prefix
=
''
else
:
self
.
buildout_prefix
=
''
options
[
'prefix'
]
=
options
[
'location'
]
if
prefix
==
''
else
prefix
options
[
'prefix'
]
=
prefix
or
location
options
[
'url'
]
=
options
.
get
(
'url'
,
''
).
strip
()
options
[
'path'
]
=
options
.
get
(
'path'
,
''
).
strip
()
options
[
'promises'
]
=
options
.
get
(
'promises'
,
''
)
...
...
@@ -108,13 +107,13 @@ class Recipe(object):
raise
zc
.
buildout
.
UserError
(
'You must provide either "url" or "path".'
)
if
options
[
'url'
]:
options
[
'compile-directory'
]
=
'%s__compile__'
%
options
[
'default-location'
]
options
[
'compile-directory'
]
=
location
+
'__compile__'
else
:
options
[
'compile-directory'
]
=
options
[
'path'
]
for
k
,
v
in
list
(
options
.
items
()):
if
'@@LOCATION@@'
in
v
:
options
[
k
]
=
v
.
replace
(
'@@LOCATION@@'
,
default_
location
)
options
[
k
]
=
v
.
replace
(
'@@LOCATION@@'
,
location
)
self
.
environ
=
{}
self
.
original_environment
=
os
.
environ
.
copy
()
...
...
@@ -123,7 +122,7 @@ class Recipe(object):
if
environment_section
and
environment_section
in
buildout
:
# Use environment variables from the designated config section.
self
.
environ
.
update
(
buildout
[
environment_section
])
for
variable
in
self
.
options
.
get
(
'environment'
,
''
).
splitlines
():
for
variable
in
options
.
get
(
'environment'
,
''
).
splitlines
():
if
variable
.
strip
():
try
:
key
,
value
=
variable
.
split
(
'='
,
1
)
...
...
@@ -138,7 +137,7 @@ class Recipe(object):
self
.
environ
[
'CXXFLAGS'
]
=
'-I%s/include %s'
%
(
self
.
buildout_prefix
,
self
.
environ
.
get
(
'CXXFLAGS'
,
''
))
self
.
environ
[
'LDFLAGS'
]
=
'-L%s/lib %s'
%
(
self
.
buildout_prefix
,
self
.
environ
.
get
(
'LDFLAGS'
,
''
))
if
self
.
options
.
get
(
'configure-command'
,
''
).
strip
(
)
==
'cygport'
:
if
options
.
get
(
'configure-command'
)
==
'cygport'
:
self
.
environ
.
setdefault
(
'CYGCONF_PREFIX'
,
options
[
'prefix'
])
# Extrapolate the environment variables using values from the current
...
...
@@ -324,15 +323,14 @@ class Recipe(object):
compile_dir
=
self
.
options
[
'path'
]
current_dir
=
os
.
getcwd
()
location
=
self
.
options
[
'
default-
location'
]
location
=
self
.
options
[
'location'
]
# Clean the install directory if it already exists as it is
# a remain from a previous failed installation
if
os
.
path
.
exists
(
location
):
shutil
.
rmtree
(
location
)
os
.
mkdir
(
location
)
os
.
chdir
(
compile_dir
)
try
:
os
.
chdir
(
compile_dir
)
try
:
# We support packages that either extract contents to the $PWD
# or alternatively have a single directory.
...
...
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