Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
buildstream
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
6
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
BuildStream
buildstream
Commits
e4ecea34
Commit
e4ecea34
authored
6 years ago
by
richardmaw-codethink
Browse files
Options
Downloads
Patches
Plain Diff
cli: Support multiple elements with -e option
parent
5844f941
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
buildstream/_frontend/cli.py
+31
-11
31 additions, 11 deletions
buildstream/_frontend/cli.py
with
31 additions
and
11 deletions
buildstream/_frontend/cli.py
+
31
−
11
View file @
e4ecea34
...
...
@@ -573,7 +573,7 @@ def show(app, elements, deps, except_, order, format_):
##################################################################
@cli.command
(
short_help
=
"
Shell into an element
'
s sandbox environment
"
)
@click.option
(
'
--build
'
,
'
-b
'
,
'
build_
'
,
is_flag
=
True
,
default
=
False
,
help
=
'
Stage dependencies and sources to build
'
)
help
=
'
Stage dependencies and sources to build
the first element
'
)
@click.option
(
'
--sysroot
'
,
'
-s
'
,
default
=
None
,
type
=
click
.
Path
(
exists
=
True
,
file_okay
=
False
,
readable
=
True
),
help
=
"
An existing sysroot
"
)
...
...
@@ -582,11 +582,11 @@ def show(app, elements, deps, except_, order, format_):
help
=
"
Mount a file or directory into the sandbox
"
)
@click.option
(
'
--isolate
'
,
is_flag
=
True
,
default
=
False
,
help
=
'
Create an isolated build sandbox
'
)
@click.argument
(
'
element
'
,
type
=
click
.
Path
(
readable
=
False
)
)
@click.argument
(
'
command
'
,
type
=
click
.
STRING
,
nargs
=-
1
)
@click.argument
(
'
element
s
'
,
type
=
click
.
Path
(
readable
=
False
)
,
nargs
=-
1
,
metavar
=
"
[ELEMENT]... [--] [COMMAND]...
"
)
@click.pass_obj
def
shell
(
app
,
element
,
sysroot
,
mount
,
isolate
,
build_
,
command
):
def
shell
(
app
,
element
s
,
sysroot
,
mount
,
isolate
,
build_
):
"""
Run a command in the target element
'
s sandbox environment
This will stage a temporary sysroot for running the target
...
...
@@ -600,6 +600,15 @@ def shell(app, element, sysroot, mount, isolate, build_, command):
directory or with a checkout of the given target, in order
to use a specific sysroot.
Multiple element target names ending in .bst may be provided,
optionally followed by the command to run in the shell.
The first argument that doesn
'
t end in .bst is assumed to be the beginning of COMMAND.
A -- argument may be used to disambiguate between element target names and command arguments
and should be used when being driven as part of a script, to prevent mis-parsing,
in addition to a -- before the element list.
If no COMMAND is specified, the default is to attempt
to run an interactive shell.
"""
...
...
@@ -607,13 +616,22 @@ def shell(app, element, sysroot, mount, isolate, build_, command):
from
.._project
import
HostMount
from
.._pipeline
import
PipelineSelection
if
build_
:
scope
=
Scope
.
BUILD
else
:
scope
=
Scope
.
RUN
targets
=
[]
command
=
[]
for
i
,
arg
in
enumerate
(
elements
):
if
arg
==
'
--
'
:
command
=
elements
[
i
+
1
:]
break
if
not
arg
.
endswith
(
'
.bst
'
):
command
=
elements
[
i
:]
break
targets
.
append
(
arg
)
if
not
targets
:
raise
AppError
(
'
No elements specified to open a shell in
'
)
with
app
.
initialized
():
dependencies
=
app
.
stream
.
load_selection
(
(
element
,)
,
selection
=
PipelineSelection
.
NONE
)
dependencies
=
app
.
stream
.
load_selection
(
targets
,
selection
=
PipelineSelection
.
NONE
)
element
=
dependencies
[
0
]
prompt
=
app
.
shell_prompt
(
element
)
mounts
=
[
...
...
@@ -621,7 +639,9 @@ def shell(app, element, sysroot, mount, isolate, build_, command):
for
host_path
,
path
in
mount
]
try
:
exitcode
=
app
.
stream
.
shell
([(
element
,
scope
)],
prompt
,
elements
=
tuple
((
e
,
Scope
.
BUILD
if
i
==
0
and
build_
else
Scope
.
RUN
)
for
(
i
,
e
)
in
enumerate
(
dependencies
))
exitcode
=
app
.
stream
.
shell
(
elements
,
prompt
,
directory
=
sysroot
,
mounts
=
mounts
,
isolate
=
isolate
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment