Files
@ 5a918cd2502e
Branch filter:
Location: gimmecert/provision.sh - annotation
5a918cd2502e
4.0 KiB
text/x-sh
Noticket: Switching to development version.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | fe8dc0049e18 fe8dc0049e18 eaf58c505b5a eaf58c505b5a eaf58c505b5a eaf58c505b5a eaf58c505b5a eaf58c505b5a eaf58c505b5a eaf58c505b5a eaf58c505b5a eaf58c505b5a eaf58c505b5a eaf58c505b5a eaf58c505b5a eaf58c505b5a eaf58c505b5a eaf58c505b5a eaf58c505b5a fe8dc0049e18 fe8dc0049e18 fe8dc0049e18 fe8dc0049e18 fe8dc0049e18 fe8dc0049e18 fe8dc0049e18 fe8dc0049e18 fe8dc0049e18 fe8dc0049e18 fe8dc0049e18 fe8dc0049e18 fe8dc0049e18 fe8dc0049e18 fe8dc0049e18 fe8dc0049e18 fe8dc0049e18 fe8dc0049e18 fe8dc0049e18 fe8dc0049e18 fe8dc0049e18 7a8c83185a93 fe8dc0049e18 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 7c2f909ffdd5 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 40421c0cdad1 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c fe8dc0049e18 fe8dc0049e18 95acd19ee98c fe8dc0049e18 fe8dc0049e18 fe8dc0049e18 fe8dc0049e18 95acd19ee98c 95acd19ee98c fe8dc0049e18 fe8dc0049e18 fe8dc0049e18 fe8dc0049e18 95acd19ee98c 95acd19ee98c 95acd19ee98c 95acd19ee98c fe8dc0049e18 95acd19ee98c 95acd19ee98c 95acd19ee98c | #!/bin/bash
#
# Copyright (C) 2018, 2020, 2024 Branko Majic
#
# This file is part of Gimmecert.
#
# Gimmecert is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# Gimmecert is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# Gimmecert. If not, see <http://www.gnu.org/licenses/>.
#
# Provisioning script for the Vagrant test environment. Do not run
# outside of vagrant machine.
#
# Fail as soon as a command fails.
set -e
hostname=$(hostname)
if [[ $hostname != "gimmecert-testing" ]]; then
echo "Script should only be run on Vagrant testing machine."
exit 1
fi
# Update apt caches.
apt-get update -qq
# Install development tools.
apt-get install -qq -y git virtualenv
# Install Python build dependencies.
apt-get install -qq -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libffi-dev
# Import public keys for validating Python releases.
sudo -i -u vagrant gpg -q --import /vagrant/provision/python_releases_signing_keys.pub
# Download and build additional Python versions.
python_versions=("3.8.18" "3.9.18" "3.10.13" "3.11.8" "3.12.2")
work_directory="/home/vagrant/src"
echo "Setting-up work directory."
sudo -i -u vagrant mkdir -p "$work_directory"
for version in "${python_versions[@]}"; do
# Set-up information about Python version.
minor_version="${version%.[[:digit:]]*}"
interpreter="/usr/local/bin/python${minor_version}"
source_archive_link="https://www.python.org/ftp/python/${version}/Python-${version}.tar.xz"
source_archive="$work_directory/Python-${version}.tar.xz"
source_signature_link="https://www.python.org/ftp/python/${version}/Python-${version}.tar.xz.asc"
source_signature="${source_archive}.asc"
source="$work_directory/Python-${version}"
# Check if the Python version has already been installed or not.
if [[ ! -e $interpreter ]]; then
echo
echo
echo "Installing Python $version"
echo "=========================="
echo "Downloading..."
sudo -i -u vagrant wget -q -c -O "$source_archive" "$source_archive_link"
sudo -i -u vagrant wget -q -c -O "$source_signature" "$source_signature_link"
echo "Verifying signature..."
sudo -i -u vagrant gpg --quiet --trust-model always --verify "$source_signature" "$source_archive"
echo "Removing stale source files..."
rm -rf "$source"
echo "Unpacking source..."
sudo -i -u vagrant tar xf "$source_archive" -C "$work_directory"
echo "Configuring..."
sudo -i -u vagrant <<< "cd ${source}; ./configure --quiet"
echo "Building..."
sudo -i -u vagrant make --quiet -C "$source" -j3
echo "Installing..."
make --quiet -C "$source" altinstall
echo "Removing source files..."
rm -rf "$source"
fi
done
echo "Setting-up Python virtual environment for running tox."
if [[ ! -f /home/vagrant/virtualenv-tox/bin/activate ]]; then
sudo -i -u vagrant virtualenv --prompt '(tox) ' -q -p /usr/bin/python3 /home/vagrant/virtualenv-tox
fi
echo "Setting-up Python virtual environment activation on login."
bash_profile="/home/vagrant/.bash_profile"
if [[ ! -e $bash_profile ]] || ! grep -q "source /home/vagrant/virtualenv-tox/bin/activate" "$bash_profile"; then
echo 'source /home/vagrant/virtualenv-tox/bin/activate' >> "$bash_profile"
fi
echo "Cleaning-up Python byte-compiled files from repository directory."
sudo -i -u vagrant py3clean /vagrant/
echo "Installing development requirements."
sudo -i -u vagrant pip install -q -e "/vagrant[devel]"
echo
echo "SUCCESS: Ready for running tests."
|