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

Fix py3 version changed even version control enabled issue #6422

Merged
merged 3 commits into from
Jan 13, 2021
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
7 changes: 6 additions & 1 deletion src/sonic-build-hooks/scripts/buildinfo_base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,20 @@ log_err()
echo "$1" 1>&2
}

# Get the real command not hooked by sonic-build-hook package
Copy link
Collaborator

@qiluo-msft qiluo-msft Jan 13, 2021

Choose a reason for hiding this comment

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

And how? I guess you remove some paths (listing them) in $PATH and check the absolute path of the same command again? #Closed

Copy link
Collaborator Author

@xumia xumia Jan 13, 2021

Choose a reason for hiding this comment

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

We add the command in /usr/local/sbin, and exclude the /usr/local/sbin in env PATH when find the real command.


In reply to: 556218199 [](ancestors = 556218199)

get_command()
Copy link
Collaborator

@qiluo-msft qiluo-msft Jan 13, 2021

Choose a reason for hiding this comment

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

get_command [](start = 0, length = 11)

Could you add function scope comment to explain the intention? #Closed

{
local path=$(echo $PATH | sed 's#[^:]*buildinfo/scripts:##' | sed "s#/usr/sbin:##")
# Change the PATH env to get the real command by excluding the command in the hooked folders
local path=$(echo $PATH | sed 's#[^:]*buildinfo/scripts:##' | sed "s#/usr/local/sbin:##")
local command=$(PATH=$path which $1)
echo $command
}

check_version_control()
{
# The env variable SONIC_VERSION_CONTROL_COMPONENTS examples:
# all -- match all components
# py2,py3,deb -- match py2, py3 and deb only
if [[ ",$SONIC_VERSION_CONTROL_COMPONENTS," == *,all,* ]] || [[ ",$SONIC_VERSION_CONTROL_COMPONENTS," == *,$1,* ]]; then
echo "y"
else
Expand Down
2 changes: 1 addition & 1 deletion src/sonic-build-hooks/scripts/symlink_build_hooks
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

HOOK_PATH=/usr/local/share/buildinfo/hooks
TARGET_PATH=/usr/sbin
TARGET_PATH=/usr/local/sbin
FILES=$(ls $HOOK_PATH)

usage()
Expand Down