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.build
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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
slapos.recipe.build
Commits
8934eb92
Commit
8934eb92
authored
Sep 06, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to keep directories in case of error.
Default is to remove.
parent
74d0b2bd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
slapos/recipe/build.py
slapos/recipe/build.py
+12
-3
No files found.
slapos/recipe/build.py
View file @
8934eb92
...
@@ -102,6 +102,8 @@ def guessPlatform():
...
@@ -102,6 +102,8 @@ def guessPlatform():
return
target
return
target
TRUE_LIST
=
(
'y'
,
'on'
,
'yes'
,
'true'
,
'1'
)
class
Script
:
class
Script
:
"""Free script building system"""
"""Free script building system"""
def
_checkPromise
(
self
,
promise_key
,
location
):
def
_checkPromise
(
self
,
promise_key
,
location
):
...
@@ -247,7 +249,11 @@ class Script:
...
@@ -247,7 +249,11 @@ class Script:
self
.
options
[
k
]
=
self
.
options
.
get
(
k
,
''
).
strip
()
self
.
options
[
k
]
=
self
.
options
.
get
(
k
,
''
).
strip
()
self
.
options
[
'script'
]
=
self
.
options
.
get
(
'script'
,
self
.
script
)
%
\
self
.
options
[
'script'
]
=
self
.
options
.
get
(
'script'
,
self
.
script
)
%
\
self
.
options
self
.
options
if
self
.
options
.
get
(
'keep-on-error'
,
''
).
strip
().
lower
()
in
TRUE_LIST
:
self
.
logger
.
debug
(
'Keeping directories in case of errors'
)
self
.
keep_on_error
=
True
else
:
self
.
keep_on_error
=
False
def
getEnvironment
(
self
):
def
getEnvironment
(
self
):
# prepare cool dictionary
# prepare cool dictionary
wanted_env
=
{}
wanted_env
=
{}
...
@@ -293,8 +299,11 @@ class Script:
...
@@ -293,8 +299,11 @@ class Script:
finally
:
finally
:
for
d
in
self
.
cleanup_dir_list
:
for
d
in
self
.
cleanup_dir_list
:
if
os
.
path
.
exists
(
d
):
if
os
.
path
.
exists
(
d
):
if
not
self
.
keep_on_error
:
self
.
logger
.
debug
(
'Cleanup directory %r'
%
d
)
self
.
logger
.
debug
(
'Cleanup directory %r'
%
d
)
shutil
.
rmtree
(
d
)
shutil
.
rmtree
(
d
)
else
:
self
.
logger
.
info
(
'Left directory %r as requested'
%
d
)
return
[
self
.
options
[
'location'
]]
return
[
self
.
options
[
'location'
]]
...
...
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