1
1
mirror of https://github.com/dbcli/pgcli.git synced 2024-09-11 13:56:36 +03:00

Merge pull request #199 from ceocoder/add_deb_packaging

Packaging: first cut of working deb and rpm build
This commit is contained in:
Amjith Ramanujam 2015-04-14 21:57:55 -07:00
commit c7f173d4ca
4 changed files with 109 additions and 1 deletions

9
.gitignore vendored
View File

@ -56,4 +56,11 @@ target/
# PyCharm
.idea/
*.iml
*.iml
# Vagrant
.vagrant/
# Generated Packages
*.deb
*.rpm

93
Vagrantfile vendored Normal file
View File

@ -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

4
post-install Normal file
View File

@ -0,0 +1,4 @@
#!/bin/bash
echo "Setting up symlink to pgcli"
ln -sf /usr/share/pgcli/bin/pgcli /usr/local/bin/pgcli

4
post-remove Normal file
View File

@ -0,0 +1,4 @@
#!/bin/bash
echo "Removing symlink to pgcli"
rm /usr/local/bin/pgcli