From 761d1dd7bbffa8b76f9e9a4ff163eb98c8f5e083 Mon Sep 17 00:00:00 2001 From: Benjamin Moody Date: Tue, 21 Mar 2023 16:39:22 -0400 Subject: [PATCH] test-upgrade.sh: install python libraries without upgrading. We want to avoid "upgrading" python libraries using pip, because this may not give predictable results, and if installation fails it can leave the system in a broken half-installed state. Instead, we want to install packages from scratch whenever it is required. To be consistent with the new behavior of the git update hook, do the same thing when running upgrade tests: rather than "upgrading" the virtualenv directory, delete the old one and create a new one. This makes caching simpler, too, since the directory contents should be reproducible just from requirements.txt. --- test-upgrade.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test-upgrade.sh b/test-upgrade.sh index 1db7d18c43..1aec55572d 100755 --- a/test-upgrade.sh +++ b/test-upgrade.sh @@ -266,12 +266,14 @@ export PATH=$venvdir/bin:$PATH msg_testing "Installing new requirements" if ! cmp -s "$olddir/requirements.txt" "$topdir/requirements.txt"; then - cachefile=$venvcachedir/$old_reqs_hash-$new_reqs_hash.tar.gz + prereq_cmd rm -rf "$venvdir" + cachefile=$venvcachedir/$new_reqs_hash.tar.gz if [ -n "$venvcachedir" ] && [ -f "$cachefile" ]; then - prereq_cmd rm -rf "$venvdir" prereq_cmd mkdir "$venvdir" prereq_cmd tar -xzf "$cachefile" -C "$venvdir" else + prereq_cmd virtualenv --quiet --quiet \ + --no-download -ppython3 "$venvdir" prereq_cmd pip3 install --require-hashes \ -r "$topdir/requirements.txt" if [ -n "$venvcachedir" ]; then