mirror of
https://github.com/certbot/certbot.git
synced 2026-05-28 04:34:11 -04:00
Fixes #5490. There's a lot of possibilities discussed in #5490, but I'll try and explain what I actually did here as succinctly as I can. Unfortunately, there's a fair bit to explain. My goal was to break lockstep and give us tests to ensure the minimum specified versions are correct without taking the time now to refactor our whole test setup. To handle specifying each package's minimum acme/certbot version, I added a requirements file to each package. This won't actually be included in the shipped package (because it's not in the MANIFEST). After creating these files and modifying tools/pip_install.sh to use them, I created a separate tox env for most packages (I kept the DNS plugins together for convenience). The reason this is necessary is because we currently use a single environment for each plugin, but if we used this approach for these tests we'd hit issues due to different installed plugins requiring different versions of acme/certbot. There's a lot more discussion about this in #5490 if you're interested in this piece. I unfortunately wasted a lot of time trying to remove the boilerplate this approach causes in tox.ini, but to do this I think we need negations described at complex factor conditions which hasn't made it into a tox release yet. The biggest missing piece here is how to make sure the oldest versions that are currently pinned to master get updated. Currently, they'll stay pinned that way without manual intervention and won't be properly testing the oldest version. I think we should solve this during the larger test/repo refactoring after the release because the tests are using the correct values now and I don't see a simple way around the problem. Once this lands, I'm planning on updating the test-everything tests to do integration tests with the "oldest" versions here. * break lockstep between packages * Use per package requirements files * add local oldest requirements files * update tox.ini * work with dev0 versions * Install requirements in separate step. * don't error when we don't have requirements * install latest packages in editable mode * Update .travis.yml * Add reminder comments * move dev to requirements * request acme[dev] * Update pip_install documentation
44 lines
1.9 KiB
Bash
Executable file
44 lines
1.9 KiB
Bash
Executable file
#!/bin/bash -e
|
|
# pip installs packages using pinned package versions. If CERTBOT_OLDEST is set
|
|
# to 1, a combination of tools/oldest_constraints.txt,
|
|
# tools/dev_constraints.txt, and local-oldest-requirements.txt contained in the
|
|
# top level of the package's directory is used, otherwise, a combination of
|
|
# certbot-auto's requirements file and tools/dev_constraints.txt is used. The
|
|
# other file always takes precedence over tools/dev_constraints.txt. If
|
|
# CERTBOT_OLDEST is set, this script must be run with `-e <package-name>` and
|
|
# no other arguments.
|
|
|
|
# get the root of the Certbot repo
|
|
tools_dir=$(dirname $("$(dirname $0)/readlink.py" $0))
|
|
all_constraints=$(mktemp)
|
|
test_constraints=$(mktemp)
|
|
trap "rm -f $all_constraints $test_constraints" EXIT
|
|
|
|
if [ "$CERTBOT_OLDEST" = 1 ]; then
|
|
if [ "$1" != "-e" -o "$#" -ne "2" ]; then
|
|
echo "When CERTBOT_OLDEST is set, this script must be run with a single -e <path> argument."
|
|
exit 1
|
|
fi
|
|
pkg_dir=$(echo $2 | cut -f1 -d\[) # remove any extras such as [dev]
|
|
requirements="$pkg_dir/local-oldest-requirements.txt"
|
|
# packages like acme don't have any local oldest requirements
|
|
if [ ! -f "$requirements" ]; then
|
|
unset requirements
|
|
fi
|
|
cp "$tools_dir/oldest_constraints.txt" "$test_constraints"
|
|
else
|
|
repo_root=$(dirname "$tools_dir")
|
|
certbot_requirements="$repo_root/letsencrypt-auto-source/pieces/dependency-requirements.txt"
|
|
sed -n -e 's/^\([^[:space:]]*==[^[:space:]]*\).*$/\1/p' "$certbot_requirements" > "$test_constraints"
|
|
fi
|
|
|
|
"$tools_dir/merge_requirements.py" "$tools_dir/dev_constraints.txt" \
|
|
"$test_constraints" > "$all_constraints"
|
|
|
|
set -x
|
|
|
|
# install the requested packages using the pinned requirements as constraints
|
|
if [ -n "$requirements" ]; then
|
|
pip install -q --constraint "$all_constraints" --requirement "$requirements"
|
|
fi
|
|
pip install -q --constraint "$all_constraints" "$@"
|