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
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
Thomas Leymonerie
slapos.recipe.build
Commits
84a8ce94
Commit
84a8ce94
authored
Mar 13, 2020
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
default: 'script' renamed to 'install', new 'update', clean up globals/locals
parent
9ff1a5a3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
17 deletions
+28
-17
slapos/recipe/build/__init__.py
slapos/recipe/build/__init__.py
+28
-17
No files found.
slapos/recipe/build/__init__.py
View file @
84a8ce94
...
...
@@ -88,6 +88,8 @@ def guessworkdir(path):
def
guessPlatform
():
return
ARCH_MAP
[
uname
()[
-
2
]]
GLOBALS
=
(
lambda
*
x
:
{
x
.
__name__
:
x
for
x
in
x
})(
call
,
guessPlatform
,
guessworkdir
)
TRUE_LIST
=
(
'y'
,
'on'
,
'yes'
,
'true'
,
'1'
)
...
...
@@ -231,37 +233,45 @@ class Script(EnvironMixin):
except
KeyError
:
self
.
options
[
'location'
]
=
os
.
path
.
join
(
buildout
[
'buildout'
][
'parts-directory'
],
self
.
name
)
format
=
options
.
get
(
'format'
,
'yes'
)
in
TRUE_LIST
init
=
options
.
get
(
'init'
)
self
.
script
=
options
.
get
(
'script'
)
if
self
.
script
:
if
format
:
self
.
script
=
self
.
script
%
self
.
options
elif
not
init
:
raise
zc
.
buildout
.
UserError
(
'either init or script is required'
)
self
.
_format
=
options
.
get
(
'format'
,
'yes'
)
in
TRUE_LIST
missing
=
True
keys
=
'init'
,
'install'
,
'update'
for
option
in
keys
:
script
=
options
.
get
(
option
)
setattr
(
self
,
'_'
+
option
,
script
)
if
script
:
missing
=
False
if
missing
:
raise
zc
.
buildout
.
UserError
(
'at least one of the following option is required: '
+
', '
.
join
(
keys
))
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
EnvironMixin
.
__init__
(
self
,
False
)
if
init
:
if
format
:
init
=
init
%
options
exec
(
init
,
{
'self'
:
self
,
'options'
:
options
,
'env'
:
self
.
environ
})
if
self
.
_init
:
self
.
_exec
(
self
.
_init
)
def
_exec
(
self
,
script
):
options
=
self
.
options
exec
(
script
%
options
if
self
.
_format
else
script
,
dict
(
GLOBALS
,
self
=
self
,
options
=
options
,
location
=
options
[
'location'
],
))
def
install
(
self
):
if
not
self
.
script
:
if
not
self
.
_install
:
self
.
update
()
return
""
location
=
self
.
options
[
'location'
]
if
os
.
path
.
lexists
(
location
):
self
.
logger
.
warning
(
'Removing already existing path %r'
,
location
)
rmtree
(
location
)
# env is used in script exec'ed below
env
=
self
.
environ
self
.
cleanup_list
=
[]
try
:
exec
(
self
.
script
)
self
.
_exec
(
self
.
_install
)
self
.
_checkPromise
(
'slapos_promise'
,
location
)
except
:
self
.
cleanup_list
.
append
(
location
)
...
...
@@ -277,7 +287,8 @@ class Script(EnvironMixin):
return
location
def
update
(
self
):
pass
if
self
.
_update
:
self
.
_exec
(
self
.
_update
)
def
applyPatchList
(
self
,
patch_string
,
patch_options
=
None
,
patch_binary
=
None
,
cwd
=
None
):
if
patch_string
is
not
None
:
...
...
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