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
0fe3a21c
Commit
0fe3a21c
authored
Feb 24, 2020
by
Bryton Lacquement
🚪
Committed by
Julien Muchembled
Feb 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
default: new 'init' option
The purpose is to replace colletive.recipe.shelloutput /reviewed-on
!11
parent
008302f0
Pipeline
#8118
passed with stage
in 0 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
6 deletions
+30
-6
README.rst
README.rst
+18
-4
slapos/recipe/build/__init__.py
slapos/recipe/build/__init__.py
+12
-2
No files found.
README.rst
View file @
0fe3a21c
...
@@ -4,12 +4,13 @@
...
@@ -4,12 +4,13 @@
.. contents::
.. contents::
Examples
Default
-------
-
-------
Recipe to build the software.
The default recipe can be used to execute ad-hoc Python code at both
init & install phases.
Example buildout::
Example buildout
that builds software
::
[buildout]
[buildout]
parts =
parts =
...
@@ -83,6 +84,19 @@ For example::
...
@@ -83,6 +84,19 @@ For example::
print('%(foo)s')
print('%(foo)s')
# will print “%(foo)s”
# will print “%(foo)s”
Using the init option::
[section-one]
recipe = slapos.recipe.build
init =
import os
options['foo'] = os.uname()[4]
[section-two]
bar = ${section-one:foo}
It is also possible to use both `init` & `script` in the same section.
Pure download
Pure download
~~~~~~~~~~~~~
~~~~~~~~~~~~~
...
...
slapos/recipe/build/__init__.py
View file @
0fe3a21c
...
@@ -268,18 +268,28 @@ class Script(EnvironMixin):
...
@@ -268,18 +268,28 @@ class Script(EnvironMixin):
except
KeyError
:
except
KeyError
:
self
.
options
[
'location'
]
=
os
.
path
.
join
(
self
.
options
[
'location'
]
=
os
.
path
.
join
(
buildout
[
'buildout'
][
'parts-directory'
],
self
.
name
)
buildout
[
'buildout'
][
'parts-directory'
],
self
.
name
)
self
.
script
=
self
.
options
[
'script'
]
format
=
options
.
get
(
'format'
,
'yes'
)
in
TRUE_LIST
init
=
options
.
get
(
'init'
)
self
.
script
=
options
.
get
(
'script'
)
if
self
.
script
:
if
self
.
script
:
if
self
.
options
.
get
(
'format'
,
'yes'
)
in
TRUE_LIST
:
if
format
:
self
.
script
=
self
.
script
%
self
.
options
self
.
script
=
self
.
script
%
self
.
options
elif
not
init
:
raise
zc
.
buildout
.
UserError
(
'either init or script is required'
)
if
self
.
options
.
get
(
'keep-on-error'
,
''
).
strip
().
lower
()
in
TRUE_LIST
:
if
self
.
options
.
get
(
'keep-on-error'
,
''
).
strip
().
lower
()
in
TRUE_LIST
:
self
.
logger
.
debug
(
'Keeping directories in case of errors'
)
self
.
logger
.
debug
(
'Keeping directories in case of errors'
)
self
.
keep_on_error
=
True
self
.
keep_on_error
=
True
else
:
else
:
self
.
keep_on_error
=
False
self
.
keep_on_error
=
False
EnvironMixin
.
__init__
(
self
,
False
)
EnvironMixin
.
__init__
(
self
,
False
)
if
init
:
if
format
:
init
=
init
%
options
exec
(
init
,
{
'self'
:
self
,
'options'
:
options
,
'env'
:
self
.
environ
})
def
install
(
self
):
def
install
(
self
):
if
not
self
.
script
:
return
""
location
=
self
.
options
[
'location'
]
location
=
self
.
options
[
'location'
]
if
os
.
path
.
lexists
(
location
):
if
os
.
path
.
lexists
(
location
):
self
.
logger
.
warning
(
'Removing already existing path %r'
,
location
)
self
.
logger
.
warning
(
'Removing already existing path %r'
,
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