diff options
author | Dhaivat Pandit <me@dhaiv.at> | 2015-04-11 11:27:19 -0700 |
---|---|---|
committer | Dhaivat Pandit <me@dhaiv.at> | 2015-04-11 14:42:18 -0700 |
commit | b8d52953820085eeba47bfde3b51b89a68bc0f8f (patch) | |
tree | 9a7352f90d815acbfe186ab56791435a739631ec /Vagrantfile | |
parent | 4161f66ccaacc57b445f1a1add35c429de84c63a (diff) |
Packaging: first cut of working deb and rpm build
* to build deb & rpm simply run
```
version=<se.mv.er> vagrant provision
```
vagrant shell provisioner will run the inline script and generate
a deb and an rpm file in the local directory. This is achieved by
multivm Vagrantfile one for centos and one for debian
* To install the generated deb - run sudo dpkg -i
* /pgcli/pgcli_<se.mv.er>.deb (then sudo apt-get install -f if deps
are missing on a clean debian install)
* To install generated rpm - sudo yum install path-to-rpm
* package will be installed under /usr/share/pgcli
* script pgcli will be a symlink in /usr/local/bin/pgcli ->
/usr/share/pgcli/bin/pgcli (with right shebang line
#!/usr/share/pgcli/bin/python)
Diffstat (limited to 'Vagrantfile')
-rw-r--r-- | Vagrantfile | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 00000000..13928122 --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,93 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure(2) do |config| + + config.vm.synced_folder ".", "/pgcli" + + pgcli_version = ENV['version'] + pgcli_description = "Postgres CLI with autocompletion and syntax highlighting" + + config.vm.define "debian" do |debian| + debian.vm.box = "chef/debian-7.8" + debian.vm.provision "shell", inline: <<-SHELL + echo "-> Building DEB on `lsb_release -s`" + 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 gem install fpm + 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" + cd build/usr/share/pgcli + virtualenv-tools --update-path /usr/share/pgcli > /dev/null + cd /home/vagrant/ + + echo "-> Removing compiled files" + find build -iname '*.pyc' -delete + find build -iname '*.pyo' -delete + + echo "-> Creating PgCLI deb" + sudo fpm -t deb -s dir -C build -n pgcli -v #{pgcli_version} \ + -a all \ + -d libpq-dev \ + -d python-dev \ + -p /pgcli/ \ + --after-install /pgcli/post-install \ + --after-remove /pgcli/post-remove \ + --url https://github.com/amjith/pgcli \ + --description "#{pgcli_description}" \ + --license '??? #TODO(amjith)' + SHELL + end + + config.vm.define "centos" do |centos| + centos.vm.box = "chef/centos-7.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 "-> 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" + cd build/usr/share/pgcli + virtualenv-tools --update-path /usr/share/pgcli > /dev/null + cd /home/vagrant/ + + echo "-> Removing compiled files" + find build -iname '*.pyc' -delete + find build -iname '*.pyo' -delete + + echo "-> Creating PgCLI RPM" + echo $PATH + sudo /usr/local/bin/fpm -t rpm -s dir -C build -n pgcli -v #{pgcli_version} \ + -a all \ + -d postgresql-devel \ + -d python-devel \ + -p /pgcli/ \ + --after-install /pgcli/post-install \ + --after-remove /pgcli/post-remove \ + --url https://github.com/amjith/pgcli \ + --description "#{pgcli_description}" \ + --license '??? #TODO(amjith)' + SHELL + end + +end + |