From e3b7e0dcf6d0c631d1157878e01c5b5ebdcad051 Mon Sep 17 00:00:00 2001
From: Ian Wienand <iwienand@redhat.com>
Date: Wed, 9 Feb 2022 11:14:17 +1100
Subject: [PATCH] ensure-sphinx: upgrade pip

Change I98c3da5b02a4ac7fb9d7bd8e00170762e77b9f40 caused a regression,
because previously virtualenv would be pulling the latest pip, whereas
"pip -m venv" is using the system-vendored pip, which is older.

Upgrade pip to the latest in the sphinx environment to maintain the
status-quo.

Change-Id: I1004c2727379f73eafc8b32a3e14842200ad342c
---
 roles/ensure-sphinx/tasks/main.yaml | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/roles/ensure-sphinx/tasks/main.yaml b/roles/ensure-sphinx/tasks/main.yaml
index fb1425f09..bb141869b 100644
--- a/roles/ensure-sphinx/tasks/main.yaml
+++ b/roles/ensure-sphinx/tasks/main.yaml
@@ -37,6 +37,18 @@
       done
   register: requirements_file
 
+# Ensure we have the latest pip in the sphinx venv, not the system
+# one.  Older pips don't do things like parse version constraints or
+# rust build flags correctly, and some jobs like the translate jobs
+# use this environment to install from master requirements.txt that
+# needs this sort of thing to work.
+- name: Setup virtual environment
+  pip:
+    name: pip
+    virtualenv: '{{ zuul_work_virtualenv }}'
+    virtualenv_command: '{{ ensure_pip_virtualenv_command }}'
+    extra_args: '--upgrade'
+
 - name: Install base doc building packages
   pip:
     name: "{{ doc_building_packages | union(doc_building_extra_packages) }}"