Skip to content

Commit

Permalink
Move platform-specific hardware plugin base packages to sonic-platfor…
Browse files Browse the repository at this point in the history
…m-common submodule (#1301)
  • Loading branch information
jleveque authored Jan 18, 2018
1 parent 6cd3079 commit 134707f
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 21 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
[submodule "platform/broadcom/sonic-platform-modules-ingrasys"]
path = platform/broadcom/sonic-platform-modules-ingrasys
url = https://github.com/Ingrasys-sonic/sonic-platform-modules-ingrasys
[submodule "src/sonic-platform-common"]
path = src/sonic-platform-common
url = https://github.com/Azure/sonic-platform-common
[submodule "src/sonic-platform-daemons"]
path = src/sonic-platform-daemons
url = https://github.com/Azure/sonic-platform-daemons
Expand Down
2 changes: 1 addition & 1 deletion dockers/docker-snmp-sv2/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ COPY [ \
"/debs/"]

# Install Python SwSSSDK (SNMP subagent dependency)
COPY python-wheels/sonic_utilities-*-py3-*.whl /python-wheels/
COPY python-wheels/sonic_platform_common-*-py3-*.whl /python-wheels/
COPY python-wheels/swsssdk-*-py3-*.whl /python-wheels/
COPY python-wheels/asyncsnmp-*-py3-*.whl /python-wheels/

Expand Down
6 changes: 6 additions & 0 deletions files/build_templates/sonic_debian_extension.j2
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ sudo cp {{swsssdk_py2_wheel_path}} $FILESYSTEM_ROOT/$SWSSSDK_PY2_WHEEL_NAME
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install $SWSSSDK_PY2_WHEEL_NAME
sudo rm -rf $FILESYSTEM_ROOT/$SWSSSDK_PY2_WHEEL_NAME

# Install sonic-platform-common Python 2 package
PLATFORM_COMMON_PY2_WHEEL_NAME=$(basename {{platform_common_py2_wheel_path}})
sudo cp {{platform_common_py2_wheel_path}} $FILESYSTEM_ROOT/$PLATFORM_COMMON_PY2_WHEEL_NAME
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install $PLATFORM_COMMON_PY2_WHEEL_NAME
sudo rm -rf $FILESYSTEM_ROOT/$PLATFORM_COMMON_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
Expand Down
10 changes: 5 additions & 5 deletions platform/p4/docker-sonic-p4.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
DOCKER_SONIC_P4 = docker-sonic-p4.gz
$(DOCKER_SONIC_P4)_PATH = $(PLATFORM_PATH)/docker-sonic-p4
$(DOCKER_SONIC_P4)_DEPENDS += $(SWSS) \
$(SYNCD) \
$(P4_SWITCH) \
$(REDIS_SERVER) \
$(REDIS_TOOLS) \
$(PYTHON_SWSSCOMMON) \
$(SYNCD) \
$(P4_SWITCH) \
$(REDIS_SERVER) \
$(REDIS_TOOLS) \
$(PYTHON_SWSSCOMMON) \
$(LIBTEAMDCT) \
$(LIBTEAM_UTILS) \
$(SONIC_DEVICE_DATA) \
Expand Down
4 changes: 2 additions & 2 deletions rules/asyncsnmp-py3.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
ASYNCSNMP_PY3 = asyncsnmp-2.1.0-py3-none-any.whl
$(ASYNCSNMP_PY3)_SRC_PATH = $(SRC_PATH)/sonic-snmpagent
$(ASYNCSNMP_PY3)_PYTHON_VERSION = 3
# Depends on sonic-utilities so it is possible to import sonic_psu
$(ASYNCSNMP_PY3)_DEPENDS += $(SWSSSDK_PY3) $(SONIC_UTILS_PY3)
# Depends on sonic-platform-common so it is possible to import sonic_psu
$(ASYNCSNMP_PY3)_DEPENDS += $(SWSSSDK_PY3) $(SONIC_PLATFORM_COMMON_PY3)
SONIC_PYTHON_WHEELS += $(ASYNCSNMP_PY3)
2 changes: 1 addition & 1 deletion rules/sonic-ledd.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# sonic-ledd (SONiC Front-panel LED control daemon) Debian package

SONIC_LEDD = python-sonic-ledd_1.0-1_all.deb
SONIC_LEDD = python-sonic-ledd_1.1-1_all.deb
$(SONIC_LEDD)_SRC_PATH = $(SRC_PATH)/sonic-platform-daemons/sonic-ledd
SONIC_PYTHON_STDEB_DEBS += $(SONIC_LEDD)
13 changes: 13 additions & 0 deletions rules/sonic-platform-common.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# sonic-platform-common package

SONIC_PLATFORM_COMMON_PY2 = sonic_platform_common-1.0-py2-none-any.whl
$(SONIC_PLATFORM_COMMON_PY2)_SRC_PATH = $(SRC_PATH)/sonic-platform-common
$(SONIC_PLATFORM_COMMON_PY2)_PYTHON_VERSION = 2
SONIC_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY2)

# Als build sonic-platform-common into python3 wheel, so we can use PSU code in SNMP docker
# Note: _DEPENDS macro is not defined
SONIC_PLATFORM_COMMON_PY3 = sonic_platform_common-1.0-py3-none-any.whl
$(SONIC_PLATFORM_COMMON_PY3)_SRC_PATH = $(SRC_PATH)/sonic-platform-common
$(SONIC_PLATFORM_COMMON_PY3)_PYTHON_VERSION = 3
SONIC_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY3)
20 changes: 11 additions & 9 deletions rules/sonic-utilities.mk
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# sonic utilities package
#
# NOTE: sonic-config-engine is a build-time dependency of sonic-utilities
# due to unit tests which are run during the build. However,
# sonic-platform-common and swsssdk are runtime dependencies, and should be
# added here also. However, the current build system assumes all runtime
# dependencies are .deb packages.
#
# TODO: Create a way to specify both .deb and .whl runtime dependencies
# then add the aforementioned runtime dependencies here.
#

SONIC_UTILS = python-sonic-utilities_1.1-1_all.deb
SONIC_UTILS = python-sonic-utilities_1.2-1_all.deb
$(SONIC_UTILS)_SRC_PATH = $(SRC_PATH)/sonic-utilities
$(SONIC_UTILS)_WHEEL_DEPENDS = $(SONIC_CONFIG_ENGINE)
SONIC_PYTHON_STDEB_DEBS += $(SONIC_UTILS)

# Build sonic-utilities into python3 wheel, so we can use PSU code
# Note: _DEPENDS macro is not defined
SONIC_UTILS_PY3 = sonic_utilities-1.1-py3-none-any.whl
$(SONIC_UTILS_PY3)_SRC_PATH = $(SRC_PATH)/sonic-utilities
$(SONIC_UTILS_PY3)_PYTHON_VERSION = 3
$(SONIC_UTILS_PY3)_TEST = n
SONIC_PYTHON_WHEELS += $(SONIC_UTILS_PY3)
4 changes: 3 additions & 1 deletion slave.mk
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,8 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \
$(LIBPAM_TACPLUS) \
$(LIBNSS_TACPLUS)) \
$$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) \
$$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE))
$$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE)) \
$$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PLATFORM_COMMON_PY2))
$(HEADER)
# Pass initramfs and linux kernel explicitly. They are used for all platforms
export initramfs_tools="$(DEBS_PATH)/$(INITRAMFS_TOOLS)"
Expand All @@ -433,6 +434,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \
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))"
export platform_common_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PLATFORM_COMMON_PY2))"

$(foreach docker, $($*_DOCKERS),\
export docker_image="$(docker)"
Expand Down
1 change: 1 addition & 0 deletions src/sonic-platform-common
Submodule sonic-platform-common added at 058161
2 changes: 1 addition & 1 deletion src/sonic-platform-daemons
2 changes: 1 addition & 1 deletion src/sonic-utilities

0 comments on commit 134707f

Please sign in to comment.