Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

envsetup: Remove additional options to docker run #260

Merged
merged 4 commits into from
Jan 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions envsetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -467,34 +467,33 @@ dkr() {
check_docker || return 1

CMD="$1"
PSEUDOTTY=""

if [ -z "$CMD" ]; then
echo "setting dkr action to shell"
CMD="/bin/bash"
PSEUDOTTY="--tty"
else
shift
fi
if [ "$DOCKER_PSEUDO_TTY" = "no" ]; then
PSEUDO_TTY=""
else
PSEUDO_TTY="-t"
fi

SSH_AUTH_DIR=~/

unset MAP_DL_DIR
unset MAP_TMPDIR
unset MAP_SSTATE_DIR
if [ -n "$CUSTOM_DL_DIR" ]; then
MAP_DL_DIR="-v $CUSTOM_DL_DIR:$CUSTOM_DL_DIR"
fi
if [ -n "$CUSTOM_TMPDIR" ]; then
MAP_TMPDIR="-v $CUSTOM_TMPDIR:$CUSTOM_TMPDIR"
fi
if [ -n "$CUSTOM_SSTATE_DIR" ]; then
MAP_SSTATE_DIR="-v $CUSTOM_SSTATE_DIR:$CUSTOM_SSTATE_DIR"
fi
MAP_TMPDIR="-v $(readlink -f $OE_BUILD_TMPDIR):$(readlink -f $OE_BUILD_TMPDIR)"
MAP_DL_DIR="-v $(readlink -f $OE_DL_DIR):$(readlink -f $OE_DL_DIR)"
MAP_SSTATE_DIR="-v $(readlink -f $OE_SSTATE_DIR):$(readlink -f $OE_SSTATE_DIR)"

if [ -n "$SSH_AUTH_SOCK" ]; then
SSH_AUTH_DIR=$(readlink -f $SSH_AUTH_SOCK)
fi

docker run --rm -i ${PSEUDOTTY} --log-driver=none -a stdin -a stdout -a stderr \
docker run --rm -i $PSEUDO_TTY \
-v $(pwd):$(pwd) \
-v ~/.ssh:/home/build/.ssh \
-v ~/.gitconfig:/home/build/.gitconfig \
Expand All @@ -504,8 +503,9 @@ dkr() {
-v $SSH_AUTH_DIR:/ssh-agent \
-e SSH_AUTH_SOCK=/ssh-agent \
-e MACHINE=$MACHINE \
-w ${OE_BASE} \
--user $(id -u):$(id -g) \
${DOCKER_REPO} /bin/bash -c "cd $(pwd) && . envsetup.sh && $CMD $2 $3 $4 $5 $6 $7 $8"
${DOCKER_REPO} /bin/bash -c ". envsetup.sh && $CMD $@"
}

bitbake() {
Expand Down
7 changes: 7 additions & 0 deletions local.sh.example
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,10 @@

# configure docker container to run bitbake in
#export DOCKER_REPO=yoedistro/yoe-build:buster

# Flag to control docker launch with pseudo-tty
# when output is piped or redirected to files then
# then docker should be launched without tty
# otherwise it will emit all control characters into
# redirected log files, default is 'yes'
#export DOCKER_PSEUDO_TTY=no