Skip to content

Commit

Permalink
tds_fdw 2.0.1, PostgreSQL12, SPEC cleanup, SUSE/openSUSE support
Browse files Browse the repository at this point in the history
  • Loading branch information
juliogonzalez committed Jan 28, 2020
1 parent 7cb8dbf commit b049006
Show file tree
Hide file tree
Showing 10 changed files with 427 additions and 185 deletions.
31 changes: 31 additions & 0 deletions README.opensuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
For openSUSE we still do not have CI, but at least some quick tests can be performed.

First, start a container for the most recent lean version:
```
docker run -ti --rm opensuse/leap /bin/bash
```

Then see what Leap version the container is:
```
cat /etc/os-release
```

Finally run the following commands, after adapting `PGVER`, `LEAPVER` and `BRANCH`as needed.
```
PGVER=12
LEAPVER=15.1
BRANCH=master
PGSVER=$(echo $PGVER|sed -e 's/\.//g')
zypper ar http://download.opensuse.org/repositories/server:/database:/postgresql/openSUSE_Leap_${LEAPVER}/server:database:postgresql.repo
zypper --gpg-auto-import-keys ref
zypper in -y gcc git curl freetds-devel freetds make rpm-build postgresql${PGSVER} postgresql${PGSVER}-devel postgresql${PGSVER}-server postgresql${PGSVER}-server-devel # server-devel only needed for >= 11
git clone https://github.com/tds-fdw/rpm.git
cd rpm
git checkout ${BRANCH}
./clean
./tds_fdw-rpm -p ${PGVER}
mkdir /var/lib/pgsql/data/
chown -R postgres. /var/lib/pgsql/data/
su - postgres /usr/share/postgresql/postgresql-script start
su - postgres -c "psql -c 'CREATE EXTENSION tds_fdw;'"
su - postgres -c "psql -c '\dx'"
73 changes: 45 additions & 28 deletions SPECS/tds_fdw-10.spec
Original file line number Diff line number Diff line change
@@ -1,59 +1,76 @@
Name: postgresql-10-tds_fdw
Version: 2.0.0
Release: alpha.3.2%{?dist}
Summary: TDS foreing data wrapper for PostgreSQL 10.0
%define PG_VER 10
%define PG_SVER 10

Name: postgresql-%{PG_SVER}-tds_fdw
Version: 2.0.1
Release: 0%{?dist}
Summary: TDS foreing data wrapper for PostgreSQL %{PG_VER}
License: None
URL: https://github.com/tds-fdw/tds_fdw
Source: https://github.com/tds-fdw/tds_fdw/archive/v2.0.0-alpha.3.tar.gz
Source: https://github.com/tds-fdw/tds_fdw/archive/v%{version}.tar.gz

Provides: tds_fdw10
Provides: tds_fdw%{PG_SVER}

Requires: postgresql10 >= 10.0
Requires: postgresql10-server >= 10.0
Requires: postgresql10-libs >= 10.0
Requires: postgresql%{PG_SVER} >= %{PG_VER}.0
Requires: postgresql%{PG_SVER}-server >= %{PG_VER}.0
%if ! 0%{?suse_version}
Requires: postgresql%{PG_SVER}-libs >= %{PG_VER}.0
%endif
Requires: freetds >= 0.91

BuildRequires: gcc
BuildRequires: freetds-devel
BuildRequires: make
BuildRequires: postgresql10-devel
BuildRequires: postgresql%{PG_SVER}-devel

%if 0%{?suse_version}
%define PG_BIN %{_prefix}/lib/postgresql%{PG_SVER}/bin
%define PG_LIB %{_prefix}/lib/postgresql%{PG_SVER}/%{_lib}
%define PG_DATA %{_datadir}/postgresql%{PG_SVER}
%define PG_DOC %{_docdir}/postgresql%{PG_SVER}/extension
%define MOD_DOC %{_docdir}/%{name}
%else
%define PG_BIN %{_prefix}/pgsql-%{PG_VER}/bin
%define PG_LIB %{_prefix}/pgsql-%{PG_VER}/lib
%define PG_DATA %{_prefix}/pgsql-%{PG_VER}/share
%define PG_DOC %{_prefix}/pgsql-%{PG_VER}/doc/extension
%define MOD_DOC %{_docdir}/%{name}
%endif

%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.
It does not yet support write operations, as added in PostgreSQL %{PG_VER}.

%global debug_package %{nil}

%prep
%setup -q -n tds_fdw-2.0.0-alpha.3

%setup -q -n tds_fdw-%{version}

%build
PATH=/usr/pgsql-10/bin:$PATH make USE_PGXS=1
PATH=%{PG_BIN}/:$PATH make USE_PGXS=1

%install
rm -rf %{buildroot}
PATH=/usr/pgsql-10/bin:$PATH make USE_PGXS=1 install DESTDIR=%{buildroot}
mkdir -p %{buildroot}/usr/share/doc/%{name}-%{version}
mv %{buildroot}/usr/pgsql-10/doc/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}
PATH=%{PG_BIN}/:$PATH make USE_PGXS=1 install DESTDIR=%{buildroot}
mkdir -p %{buildroot}%{MOD_DOC}
mv %{buildroot}%{PG_DOC}/README.tds_fdw.md %{buildroot}%{MOD_DOC}/README.md

%files
%attr(755, root, root)/usr/pgsql-10/lib/tds_fdw.so
%attr(644, root, root)/usr/pgsql-10/share/extension/tds_fdw--2.0.0-alpha.3.sql
%attr(644, root, root)/usr/pgsql-10/share/extension/tds_fdw.control
%doc /usr/share/doc/%{name}-%{version}/README.md


%attr(755, root, root)%{PG_LIB}/tds_fdw.so
%dir %attr(755, root, root)%{PG_DATA}
%dir %attr(755, root, root)%{PG_DATA}/extension
%attr(644, root, root)%{PG_DATA}/extension/tds_fdw--%{version}.sql
%attr(644, root, root)%{PG_DATA}/extension/tds_fdw.control
%dir %attr(755, root, root)%{MOD_DOC}
%doc %{MOD_DOC}/README.md

%changelog
* Tue Dec 03 2019 Julio Gonzalez Gil <[email protected]> 2.0.1-0
- 2.0.1 from https://github.com/tds-fdw/tds_fdw
- SPEC cleanup to allow easier maintenance
- Compatibility with SUSE/openSUSE

* Sat Jan 19 2019 Julio Gonzalez Gil <[email protected]> 2.0.0-alpha.3.2
- Allow upgrades from official PostgreSQL packages
Expand Down
95 changes: 59 additions & 36 deletions SPECS/tds_fdw-11.spec
Original file line number Diff line number Diff line change
@@ -1,69 +1,92 @@
Name: postgresql-11-tds_fdw
Version: 2.0.0
Release: alpha.3.2%{?dist}
Summary: TDS foreing data wrapper for PostgreSQL 11
%define PG_VER 11
%define PG_SVER 11

Name: postgresql-%{PG_SVER}-tds_fdw
Version: 2.0.1
Release: 0%{?dist}
Summary: TDS foreing data wrapper for PostgreSQL %{PG_VER}
License: None
URL: https://github.com/tds-fdw/tds_fdw
Source: https://github.com/tds-fdw/tds_fdw/archive/v2.0.0-alpha.3.tar.gz
Source: https://github.com/tds-fdw/tds_fdw/archive/v%{version}.tar.gz

Provides: tds_fdw10
Provides: tds_fdw%{PG_SVER}

Requires: postgresql11 >= 11.0
Requires: postgresql11-server >= 11.0
Requires: postgresql11-libs >= 11.0
Requires: postgresql%{PG_SVER} >= %{PG_VER}.0
Requires: postgresql%{PG_SVER}-server >= %{PG_VER}.0
%if ! 0%{?suse_version}
Requires: postgresql%{PG_SVER}-libs >= %{PG_VER}.0
%endif
Requires: freetds >= 0.91

BuildRequires: gcc
BuildRequires: freetds-devel
BuildRequires: make
BuildRequires: postgresql11-devel
%if 0%{?rhel} >= 7
BuildRequires: llvm-toolset-7-clang
BuildRequires: llvm5.0
%if 0%{?suse_version}
BuildRequires: postgresql%{PG_SVER}-server-devel
%else
BuildRequires: postgresql%{PG_SVER}-devel
%endif

%if 0%{?suse_version}
%define PG_BIN %{_prefix}/lib/postgresql%{PG_SVER}/bin
%define PG_LIB %{_prefix}/lib/postgresql%{PG_SVER}/%{_lib}
%define PG_DATA %{_datadir}/postgresql%{PG_SVER}
%define PG_DOC %{_docdir}/postgresql%{PG_SVER}/extension
%define MOD_DOC %{_docdir}/%{name}
%if 0%{?suse_version} >= 1500
%define PG_BITCODEDIR %{_prefix}/lib/postgresql%{PG_SVER}/%{_lib}/bitcode
%endif
%else
%define PG_BIN %{_prefix}/pgsql-%{PG_VER}/bin
%define PG_LIB %{_prefix}/pgsql-%{PG_VER}/lib
%define PG_DATA %{_prefix}/pgsql-%{PG_VER}/share
%define PG_DOC %{_prefix}/pgsql-%{PG_VER}/doc/extension
%define MOD_DOC %{_docdir}/%{name}
%if 0%{?rhel} >= 7
%define PG_BITCODEDIR /usr/pgsql-%{PG_VER}/lib/bitcode/
%endif
%endif

%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.
It does not yet support write operations, as added in PostgreSQL %{PG_VER}.

%global debug_package %{nil}

%prep
%setup -q -n tds_fdw-2.0.0-alpha.3

%setup -q -n tds_fdw-%{version}

%build
PATH=/usr/pgsql-11/bin:$PATH make USE_PGXS=1
PATH=%{PG_BIN}/:$PATH make USE_PGXS=1

%install
rm -rf %{buildroot}
PATH=/usr/pgsql-11/bin:$PATH make USE_PGXS=1 install DESTDIR=%{buildroot}
mkdir -p %{buildroot}/usr/share/doc/%{name}-%{version}
mv %{buildroot}/usr/pgsql-11/doc/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}
PATH=%{PG_BIN}/:$PATH make USE_PGXS=1 install DESTDIR=%{buildroot}
mkdir -p %{buildroot}%{MOD_DOC}
mv %{buildroot}%{PG_DOC}/README.tds_fdw.md %{buildroot}%{MOD_DOC}/README.md

%files
%attr(755, root, root)/usr/pgsql-11/lib/tds_fdw.so
%if 0%{?rhel} >= 7
%attr(644, root, root)/usr/pgsql-11/lib/bitcode/tds_fdw.index.bc
%attr(644, root, root)/usr/pgsql-11/lib/bitcode/tds_fdw/src/deparse.bc
%attr(644, root, root)/usr/pgsql-11/lib/bitcode/tds_fdw/src/options.bc
%attr(644, root, root)/usr/pgsql-11/lib/bitcode/tds_fdw/src/tds_fdw.bc
%attr(755, root, root)%{PG_LIB}/tds_fdw.so
%dir %attr(755, root, root)%{PG_DATA}
%dir %attr(755, root, root)%{PG_DATA}/extension
%attr(644, root, root)%{PG_DATA}/extension/tds_fdw--%{version}.sql
%attr(644, root, root)%{PG_DATA}/extension/tds_fdw.control
%dir %attr(755, root, root)%{MOD_DOC}
%doc %{MOD_DOC}/README.md
%if 0%{?rhel} >= 7 || 0%{?suse_version} >= 1500
%attr(644, root, root)%{PG_BITCODEDIR}/tds_fdw.index.bc
%attr(644, root, root)%{PG_BITCODEDIR}/tds_fdw/src/deparse.bc
%attr(644, root, root)%{PG_BITCODEDIR}/tds_fdw/src/options.bc
%attr(644, root, root)%{PG_BITCODEDIR}/tds_fdw/src/tds_fdw.bc
%endif
%attr(644, root, root)/usr/pgsql-11/share/extension/tds_fdw--2.0.0-alpha.3.sql
%attr(644, root, root)/usr/pgsql-11/share/extension/tds_fdw.control
%doc /usr/share/doc/%{name}-%{version}/README.md



%changelog
* Tue Dec 03 2019 Julio Gonzalez Gil <[email protected]> 2.0.1-0
- 2.0.1 from https://github.com/tds-fdw/tds_fdw
- SPEC cleanup to allow easier maintenance
- Compatibility with SUSE/openSUSE

* Sat Jan 19 2019 Julio Gonzalez Gil <[email protected]> 2.0.0-alpha.3.2
- Allow upgrades from official PostgreSQL packages
Expand Down
89 changes: 89 additions & 0 deletions SPECS/tds_fdw-12.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
%define PG_VER 12
%define PG_SVER 12

Name: postgresql-%{PG_SVER}-tds_fdw
Version: 2.0.1
Release: 0%{?dist}
Summary: TDS foreing data wrapper for PostgreSQL %{PG_VER}
License: None
URL: https://github.com/tds-fdw/tds_fdw
Source: https://github.com/tds-fdw/tds_fdw/archive/v%{version}.tar.gz

Provides: tds_fdw%{PG_SVER}

Requires: postgresql%{PG_SVER} >= %{PG_VER}.0
Requires: postgresql%{PG_SVER}-server >= %{PG_VER}.0
%if ! 0%{?suse_version}
Requires: postgresql%{PG_SVER}-libs >= %{PG_VER}.0
%endif
Requires: freetds >= 0.91

BuildRequires: gcc
BuildRequires: freetds-devel
BuildRequires: make
%if 0%{?suse_version}
BuildRequires: postgresql%{PG_SVER}-server-devel
%else
BuildRequires: postgresql%{PG_SVER}-devel
%endif

%if 0%{?suse_version}
%define PG_BIN %{_prefix}/lib/postgresql%{PG_SVER}/bin
%define PG_LIB %{_prefix}/lib/postgresql%{PG_SVER}/%{_lib}
%define PG_DATA %{_datadir}/postgresql%{PG_SVER}
%define PG_DOC %{_docdir}/postgresql%{PG_SVER}/extension
%define MOD_DOC %{_docdir}/%{name}
%if 0%{?suse_version} >= 1500
%define PG_BITCODEDIR %{_prefix}/lib/postgresql%{PG_SVER}/%{_lib}/bitcode
%endif
%else
%define PG_BIN %{_prefix}/pgsql-%{PG_VER}/bin
%define PG_LIB %{_prefix}/pgsql-%{PG_VER}/lib
%define PG_DATA %{_prefix}/pgsql-%{PG_VER}/share
%define PG_DOC %{_prefix}/pgsql-%{PG_VER}/doc/extension
%define MOD_DOC %{_docdir}/%{name}
%if 0%{?rhel} >= 7
%define PG_BITCODEDIR /usr/pgsql-%{PG_VER}/lib/bitcode/
%endif
%endif

%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 %{PG_VER}.

%global debug_package %{nil}

%prep
%setup -q -n tds_fdw-%{version}

%build
PATH=%{PG_BIN}/:$PATH make USE_PGXS=1

%install
PATH=%{PG_BIN}/:$PATH make USE_PGXS=1 install DESTDIR=%{buildroot}
mkdir -p %{buildroot}%{MOD_DOC}
mv %{buildroot}%{PG_DOC}/README.tds_fdw.md %{buildroot}%{MOD_DOC}/README.md

%files
%attr(755, root, root)%{PG_LIB}/tds_fdw.so
%dir %attr(755, root, root)%{PG_DATA}
%dir %attr(755, root, root)%{PG_DATA}/extension
%attr(644, root, root)%{PG_DATA}/extension/tds_fdw--%{version}.sql
%attr(644, root, root)%{PG_DATA}/extension/tds_fdw.control
%dir %attr(755, root, root)%{MOD_DOC}
%doc %{MOD_DOC}/README.md
%if 0%{?rhel} >= 7 || 0%{?suse_version} >= 1500
%attr(644, root, root)%{PG_BITCODEDIR}/tds_fdw.index.bc
%attr(644, root, root)%{PG_BITCODEDIR}/tds_fdw/src/deparse.bc
%attr(644, root, root)%{PG_BITCODEDIR}/tds_fdw/src/options.bc
%attr(644, root, root)%{PG_BITCODEDIR}/tds_fdw/src/tds_fdw.bc
%endif

%changelog
* Tue Dec 03 2019 Julio Gonzalez Gil <[email protected]> 2.0.1-0
- 2.0.1 from https://github.com/tds-fdw/tds_fdw
- SPEC cleanup to allow easier maintenance
- Compatibility with SUSE/openSUSE
Loading

0 comments on commit b049006

Please sign in to comment.