[base image]: Install SwSS SDK Python 2 package into base image (#461)

* [base image]: Install SwSS SDK Python packages (Python 2 & 3) into base image

* Fix typo in existing variable name

* Only install Python 2 version, as Python 3 is not installed in base image
This commit is contained in:
Joe LeVeque 2017-04-03 23:56:15 -07:00 committed by lguohan
parent 8391d7f8b5
commit b7d2009b14
2 changed files with 20 additions and 12 deletions

View File

@ -61,14 +61,21 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in
python-yaml \
python-bitarray
# Install SONiC config engine
CONFIG_ENGINE_WHL_NAME=`basename {{config_engine}}`
sudo cp {{config_engine}} $FILESYSTEM_ROOT/$CONFIG_ENGINE_WHL_NAME
sudo LANG=C chroot $FILESYSTEM_ROOT pip install $CONFIG_ENGINE_WHL_NAME
# Install SONiC config engine Python package
CONFIG_ENGINE_WHEEL_NAME=$(basename {{config_engine_wheel_path}})
sudo cp {{config_engine_wheel_path}} $FILESYSTEM_ROOT/$CONFIG_ENGINE_WHEEL_NAME
sudo LANG=C chroot $FILESYSTEM_ROOT pip install $CONFIG_ENGINE_WHEEL_NAME
sudo rm -rf $FILESYSTEM_ROOT/$CONFIG_ENGINE_WHEEL_NAME
# Install Python client for Redis
sudo LANG=C chroot $FILESYSTEM_ROOT pip install redis
# Install SwSS SDK Python 2 package
SWSSSDK_PY2_WHEEL_NAME=$(basename {{swsssdk_py2_wheel_path}})
sudo cp {{swsssdk_py2_wheel_path}} $FILESYSTEM_ROOT/$SWSSSDK_PY2_WHEEL_NAME
sudo LANG=C chroot $FILESYSTEM_ROOT pip install $SWSSSDK_PY2_WHEEL_NAME
sudo rm -rf $FILESYSTEM_ROOT/$SWSSSDK_PY2_WHEEL_NAME
# Install SONiC Utilities (and its dependencies via 'apt-get -y install -f')
sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/python-sonic-utilities_*.deb || \
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
@ -120,7 +127,7 @@ sudo cp $IMAGE_CONFIGS/snmp/snmp.yml $FILESYSTEM_ROOT/etc/sonic/
# Generate build version file
export git_revision=$(git rev-parse --short HEAD)
export debian_version=`cat $FILESYSTEM_ROOT/etc/debian_version`
export debian_version=$(cat $FILESYSTEM_ROOT/etc/debian_version)
export kernel_version={{kversion}}
j2 $BUILD_TEMPLATES/sonic_version.yml.j2 > sonic_version.yml
sudo mv sonic_version.yml $FILESYSTEM_ROOT/etc/sonic/
@ -162,7 +169,7 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i {{deb}} || sudo LANG=C DEBIAN_FRONTEND=noni
sudo mkdir -p $FILESYSTEM_ROOT/$PLATFORM_DIR/{{dev}}
sudo cp {{ deb }} $FILESYSTEM_ROOT/$PLATFORM_DIR/{{dev}}/
for f in `find $FILESYSTEM_ROOT/var/cache/apt/archives -name "*.deb"`; do
for f in $(find $FILESYSTEM_ROOT/var/cache/apt/archives -name "*.deb"); do
sudo mv $f $FILESYSTEM_ROOT/$PLATFORM_DIR/{{dev}}/
done
@ -181,7 +188,7 @@ sudo cp $IMAGE_CONFIGS/platform/rc.local $FILESYSTEM_ROOT/etc/
sudo LANG=C chroot $FILESYSTEM_ROOT docker load < {{image}}
{% endfor %}
sudo chroot $FILESYSTEM_ROOT service docker stop
{% for script in installer_start_scrips.split(' ') -%}
{% for script in installer_start_scripts.split(' ') -%}
sudo cp {{script}} $FILESYSTEM_ROOT/usr/bin/
{% endfor %}
{% for service in installer_services.split(' ') -%}

View File

@ -307,14 +307,15 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform
export initramfs_tools="$(DEBS_PATH)/$(INITRAMFS_TOOLS)"
export linux_kernel="$(DEBS_PATH)/$(LINUX_KERNEL)"
export kversion="$(KVERSION)"
export installer_debs="$(addprefix $(DEBS_PATH)/,$($*_DEPENDS))"
export lazy_installer_debs="$(foreach deb, $($*_INSTALLS),$(foreach device, $($(deb)_PLATFORM),$(addprefix $(device)@, $(DEBS_PATH)/$(deb))))"
export installer_images="$(addprefix $(TARGET_PATH)/,$($*_DOCKERS))"
export config_engine="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE))"
export image_type="$($*_IMAGE_TYPE)"
export sonicadmin_user="$(USERNAME)"
export sonic_asic_platform="$(CONFIGURED_PLATFORM)"
export enable_dhcp_graph_service="$(ENABLE_DHCP_GRAPH_SERVICE)"
export installer_debs="$(addprefix $(DEBS_PATH)/,$($*_DEPENDS))"
export lazy_installer_debs="$(foreach deb, $($*_INSTALLS),$(foreach device, $($(deb)_PLATFORM),$(addprefix $(device)@, $(DEBS_PATH)/$(deb))))"
export installer_images="$(addprefix $(TARGET_PATH)/,$($*_DOCKERS))"
export config_engine_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE))"
export swsssdk_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SWSSSDK_PY2))"
$(foreach docker, $($*_DOCKERS),\
export docker_image="$(docker)"
@ -328,7 +329,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform
chmod +x $($(docker)_CONTAINER_NAME).sh
)
export installer_start_scrips="$(foreach docker, $($*_DOCKERS),$(addsuffix .sh, $($(docker)_CONTAINER_NAME)))"
export installer_start_scripts="$(foreach docker, $($*_DOCKERS),$(addsuffix .sh, $($(docker)_CONTAINER_NAME)))"
export installer_services="$(foreach docker, $($*_DOCKERS),$(addsuffix .service, $($(docker)_CONTAINER_NAME)))"
export installer_extra_files="$(foreach docker, $($*_DOCKERS), $(foreach file, $($(docker)_BASE_IMAGE_FILES), $($(docker)_PATH)/base_image_files/$(file)))"