From c9cf4d9ff0432679a25108456d9509104ace9815 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 24 Feb 2022 17:00:13 -0800 Subject: [PATCH] sonic-slave-buster pins the versions of Jinja2 and MarkupSafe in py3 (#10043) #### Why I did it Upstream breaking change, ref discussion https://github.com/pallets/markupsafe/issues/282 --- .azure-pipelines/azure-pipelines-image-template.yml | 1 - sonic-slave-buster/Dockerfile.j2 | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/azure-pipelines-image-template.yml b/.azure-pipelines/azure-pipelines-image-template.yml index 70c40d64b6..0a83c33407 100644 --- a/.azure-pipelines/azure-pipelines-image-template.yml +++ b/.azure-pipelines/azure-pipelines-image-template.yml @@ -43,7 +43,6 @@ jobs: [ -n "$SYSTEM_PULLREQUEST_PULLREQUESTID" ] && BRANCH_NAME="$SYSTEM_PULLREQUEST_TARGETBRANCH-$SYSTEM_PULLREQUEST_PULLREQUESTNUMBER" git checkout -b $BRANCH_NAME sudo modprobe overlay - pip3 install MarkupSafe==2.0.1 --force-reinstall sudo apt-get install -y acl sudo bash -c "echo 1 > /proc/sys/vm/compact_memory" ENABLE_DOCKER_BASE_PULL=y make PLATFORM=$(PLATFORM_AZP) PLATFORM_ARCH=$(PLATFORM_ARCH) $(BUILD_OPTIONS) configure diff --git a/sonic-slave-buster/Dockerfile.j2 b/sonic-slave-buster/Dockerfile.j2 index 8189338071..0f5c6414a1 100644 --- a/sonic-slave-buster/Dockerfile.j2 +++ b/sonic-slave-buster/Dockerfile.j2 @@ -465,6 +465,11 @@ RUN pip3 uninstall -y enum34 # For templating RUN pip2 install j2cli==0.3.10 +# Note: Jinja2 depends on MarkupSafe, however markupsafe 2.1.0 breaks Jinja2 2.10 +# Debian buster dist-packages include python3-markupsafe (1.1.0-1) and python3-jinja2 (2.10-2) +# If not pinning the versions, any requirement like `MarkupSafe>=2.0` will pull latest into site-packages and mess up. +RUN pip3 install MarkupSafe==2.0.1 +RUN pip3 install Jinja2==3.0.3 # For sonic-mgmt-framework RUN pip2 install "PyYAML==5.4.1"