Skip to content

Commit

Permalink
Update to 1.0.2 and add PostgreSQL 9.4 support
Browse files Browse the repository at this point in the history
  • Loading branch information
juliogonzalez committed Sep 13, 2015
1 parent 40a0e25 commit aeceb2a
Show file tree
Hide file tree
Showing 4 changed files with 162 additions and 26 deletions.
29 changes: 19 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,31 @@ tds_fdw

CentOS/RH/Amazon RPMs for tds_fdw <https://github.com/GeoffMontee/tds_fdw> and postgresql 9.3.4 or later

Tested on x64 CentOS 6.4 and Amazon Linux 2014.03
Tested on CentOS 6.4/7.1 x86_64 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.
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
------------

Use postgresql93\* packages for PostgreSQL 9.3 (>= 9.3.4) or posgresql94\* packages for PostgreSQL 9.4 (>= 9.4.1)

To build:

* freetds-devel
* postgresql93-devel
* postgresql93-devel or postgresql94-devel
* automake
* gcc-c++
* Git
* rpmbuild

To install the RPM
To install the RPM for PostgreSQL

* postgresql93 >= 9.3.4
* postgresql93-server >= 9.3.4
* postgresql93-libs >= 9.3.4
* postgresql93 >= 9.3.4 or postgresql94 >= 9.4.1
* postgresql93-server >= 9.3.4 or postgresql94-server >= 9.4.1
* postgresql93-libs >= 9.3.4 or postgresql94-libs >= 9.4.1
* freetds >= 0.91

Building fresh RPMs
Expand All @@ -43,8 +44,16 @@ Build the tds_fdw RPM

Build the RPMs:

./tds-fdw_rpm
./tds-fdw_rpm -p 9.3 for PostgreSQL 9.3

or

./tds-fdw_rpm -p 9.4 for PostgreSQL 9.4

And install:

rpm -Uvh RPMS/$HOSTTYPE/postgresql-93-tds_fdw-1.0.1-1.*.$HOSTTYPE.rpm
rpm -Uvh RPMS/$HOSTTYPE/postgresql-93-tds_fdw-1.0.2-1.*.$HOSTTYPE.rpm for PostgreSQL 9.3

or

rpm -Uvh RPMS/$HOSTTYPE/postgresql-94-tds_fdw-1.0.2-1.*.$HOSTTYPE.rpm for PostgreSQL 9.4
11 changes: 7 additions & 4 deletions SPECS/tds_fdw.spec → SPECS/tds_fdw-93.spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name: postgresql-93-tds_fdw
Version: 1.0.1
Version: 1.0.2
Release: 1%{?dist}
Summary: TDS foreing data wrapper for PostgreSQL 9.3

Expand All @@ -8,7 +8,7 @@ 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-server >= 9.3.4
Requires: postgresql93-libs >= 9.3.4
Requires: freetds >= 0.91

Expand All @@ -25,7 +25,7 @@ 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
%setup -q -n tds_fdw-1.0.2


%build
Expand All @@ -43,13 +43,16 @@ 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--1.0.2.sql
%attr(644, root, root)/usr/pgsql-9.3/share/extension/tds_fdw.control
%doc /usr/share/doc/%{name}-%{version}/README.md



%changelog

* Sun Sep 13 2015 Julio Gonzalez Gil <[email protected]> - 1.0.2
- 1.0.2 build from https://github.com/GeoffMontee/tds_fdw

* Thu Aug 28 2014 Julio Gonzalez Gil <[email protected]> - 1.0.1
- Initial build of 1.0.1 from https://github.com/GeoffMontee/tds_fdw
58 changes: 58 additions & 0 deletions SPECS/tds_fdw-94.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
Name: postgresql-94-tds_fdw
Version: 1.0.2
Release: 1%{?dist}
Summary: TDS foreing data wrapper for PostgreSQL 9.4

License: None
URL: https://github.com/GeoffMontee/tds_fdw
Source: https://github.com/GeoffMontee/tds_fdw/archive/v%{version}.tar.gz

Requires: postgresql94 >= 9.4.1
Requires: postgresql94-server >= 9.4.1
Requires: postgresql94-libs >= 9.4.1
Requires: freetds >= 0.91

BuildRequires: freetds-devel, postgresql94-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.2


%build
PATH=/usr/pgsql-9.4/bin:$PATH make USE_PGXS=1

%install
rm -rf %{buildroot}
PATH=/usr/pgsql-9.4/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.4/lib/tds_fdw.so
%attr(644, root, root)/usr/pgsql-9.4/share/extension/tds_fdw--1.0.2.sql
%attr(644, root, root)/usr/pgsql-9.4/share/extension/tds_fdw.control
%doc /usr/share/doc/%{name}-%{version}/README.md



%changelog

* Sun Sep 13 2015 Julio Gonzalez Gil <[email protected]> - 1.0.2
- 1.0.2 build from https://github.com/GeoffMontee/tds_fdw

* Thu Aug 28 2014 Julio Gonzalez Gil <[email protected]> - 1.0.1
- Initial build of 1.0.1 from https://github.com/GeoffMontee/tds_fdw
90 changes: 78 additions & 12 deletions tds_fdw-rpm
Original file line number Diff line number Diff line change
@@ -1,26 +1,92 @@
#!/bin/bash
function check_create_dir {

SCRIPT=$(basename ${0})
MODULE_VER="1.0.2"
VERSIONS="9.3 9.4"

function help() {
echo ""
echo "Script to build tds_fdw RPMs"
echo ""
echo "Syntax: "
echo ""
echo "${SCRIPT} -p <POSTGRESQL_MAJOR_VERSION>"
echo ""
echo "Where: "
echo " -p <POSTGRESQL_MAJOR_VERSION> PostgreSQL major version (format X.Y)"
echo ""
echo "Supported major versions:"
for version in ${VERSIONS}; do
echo "- $version"
done
echo ""
exit 1
}

function print_invalid_syntax() {
echo "Invalid syntax, use ${SCRIPT} -h"
}

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
function create_build_env() {
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
function get_sources() {
if [ ! -f "./SOURCES/v${1}.tar.gz" ]; then
wget "https://github.com/GeoffMontee/tds_fdw/archive/v${1}.tar.gz" -O "./SOURCES/v${1}.tar.gz"
fi
}

function build_rpm() {
PG_SVER=$(echo ${1} | tr -d '.')
rpmbuild --define "_topdir `pwd`" -ba "SPECS/tds_fdw-${PG_SVER}.spec"
return ${?}
}

rpmbuild --define "_topdir `pwd`" -ba 'SPECS/tds_fdw.spec'
# Parse options
while getopts "p:h" opts; do
case "${opts}" in
p) PG_VER=${OPTARG} ;;
h) help ;;
*) print_invalid_syntax
exit 1 ;;
esac
done
shift $((OPTIND-1))

if [ -z "${PG_VER}" ]; then
print_invalid_syntax
exit 1
fi
FOUND='FALSE'
for tver in ${VERSIONS}; do
if [ "${tver}" == "${PG_VER}" ]; then
FOUND='TRUE'
fi
done
if [ "${FOUND}" == 'FALSE' ]; then
echo "Invalid PostgreSQL major version"
exit 1
fi

create_build_env
get_sources ${MODULE_VER}
build_rpm ${PG_VER}
if [ $? -eq 0 ]; then
echo Your packages are available at $PWD/RPMS.
exit 0
else
echo There are errors. Check your log.
exit 2
fi

0 comments on commit aeceb2a

Please sign in to comment.