Skip to content

Commit ef16128

Browse files
xumialguohan
authored andcommitted
Fix py3 version changed even version control enabled issue (#6422)
* Fix py3 version changed even version control enabled issue * Add some comments and simplify the script * Add the comment to explain how to get the not hooked command
1 parent 533b7cc commit ef16128

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/sonic-build-hooks/scripts/buildinfo_base.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,20 @@ log_err()
2222
echo "$1" 1>&2
2323
}
2424

25+
# Get the real command not hooked by sonic-build-hook package
2526
get_command()
2627
{
27-
local path=$(echo $PATH | sed 's#[^:]*buildinfo/scripts:##' | sed "s#/usr/sbin:##")
28+
# Change the PATH env to get the real command by excluding the command in the hooked folders
29+
local path=$(echo $PATH | sed 's#[^:]*buildinfo/scripts:##' | sed "s#/usr/local/sbin:##")
2830
local command=$(PATH=$path which $1)
2931
echo $command
3032
}
3133

3234
check_version_control()
3335
{
36+
# The env variable SONIC_VERSION_CONTROL_COMPONENTS examples:
37+
# all -- match all components
38+
# py2,py3,deb -- match py2, py3 and deb only
3439
if [[ ",$SONIC_VERSION_CONTROL_COMPONENTS," == *,all,* ]] || [[ ",$SONIC_VERSION_CONTROL_COMPONENTS," == *,$1,* ]]; then
3540
echo "y"
3641
else

src/sonic-build-hooks/scripts/symlink_build_hooks

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
HOOK_PATH=/usr/local/share/buildinfo/hooks
4-
TARGET_PATH=/usr/sbin
4+
TARGET_PATH=/usr/local/sbin
55
FILES=$(ls $HOOK_PATH)
66

77
usage()

0 commit comments

Comments
 (0)