From 40a0e2538c8ec6d982eb25da69f6937279a70a6d Mon Sep 17 00:00:00 2001 From: Julio Gonzalez Gil Date: Thu, 28 Aug 2014 11:41:14 +0000 Subject: [PATCH] Initial commit --- README.md | 50 +++++++++++++++++++++++++++++++++++++++++ SPECS/tds_fdw.spec | 55 ++++++++++++++++++++++++++++++++++++++++++++++ clean | 2 ++ tds_fdw-rpm | 26 ++++++++++++++++++++++ 4 files changed, 133 insertions(+) create mode 100644 README.md create mode 100644 SPECS/tds_fdw.spec create mode 100755 clean create mode 100755 tds_fdw-rpm diff --git a/README.md b/README.md new file mode 100644 index 0000000..d90cdaa --- /dev/null +++ b/README.md @@ -0,0 +1,50 @@ +tds_fdw +======= + +CentOS/RH/Amazon RPMs for tds_fdw and postgresql 9.3.4 or later + +Tested on x64 CentOS 6.4 and Amazon Linux 2014.03 + +tds_fdw is a PostgreSQL foreign data wrapper that can connect to databases that use the Tabular Data Stream (TDS) protocol, such as Sybase databases and +Microsoft SQL server. + +It does not yet support write operations, as added in PostgreSQL 9.3. + +Requirements +------------ + +To build: + +* freetds-devel +* postgresql93-devel +* automake +* gcc-c++ +* Git +* rpmbuild + +To install the RPM + +* postgresql93 >= 9.3.4 +* postgresql93-server >= 9.3.4 +* postgresql93-libs >= 9.3.4 +* freetds >= 0.91 + +Building fresh RPMs +------------------- + +Clone the repo: + + git@github.com:juliogonzalez/tds_fdw-rpm.git + cd tds_fdw-rpm + + +Build the tds_fdw RPM +--------------------- + +Build the RPMs: + + ./tds-fdw_rpm + +And install: + + rpm -Uvh RPMS/$HOSTTYPE/postgresql-93-tds_fdw-1.0.1-1.*.$HOSTTYPE.rpm diff --git a/SPECS/tds_fdw.spec b/SPECS/tds_fdw.spec new file mode 100644 index 0000000..b238654 --- /dev/null +++ b/SPECS/tds_fdw.spec @@ -0,0 +1,55 @@ +Name: postgresql-93-tds_fdw +Version: 1.0.1 +Release: 1%{?dist} +Summary: TDS foreing data wrapper for PostgreSQL 9.3 + +License: None +URL: https://github.com/GeoffMontee/tds_fdw +Source: https://github.com/GeoffMontee/tds_fdw/archive/v%{version}.tar.gz + +Requires: postgresql93 >= 9.3.4 +Requires: postgresql93-server >= 9.3.4 +Requires: postgresql93-libs >= 9.3.4 +Requires: freetds >= 0.91 + +BuildRequires: freetds-devel, postgresql93-devel +BuildRequires: automake, gcc-c++ + +%description +This is a PostgreSQL foreign data wrapper that can connect to databases that +use the Tabular Data Stream (TDS) protocol, such as Sybase databases and +Microsoft SQL server. +. +It does not yet support write operations, as added in PostgreSQL 9.3. + +%global debug_package %{nil} + +%prep +%setup -q -n tds_fdw-1.0.1 + + +%build +PATH=/usr/pgsql-9.3/bin:$PATH make USE_PGXS=1 + +%install +rm -rf %{buildroot} +PATH=/usr/pgsql-9.3/bin:$PATH make USE_PGXS=1 install DESTDIR=%{buildroot} +mkdir %{buildroot}/usr/share/doc/%{name}-%{version} +mv %{buildroot}/usr/share/doc/pgsql/extension/README.tds_fdw.md %{buildroot}/usr/share/doc/%{name}-%{version}/README.md +rm -rf %{buildroot}/usr/share/doc/pgsql/extension/ + +%clean +rm -rf %{buildroot} + +%files +%attr(755, root, root)/usr/pgsql-9.3/lib/tds_fdw.so +%attr(644, root, root)/usr/pgsql-9.3/share/extension/tds_fdw--1.0.1.sql +%attr(644, root, root)/usr/pgsql-9.3/share/extension/tds_fdw.control +%doc /usr/share/doc/%{name}-%{version}/README.md + + + +%changelog + +* Thu Aug 28 2014 Julio Gonzalez Gil - 1.0.1 +- Initial build of 1.0.1 from https://github.com/GeoffMontee/tds_fdw diff --git a/clean b/clean new file mode 100755 index 0000000..211349d --- /dev/null +++ b/clean @@ -0,0 +1,2 @@ +#!/bin/bash +rm -rf BUILD/* BUILDROOT/* RPMS/* SRPMS/* SOURCES/*.tar.gz diff --git a/tds_fdw-rpm b/tds_fdw-rpm new file mode 100755 index 0000000..7d31dbc --- /dev/null +++ b/tds_fdw-rpm @@ -0,0 +1,26 @@ +#!/bin/bash +function check_create_dir { + if [ ! -d "./$1" ]; then + mkdir "./$1" + fi +} + +# Create build environment +check_create_dir BUILD +check_create_dir BUILDROOT +check_create_dir RPMS +check_create_dir SOURCES +check_create_dir SPECS +check_create_dir SRPMS + +if [ ! -f './SOURCES/v1.0.1.tar.gz' ]; then + wget 'https://github.com/GeoffMontee/tds_fdw/archive/v1.0.1.tar.gz' -O './SOURCES/v1.0.1.tar.gz' +fi + +rpmbuild --define "_topdir `pwd`" -ba 'SPECS/tds_fdw.spec' + +if [ $? -eq 0 ]; then + echo Your packages are available at $PWD/RPMS. +else + echo There are errors. Check your log. +fi