-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Build python-click Debian package from version 6.7-4 source to fix CLI autocomplete/suggest #1824
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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\ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add one blank There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added. Thanks, I somehow missed that. |
||
# For python-click build | ||
python-sphinx \ | ||
python-docutils \ | ||
python3-all \ | ||
python3-setuptools \ | ||
python3-sphinx \ | ||
python3-docutils \ | ||
python3-requests \ | ||
python3-pytest \ | ||
python3-colorama | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. some are already installed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It doesn't hurt to specify them more than once, and this way it's explicit which packages are required by other packages. If in the future we have no need for a package and someone removes its dependencies here, shared dependencies will still be listed under the other packages which require them. |
||
|
||
# For linux build | ||
RUN apt-get -y build-dep linux | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <tag_name>" 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)/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer
if possible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible, but because sonic-utilities is built as a .deb package, it attempts to install its dependencies as .deb packages, also. We've encountered this in the past. If we install the newer Click via pip, we will wind up with two versions of Click installed on the system. The default Python paths should look in the pip installation location (
/usr/local/lib/python2.7/dist-packages
) before the apt installation location (/usr/lib/python2.7/dist-packages
), so in theory it would work, but it's messy and provides the potential for the wrong version to be used if the paths are not as expected. This solution ensures only the 6.7 version of Click is installed on the system, so we have no need to worry about unexpected behavior.