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
3b128565
Commit
3b128565
authored
Sep 23, 2021
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More reliable cleanup of temporary downloaded file
parent
6b76cb03
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
13 deletions
+17
-13
slapos/recipe/cmmi/__init__.py
slapos/recipe/cmmi/__init__.py
+17
-13
No files found.
slapos/recipe/cmmi/__init__.py
View file @
3b128565
...
@@ -165,17 +165,18 @@ class Recipe(object):
...
@@ -165,17 +165,18 @@ class Recipe(object):
"""
"""
url
,
callable
=
script
.
rsplit
(
':'
,
1
)
url
,
callable
=
script
.
rsplit
(
':'
,
1
)
filename
,
is_temp
=
self
.
download_file
(
url
)
filename
,
is_temp
=
self
.
download_file
(
url
)
if
not
is_temp
:
filename
=
os
.
path
.
abspath
(
filename
)
module
=
imp
.
load_source
(
'script'
,
filename
)
script
=
getattr
(
module
,
callable
.
strip
())
try
:
try
:
script
(
self
.
options
,
self
.
buildout
,
self
.
augmented_environment
())
if
not
is_temp
:
except
TypeError
:
filename
=
os
.
path
.
abspath
(
filename
)
# BBB: Support hook scripts that do not take the environment as
module
=
imp
.
load_source
(
'script'
,
filename
)
# the third parameter
script
=
getattr
(
module
,
callable
.
strip
())
script
(
self
.
options
,
self
.
buildout
)
try
:
script
(
self
.
options
,
self
.
buildout
,
self
.
augmented_environment
())
except
TypeError
:
# BBB: Support hook scripts that do not take the environment as
# the third parameter
script
(
self
.
options
,
self
.
buildout
)
finally
:
finally
:
if
is_temp
:
if
is_temp
:
os
.
remove
(
filename
)
os
.
remove
(
filename
)
...
@@ -282,9 +283,12 @@ class Recipe(object):
...
@@ -282,9 +283,12 @@ class Recipe(object):
log
.
info
(
'Applying patches'
)
log
.
info
(
'Applying patches'
)
for
patch
in
patches
:
for
patch
in
patches
:
patch_filename
,
is_temp
=
self
.
download_file
(
patch
)
patch_filename
,
is_temp
=
self
.
download_file
(
patch
)
self
.
run
(
'%s %s < %s'
%
(
patch_cmd
,
patch_options
,
patch_filename
))
try
:
if
is_temp
:
self
.
run
(
'%s %s < %s'
%
(
patch_cmd
,
patch_options
,
os
.
remove
(
patch_filename
)
patch_filename
))
finally
:
if
is_temp
:
os
.
remove
(
patch_filename
)
if
'pre-configure-hook'
in
self
.
options
and
len
(
self
.
options
[
'pre-configure-hook'
].
strip
())
>
0
:
if
'pre-configure-hook'
in
self
.
options
and
len
(
self
.
options
[
'pre-configure-hook'
].
strip
())
>
0
:
log
.
info
(
'Executing pre-configure-hook'
)
log
.
info
(
'Executing pre-configure-hook'
)
...
...
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