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

Support for debug shell with package ENV variable set. #6092

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Kalimuthu-Velappan
Copy link
Contributor

@Kalimuthu-Velappan Kalimuthu-Velappan commented Dec 2, 2020

Sonic package build happens inside the docker build container.
when a package build failure happens, debugging the package compilation requires
pre-installation of its dependent packages and version ENV
variables to be set. For example:

# make target/debs/buster/hsflowd_2.0.26-4_amd64.deb
failure

In oder to compile the hslflowd package inside the container, the
following ENV variable to be set.

export HSFLOWD_VERSION = 2.0.28
export HSFLOWD_SUBVERSION = 2

This patch helps to compile the package directly on the source folder
inside the build container with required ENV variable set.

# make DBGSH=1 target/debs/buster/hsflowd_2.0.26-4_amd64.deb

Get into the build container and land on the bash shell.

src/sflow/hsflowd $
src/sflow/hsflowd $ make hsflowd_2.0.26-4_amd64.deb

- Why I did it

- How I did it

- How to verify it

- Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@lguohan lguohan requested a review from xumia December 3, 2020 09:55
@liushilongbuaa
Copy link
Contributor

retest broadcom please

@liushilongbuaa
Copy link
Contributor

retest mellanox please

Makefile.cache Outdated Show resolved Hide resolved
rules/functions Outdated Show resolved Hide resolved
Makefile Show resolved Hide resolved
@@ -1092,6 +1094,10 @@ stretch : $$(addprefix $(TARGET_PATH)/,$$(STRETCH_DOCKER_IMAGES)) \
jessie : $$(addprefix $(TARGET_PATH)/,$$(JESSIE_DOCKER_IMAGES)) \
$$(addprefix $(TARGET_PATH)/,$$(JESSIE_DBG_DOCKER_IMAGES))

.PHONY: shell
shell:
@$(SHELL)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where does this SHELL defined? are you overriding the shell in the Makefile?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SHELL is already defined at the beginning of the slave.mk file.

Select bash for commands

.ONESHELL:
SHELL = /bin/bash
.SHELLFLAGS += -e

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the purpose to define this phony target shell?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the build is running, quickly get into the build container with all slave build ENV variables set from another shell. The slave build ENVs are not set if we use 'make sonic-slave-bash' target.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how to use this target then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can invoke this target as below.

make shell

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also execute the individual target as below.

make -f slave.mk target/python-wheels/sonic_py_common-1.0-py2-none-any.whl
etc.

Sonic package build happens inside the docker build container.
when a package build failure happens, debugging the package compilation requires
pre-installation of its dependent packages and version ENV
variables to be set. For example:

\# make target/debs/buster/hsflowd_2.0.26-4_amd64.deb
   ***failure***

In oder to compile the hslflowd package inside the container, the
following ENV variable to be set.

   export HSFLOWD_VERSION = 2.0.28
   export HSFLOWD_SUBVERSION = 2

This patch helps to compile the package directly on the source folder
inside the build container with required ENV variable set.

\# make DBGSH=1 target/debs/buster/hsflowd_2.0.26-4_amd64.deb

Get into the build container and land on the bash shell.

src/sflow/hsflowd $
src/sflow/hsflowd $ make hsflowd_2.0.26-4_amd64.deb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants