diff --git a/Vagrantfile b/Vagrantfile index 0313520f..297e70ae 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,5 +1,7 @@ # -*- mode: ruby -*- # vi: set ft=ruby : +# +# Vagrant.configure(2) do |config| @@ -9,20 +11,23 @@ Vagrant.configure(2) do |config| pgcli_description = "Postgres CLI with autocompletion and syntax highlighting" config.vm.define "debian" do |debian| - debian.vm.box = "chef/debian-7.8" + debian.vm.box = "bento/debian-10.8" debian.vm.provision "shell", inline: <<-SHELL - echo "-> Building DEB on `lsb_release -s`" + echo "-> Building DEB on `lsb_release -d`" sudo apt-get update sudo apt-get install -y libpq-dev python-dev python-setuptools rubygems - sudo easy_install pip - sudo pip install virtualenv virtualenv-tools + sudo apt install -y python3-pip + sudo pip3 install --no-cache-dir virtualenv virtualenv-tools3 + sudo apt-get install -y ruby-dev + sudo apt-get install -y git + sudo apt-get install -y rpm librpmbuild8 + sudo gem install fpm + echo "-> Cleaning up old workspace" - rm -rf build + sudo rm -rf build mkdir -p build/usr/share virtualenv build/usr/share/pgcli - build/usr/share/pgcli/bin/pip install -U pip distribute - build/usr/share/pgcli/bin/pip uninstall -y distribute build/usr/share/pgcli/bin/pip install /pgcli echo "-> Cleaning Virtualenv" @@ -45,24 +50,59 @@ Vagrant.configure(2) do |config| --url https://github.com/dbcli/pgcli \ --description "#{pgcli_description}" \ --license 'BSD' + SHELL end + +# This is considerably more messy than the debian section. I had to go off-standard to update +# some packages to get this to work. + config.vm.define "centos" do |centos| - centos.vm.box = "chef/centos-7.0" + + centos.vm.box = "bento/centos-7.9" + centos.vm.box_version = "202012.21.0" centos.vm.provision "shell", inline: <<-SHELL #!/bin/bash - echo "-> Building RPM on `lsb_release -s`" - sudo yum install -y rpm-build gcc ruby-devel postgresql-devel python-devel rubygems - sudo easy_install pip - sudo pip install virtualenv virtualenv-tools - sudo gem install fpm + echo "-> Building RPM on `hostnamectl | grep "Operating System"`" + export PATH=/usr/local/rvm/gems/ruby-2.6.3/bin:/usr/local/rvm/gems/ruby-2.6.3@global/bin:/usr/local/rvm/rubies/ruby-2.6.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/rvm/bin:/root/bin + echo "PATH -> " $PATH + +##### +### get base updates + + sudo yum install -y rpm-build gcc postgresql-devel python-devel python3-pip git python3-devel + +###### +### install FPM, which we need to install to get an up-to-date version of ruby, which we need for git + + echo "-> Get FPM installed" + # import the necessary GPG keys + gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB + sudo gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB + # install RVM + sudo curl -sSL https://get.rvm.io | sudo bash -s stable + sudo usermod -aG rvm vagrant + sudo usermod -aG rvm root + sudo /usr/local/rvm/bin/rvm alias create default 2.6.3 + source /etc/profile.d/rvm.sh + + # install a newer version of ruby. centos7 only comes with ruby2.0.0, which isn't good enough for git. + sudo yum install -y ruby-devel + sudo /usr/local/rvm/bin/rvm install 2.6.3 + + # + # yes,this gives an error about generating doc but we don't need the doc. + + /usr/local/rvm/gems/ruby-2.6.3/wrappers/gem install fpm + +###### + + sudo pip3 install virtualenv virtualenv-tools3 echo "-> Cleaning up old workspace" rm -rf build mkdir -p build/usr/share virtualenv build/usr/share/pgcli - build/usr/share/pgcli/bin/pip install -U pip distribute - build/usr/share/pgcli/bin/pip uninstall -y distribute build/usr/share/pgcli/bin/pip install /pgcli echo "-> Cleaning Virtualenv" @@ -74,9 +114,9 @@ Vagrant.configure(2) do |config| find build -iname '*.pyc' -delete find build -iname '*.pyo' -delete + cd /home/vagrant echo "-> Creating PgCLI RPM" - echo $PATH - sudo /usr/local/bin/fpm -t rpm -s dir -C build -n pgcli -v #{pgcli_version} \ + /usr/local/rvm/gems/ruby-2.6.3/gems/fpm-1.12.0/bin/fpm -t rpm -s dir -C build -n pgcli -v #{pgcli_version} \ -a all \ -d postgresql-devel \ -d python-devel \ @@ -86,8 +126,13 @@ Vagrant.configure(2) do |config| --url https://github.com/dbcli/pgcli \ --description "#{pgcli_description}" \ --license 'BSD' - SHELL + + + SHELL + + end + end