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
Boxiang Sun
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
Show 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,13 +165,14 @@ class Recipe(object):
...
@@ -165,13 +165,14 @@ 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
)
try
:
if
not
is_temp
:
if
not
is_temp
:
filename
=
os
.
path
.
abspath
(
filename
)
filename
=
os
.
path
.
abspath
(
filename
)
module
=
imp
.
load_source
(
'script'
,
filename
)
module
=
imp
.
load_source
(
'script'
,
filename
)
script
=
getattr
(
module
,
callable
.
strip
())
script
=
getattr
(
module
,
callable
.
strip
())
try
:
try
:
script
(
self
.
options
,
self
.
buildout
,
self
.
augmented_environment
())
script
(
self
.
options
,
self
.
buildout
,
self
.
augmented_environment
())
except
TypeError
:
except
TypeError
:
# BBB: Support hook scripts that do not take the environment as
# BBB: Support hook scripts that do not take the environment as
# the third parameter
# the third parameter
...
@@ -282,7 +283,10 @@ class Recipe(object):
...
@@ -282,7 +283,10 @@ 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
:
self
.
run
(
'%s %s < %s'
%
(
patch_cmd
,
patch_options
,
patch_filename
))
finally
:
if
is_temp
:
if
is_temp
:
os
.
remove
(
patch_filename
)
os
.
remove
(
patch_filename
)
...
...
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