From b9e584586e6920df805338b3c2ba156c41c9eca8 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Tue, 31 Dec 2013 17:07:49 +0100 Subject: [PATCH] Add RPM packaging for CentOS, with Vagrant provision for this OS. --- Makefile | 20 +++++++------- Vagrantfile | 20 +++++++++++--- bootstrap-centos.sh | 23 +++++++++++++++ bootstrap.sh => bootstrap-debian.sh | 0 pgloader.spec | 43 +++++++++++++++++++++++++++++ 5 files changed, 92 insertions(+), 14 deletions(-) create mode 100644 bootstrap-centos.sh rename bootstrap.sh => bootstrap-debian.sh (100%) create mode 100644 pgloader.spec diff --git a/Makefile b/Makefile index 59862a3..fca2a4a 100644 --- a/Makefile +++ b/Makefile @@ -78,26 +78,26 @@ $(PGLOADER): manifest buildapp pgloader: $(PGLOADER) ; -new-vm: - vagrant destroy -f - vagrant up - -vm: - vagrant up - -vm-build: vm - vagrant ssh -c "make -C /vagrant" - test: $(MAKE) PGLOADER=$(realpath $(PGLOADER)) -C test all deb: + # intended for use on a debian system mkdir -p $(DEBUILD_ROOT) && rm -rf $(DEBUILD_ROOT)/* rsync -Ca --exclude=build/* ./ $(DEBUILD_ROOT)/ cd $(DEBUILD_ROOT) && make -f debian/rules orig cd $(DEBUILD_ROOT) && debuild -us -uc -sa cp -a /tmp/pgloader_* build/ +rpm: + # intended for use on a CentOS or other RPM based system + mkdir -p $(DEBUILD_ROOT) && rm -rf $(DEBUILD_ROOT)/* + rsync -Ca --exclude=build/* ./ $(DEBUILD_ROOT)/ + cd /tmp && tar czf $(HOME)/rpmbuild/SOURCES/pgloader-3.0.96.tar.gz pgloader + cd $(DEBUILD_ROOT) && rpmbuild -ba pgloader.spec + cp -a $(HOME)/rpmbuild/SRPMS/*rpm build + cp -a $(HOME)/rpmbuild/RPMS/x86_64/*rpm build + check: test ; .PHONY: test diff --git a/Vagrantfile b/Vagrantfile index 5cc4217..becf8ca 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -5,10 +5,22 @@ VAGRANTFILE_API_VERSION = "2" Vagrant.configure("2") do |config| - config.vm.box = "wheezy64" - config.vm.provision "shell" do |s| - s.path = "bootstrap.sh" - s.privileged = false + config.vm.define "wheezy" do |wheezy| + wheezy.vm.box = "wheezy64" + + config.vm.provision "shell" do |s| + s.path = "bootstrap-debian.sh" + s.privileged = false + end + end + + config.vm.define "centos" do |centos| + centos.vm.box = "CentOS64" + + config.vm.provision "shell" do |s| + s.path = "bootstrap-centos.sh" + s.privileged = false + end end end diff --git a/bootstrap-centos.sh b/bootstrap-centos.sh new file mode 100644 index 0000000..d65d51b --- /dev/null +++ b/bootstrap-centos.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +sudo yum -y install yum-utils @development-tools sbcl sqlite-devel + +# SBCL 1.1.14 +# http://www.mikeivanov.com/post/66510551125/installing-sbcl-1-1-on-rhel-centos-systems +sudo yum -y groupinstall "Development Tools" +wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm +sudo rpm -Uvh epel-release-6*.rpm +sudo yum install -y sbcl.x86_64 + +wget http://downloads.sourceforge.net/project/sbcl/sbcl/1.1.14/sbcl-1.1.14-source.tar.bz2 +tar xfj sbcl-1.1.14-source.tar.bz2 +cd sbcl-1.1.14 +./make.sh --with-sb-thread --with-sb-core-compression > /dev/null 2>&1 +sudo sh install.sh +cd + +# remove the old version that we used to compile the newer one. +sudo yum remove -y sbcl + +# pgloader +#make -C /vagrant rpm diff --git a/bootstrap.sh b/bootstrap-debian.sh similarity index 100% rename from bootstrap.sh rename to bootstrap-debian.sh diff --git a/pgloader.spec b/pgloader.spec new file mode 100644 index 0000000..52375f9 --- /dev/null +++ b/pgloader.spec @@ -0,0 +1,43 @@ +Summary: extract, transform and load data into PostgreSQL +Name: pgloader +Version: 3.0.96 +Release: 21%{?dist} +License: The PostgreSQL Licence +Group: System Environment/Base +Source: %{name}-%{version}.tar.gz +URL: https://github.com/dimitri/pgloader + +%description +pgloader imports data from different kind of sources and COPY it into +PostgreSQL. + +The command language is described in the manual page and allows to describe +where to find the data source, its format, and to describe data processing +and transformation. + +Supported source formats include CSV, fixed width flat files, dBase3 files +(DBF), and SQLite and MySQL databases. In most of those formats, pgloader is +able to auto-discover the schema and create the tables and the indexes in +PostgreSQL. In the MySQL case it's possible to edit CASTing rules from the +pgloader command directly. + +%prep +%setup -q -n %{name} + +%build +%define debug_package %{nil} +make pgloader + +%install +install -m 755 -d %{buildroot}/%{_bindir} +cp build/pgloader.exe %{buildroot}/%{_bindir}/pgloader + +%files +%doc README.md pgloader.1.md +%{_bindir}/* + +%changelog +* Tue Dec 31 2013 Dimitri Fontaine 3.0.96 +- Package as an RPM + +%global __os_install_post %{nil}