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
88f8884b
Commit
88f8884b
authored
Apr 23, 2020
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos.recipe.build.env.sh improvements/fixes
parent
3d5cb514
Pipeline
#9085
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
13 deletions
+40
-13
slapos/recipe/cmmi/__init__.py
slapos/recipe/cmmi/__init__.py
+40
-13
No files found.
slapos/recipe/cmmi/__init__.py
View file @
88f8884b
...
...
@@ -22,6 +22,23 @@ except:
options
=
Options
({},
"options"
,
options
)
return
options
.
query_bool
(
name
,
defaults
)
startup_environ
=
os
.
environ
.
copy
()
# backport of shlex.quote from Python 3.3
_find_unsafe
=
re
.
compile
(
r'[^\
w@%+=:,./-]
', 256).search
def quote(s):
"""Return a shell-escaped version of the string *s*."""
if not s:
return "''"
if _find_unsafe(s) is None:
return s
# use single quotes, and put single quotes into double quotes
# the string $'
b
is
then
quoted
as
'$'"'"'b'
return
"'"
+
s
.
replace
(
"'"
,
"'
\
"
'
\
"
'"
)
+
"'"
###
class
Recipe
(
object
):
"""zc.buildout recipe for compiling and installing software"""
...
...
@@ -277,6 +294,10 @@ class Recipe(object):
elif
make_cmd
==
'make'
and
make_targets
==
'install'
:
make_targets
+=
' prefix=
\
"
%s
\
"
'
%
self
.
options
[
'prefix'
]
configure_cmd
=
'%s %s'
%
(
configure_cmd
,
' '
.
join
(
configure_options
))
%
self
.
options
install_cmd
=
'%s %s %s'
%
(
make_cmd
,
make_options
,
make_targets
)
%
self
.
options
make_cmd
=
'%s %s'
%
(
make_cmd
,
make_options
)
%
self
.
options
patch_cmd
=
self
.
options
.
get
(
'patch-binary'
,
'patch'
).
strip
()
patch_options
=
' '
.
join
(
self
.
options
.
get
(
'patch-options'
,
'-p0'
).
split
())
patches
=
self
.
options
.
get
(
'patches'
,
''
).
split
()
...
...
@@ -343,7 +364,7 @@ class Recipe(object):
log
.
info
(
'Executing pre-configure'
)
self
.
run
(
pre_configure_cmd
)
self
.
run
(
(
'%s %s'
%
(
configure_cmd
,
' '
.
join
(
configure_options
)))
%
self
.
options
)
self
.
run
(
configure_cmd
)
if
'pre-make-hook'
in
self
.
options
and
len
(
self
.
options
[
'pre-make-hook'
].
strip
())
>
0
:
log
.
info
(
'Executing pre-make-hook'
)
...
...
@@ -354,14 +375,14 @@ class Recipe(object):
log
.
info
(
'Executing pre-build'
)
self
.
run
(
pre_build_cmd
)
self
.
run
(
(
'%s %s'
%
(
make_cmd
,
make_options
))
%
self
.
options
)
self
.
run
(
make_cmd
)
pre_install_cmd
=
self
.
options
.
get
(
'pre-install'
,
''
).
strip
()
%
self
.
options
if
pre_install_cmd
!=
''
:
log
.
info
(
'Executing pre-install'
)
self
.
run
(
pre_install_cmd
)
self
.
run
(
(
'%s %s %s'
%
(
make_cmd
,
make_options
,
make_targets
))
%
self
.
options
)
self
.
run
(
install_cmd
)
if
'post-make-hook'
in
self
.
options
and
len
(
self
.
options
[
'post-make-hook'
].
strip
())
>
0
:
log
.
info
(
'Executing post-make-hook'
)
...
...
@@ -379,16 +400,22 @@ class Recipe(object):
except
:
with
open
(
'slapos.recipe.build.env.sh'
,
'w'
)
as
env_script
:
for
key
,
v
in
sorted
(
self
.
environ
.
items
()):
if
key
not
in
(
'TEMP'
,
'TMP'
,
'TMPDIR'
):
env_script
.
write
(
'export %s="%s"
\
n
'
%
(
key
,
v
))
env_script
.
write
(
'echo "If this recipe does not use pre/post hooks or commands, you can re-run as below."
\
n
'
)
env_script
.
write
(
'echo "configure with:"
\
n
'
)
env_script
.
write
(
'echo " %s %s"
\
n
'
%
(
configure_cmd
,
' '
.
join
(
configure_options
))
%
self
.
options
)
env_script
.
write
(
'echo ""
\
n
'
)
env_script
.
write
(
'echo "make with:"
\
n
'
)
env_script
.
write
(
'echo " %s %s"
\
n
'
%
(
make_cmd
,
make_options
)
%
self
.
options
)
for
key
,
v
in
sorted
(
self
.
augmented_environment
().
items
()):
if
v
!=
startup_environ
.
get
(
key
):
env_script
.
write
(
'%sexport %s=%s
\
n
'
%
(
'#'
[:
key
in
(
'TEMP'
,
'TMP'
,
'TMPDIR'
)],
key
,
quote
(
v
)))
env_script
.
write
(
'''
\
echo "If this recipe does not use pre/post hooks or commands, you can re-run as below."
echo configure with:
echo %s
echo
echo make with:
echo %s
echo
echo install with:
echo %s
'''
%
(
quote
(
" "
+
configure_cmd
),
quote
(
" "
+
make_cmd
),
quote
(
" "
+
install_cmd
)))
log
.
error
(
'Compilation error. The package is left as is at %s where '
'you can inspect what went wrong.
\
n
'
...
...
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