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
4f14e1ff
Commit
4f14e1ff
authored
Sep 21, 2021
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up usage of logging module
parent
9c0113de
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
15 deletions
+13
-15
slapos/recipe/cmmi/README.rst
slapos/recipe/cmmi/README.rst
+1
-1
slapos/recipe/cmmi/__init__.py
slapos/recipe/cmmi/__init__.py
+12
-14
No files found.
slapos/recipe/cmmi/README.rst
View file @
4f14e1ff
...
...
@@ -330,7 +330,7 @@ default build options.
configure --prefix=/sample_buildout/parts/packagex
building package
installing package
packagex: could not find promise
"/usr/bin/myfoo"
packagex: could not find promise
'
/
usr
/
bin
/
myfoo
'
<BLANKLINE>
As we can see the configure script was called with the ``--prefix``
...
...
slapos/recipe/cmmi/__init__.py
View file @
4f14e1ff
...
...
@@ -46,7 +46,7 @@ class Recipe(object):
self
.
options
=
options
self
.
buildout
=
buildout
self
.
name
=
name
log
=
logging
.
getLogger
(
self
.
name
)
self
.
logger
=
logging
.
getLogger
(
self
.
name
)
# Merge options if there is a matched platform section
platform_options
=
buildout
.
get
(
"%s:%s:%s"
%
(
name
,
sys
.
platform
,
self
.
get_machine
()),
...
...
@@ -90,7 +90,7 @@ class Recipe(object):
signature_digest
)
if
os
.
path
.
exists
(
shared
):
break
log
.
info
(
'shared at %s'
,
shared
)
self
.
logger
.
info
(
'shared at %s'
,
shared
)
else
:
shared
=
''
...
...
@@ -212,23 +212,21 @@ class Recipe(object):
# in this path which create time is newer than ref_file.
# Exclude directory and don't follow link.
assert
self
.
buildout_prefix
log
=
logging
.
getLogger
(
self
.
name
)
args
=
[
'find'
,
self
.
buildout_prefix
,
'-cnewer'
,
ref_file
,
'!'
,
'-type'
,
'd'
]
try
:
files
=
subprocess
.
check_output
(
args
,
universal_newlines
=
True
,
close_fds
=
True
)
except
Exception
as
e
:
log
.
error
(
e
)
self
.
logger
.
error
(
e
)
raise
zc
.
buildout
.
UserError
(
'System error'
)
return
files
.
splitlines
()
def
check_promises
(
self
,
log
=
None
):
def
check_promises
(
self
):
result
=
True
log
=
logging
.
getLogger
(
self
.
name
)
for
path
in
self
.
options
[
'promises'
].
splitlines
():
if
path
and
not
os
.
path
.
exists
(
path
):
result
=
False
log
.
warning
(
'could not find promise "%s"'
%
path
)
self
.
logger
.
warning
(
'could not find promise %r'
,
path
)
return
result
def
call_script
(
self
,
script
):
...
...
@@ -255,16 +253,15 @@ class Recipe(object):
def
run
(
self
,
cmd
):
"""Run the given ``cmd`` in a child process."""
log
=
logging
.
getLogger
(
self
.
name
)
try
:
subprocess
.
check_call
(
'set -e;'
+
cmd
,
shell
=
True
,
env
=
self
.
augmented_environment
(),
close_fds
=
True
)
except
Exception
as
e
:
log
.
error
(
e
)
self
.
logger
.
error
(
e
)
raise
zc
.
buildout
.
UserError
(
'System error'
)
def
install
(
self
):
log
=
logging
.
getLogger
(
self
.
name
)
log
=
self
.
logger
parts
=
[]
# In shared mode, do nothing if package has been installed.
...
...
@@ -312,7 +309,7 @@ class Recipe(object):
compile_dir
=
self
.
options
[
'compile-directory'
]
if
os
.
path
.
exists
(
compile_dir
):
# leftovers from a previous failed attempt, removing it.
log
.
warning
(
'Removing already existing directory %s'
%
compile_dir
)
log
.
warning
(
'Removing already existing directory %s'
,
compile_dir
)
shutil
.
rmtree
(
compile_dir
)
os
.
makedirs
(
compile_dir
)
try
:
...
...
@@ -327,7 +324,7 @@ class Recipe(object):
shutil
.
rmtree
(
compile_dir
)
raise
else
:
log
.
info
(
'Using local source directory: %s'
%
self
.
options
[
'path'
])
log
.
info
(
'Using local source directory: %s'
,
self
.
options
[
'path'
])
compile_dir
=
self
.
options
[
'path'
]
current_dir
=
os
.
getcwd
()
...
...
@@ -420,7 +417,8 @@ echo %s
log
.
error
(
'Compilation error. The package is left as is at %s where '
'you can inspect what went wrong.
\
n
'
'A shell script slapos.recipe.build.env.sh has been generated. '
'You can source it in your shell to reproduce build environment.'
%
os
.
getcwd
())
'You can source it in your shell to reproduce build environment.'
,
os
.
getcwd
())
# Delete shared directory if not correctly installed
if
self
.
options
.
get
(
'shared'
):
...
...
@@ -433,7 +431,7 @@ echo %s
self
.
_signature
.
save
(
self
.
options
[
"shared"
])
# Check promises
self
.
check_promises
(
log
)
self
.
check_promises
()
if
self
.
options
[
'url'
]:
if
self
.
options
.
get
(
'keep-compile-dir'
,
...
...
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