Skip to content

Commit

Permalink
gentoo-build: Add argument --fail-to-shell
Browse files Browse the repository at this point in the history
  • Loading branch information
hartwork committed Mar 13, 2022
1 parent 8e48a31 commit d5be517
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions binary_gentoo/internal/cli/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ def parse_command_line(argv):
dest='tag_docker_image',
help='create a Docker image from the resulting container')

parser.add_argument('--fail-to-shell',
dest='fail_to_shell',
action='store_true',
help='drop into an in-container Bash shell on failure')

parser.add_argument(
'emerge_target',
metavar='CP|CPV|=CPV|@SET',
Expand Down Expand Up @@ -338,6 +343,11 @@ def build(config):
f'{emerge_quoted_flat} {rebuild_or_not} {install_or_not} {shlex.quote(config.emerge_target)}' # noqa: E501
)

if config.fail_to_shell:
success_chain_flat = ' && '.join(step_commands)
step_commands = [f'{{ {{ {success_chain_flat} ; }} || {{ bash -i ; }} ; }}']
del success_chain_flat

if container_name is not None:
# Cleanup symlinks that were created in previous steps, otherwise subsequent
# builds with --tag-docker-image will fail when the same symlinks are re-created
Expand Down

0 comments on commit d5be517

Please sign in to comment.