From 37f67784d131ecfe8cd3ee1f17e1aa76f33978f5 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 27 Jun 2018 22:17:22 +0000 Subject: [PATCH 1/2] Build python-click Debian package from version 6.7-4 source --- .gitignore | 2 ++ .../build_templates/sonic_debian_extension.j2 | 6 +++++ rules/python-click.mk | 16 ++++++++++++ slave.mk | 1 + sonic-slave/Dockerfile | 14 +++++++--- src/python-click/Makefile | 26 +++++++++++++++++++ 6 files changed, 62 insertions(+), 3 deletions(-) create mode 100644 rules/python-click.mk create mode 100644 src/python-click/Makefile diff --git a/.gitignore b/.gitignore index 74998573e491..4eb7ab7e9ab7 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,8 @@ src/lldpd/* !src/lldpd/patch/ src/mpdecimal/* !src/mpdecimal/Makefile +src/python-click/* +!src/python-click/Makefile src/python3/* !src/python3/Makefile src/redis/* diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index b4a45ed16149..d12c5a45f9de 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -89,6 +89,12 @@ sudo cp {{platform_common_py2_wheel_path}} $FILESYSTEM_ROOT/$PLATFORM_COMMON_PY2 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 built Python Click package (and its dependencies via 'apt-get -y install -f') +# Do this before installing sonic-utilities so that it doesn't attempt to install +# an older version as part of its dependencies +sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/python-click*_all.deb || \ + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f + # 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 diff --git a/rules/python-click.mk b/rules/python-click.mk new file mode 100644 index 000000000000..0212f5e5584a --- /dev/null +++ b/rules/python-click.mk @@ -0,0 +1,16 @@ +# python-click package +# +# Python Click versions < 6.7 have a bug which causes bash completion +# functionality to stop working after two sublevels. sonic-utilities depends +# on this package, and the most recent version provided by Debian Jessie and +# Stretch is v6.6. We build version 6.7 from source in order to fix this bug. +# TODO: If we upgrade to a distro which provides a version >= 6.7 we will no +# longer need to build this. + +PYTHON_CLICK_VERSION = 6.7-4 + +export PYTHON_CLICK_VERSION + +PYTHON_CLICK = python-click_$(PYTHON_CLICK_VERSION)_all.deb +$(PYTHON_CLICK)_SRC_PATH = $(SRC_PATH)/python-click +SONIC_MAKE_DEBS += $(PYTHON_CLICK) diff --git a/slave.mk b/slave.mk index fc14a8f10a61..57e09d4c74ad 100644 --- a/slave.mk +++ b/slave.mk @@ -447,6 +447,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $(IGB_DRIVER) \ $(IXGBE_DRIVER) \ $(SONIC_DEVICE_DATA) \ + $(PYTHON_CLICK) \ $(SONIC_UTILS) \ $(LIBWRAP) \ $(LIBPAM_TACPLUS) \ diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index 213daf1a8e47..2d1d77bb32e4 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -193,8 +193,6 @@ RUN apt-get update && apt-get install -y \ python-netaddr \ python-ipaddr \ python-yaml \ -# For sonic utilities - python3-netaddr \ # For lockfile procmail \ # For gtest @@ -213,7 +211,17 @@ RUN apt-get update && apt-get install -y \ linuxdoc-tools \ lynx \ texlive-latex-extra \ - texlive-latex-recommended + texlive-latex-recommended\ +# For python-click build + python-sphinx \ + python-docutils \ + python3-all \ + python3-setuptools \ + python3-sphinx \ + python3-docutils \ + python3-requests \ + python3-pytest \ + python3-colorama # For linux build RUN apt-get -y build-dep linux diff --git a/src/python-click/Makefile b/src/python-click/Makefile new file mode 100644 index 000000000000..4deb27257fd2 --- /dev/null +++ b/src/python-click/Makefile @@ -0,0 +1,26 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = python-click_$(PYTHON_CLICK_VERSION)_all.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # Remove any stale files + rm -rf ./python-click + + # Clone python-click Debian repo + git clone https://salsa.debian.org/debian/python-click + + pushd ./python-click + + # Reset HEAD to the commit of the proper tag + # NOTE: Using "git checkout " here detaches our HEAD, + # which stg doesn't like, so we use this method instead + git reset --hard debian/$(PYTHON_CLICK_VERSION) + + # Build source and Debian packages + dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) + popd + + # Move the newly-built .deb package to the destination directory + mv $* $(DEST)/ From 47c05379ef159a9933f5f2a8129e182f2747286a Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 28 Jun 2018 19:59:46 +0000 Subject: [PATCH 2/2] Add space --- sonic-slave/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index 2d1d77bb32e4..8949db34a973 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -211,7 +211,7 @@ RUN apt-get update && apt-get install -y \ linuxdoc-tools \ lynx \ texlive-latex-extra \ - texlive-latex-recommended\ + texlive-latex-recommended \ # For python-click build python-sphinx \ python-docutils \