OBS-URL: https://build.opensuse.org/request/show/227352 OBS-URL: https://build.opensuse.org/package/show/devel:languages:erlang/erlang-epgsql?expand=0&rev=2
105 lines
3.6 KiB
RPMSpec
105 lines
3.6 KiB
RPMSpec
#
|
|
# spec file for package erlang-epgsql
|
|
#
|
|
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
|
#
|
|
# All modifications and additions to the file contributed by third parties
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
# upon. The license for this file, and modifications and additions to the
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
# license for the pristine package is not an Open Source License, in which
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
# published by the Open Source Initiative.
|
|
|
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
|
#
|
|
|
|
|
|
%define app_name epgsql
|
|
Name: erlang-%{app_name}
|
|
Version: 1.4+git20140314.59d416b
|
|
Release: 0
|
|
%define app_ver %(echo "%{version}" | cut -d "+" -f1)
|
|
Summary: Erlang PostgreSQL client
|
|
License: BSD-3-Clause
|
|
Group: Development/Libraries/Other
|
|
Url: https://github.com/epgsql/epgsql
|
|
Source: %{app_name}-%{version}.tar.bz2
|
|
# PATCH-FIX-UPSTREAM fix_tests.patch - matwey.kornilov@gmail.com
|
|
Patch0: fix_tests.patch
|
|
BuildRequires: erlang
|
|
BuildRequires: erlang-dialyzer
|
|
BuildRequires: erlang-rebar
|
|
BuildRequires: postgresql-contrib >= 9.0
|
|
BuildRequires: postgresql-devel >= 9.0
|
|
BuildRequires: postgresql-server >= 9.0
|
|
BuildRequires: timezone
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
|
|
%description
|
|
Erlang PostgreSQL client.
|
|
|
|
%prep
|
|
%setup -q -n %{app_name}-%{version}
|
|
%patch0 -p1
|
|
|
|
%build
|
|
sed -i src/epgsql.app.src -e 's/git/"'%{app_ver}'"/'
|
|
make clean
|
|
make compile
|
|
|
|
%install
|
|
for dir in ebin include ; do
|
|
mkdir -p %{buildroot}%{erlang_libdir}/%{app_name}-%{app_ver}/${dir}
|
|
cp -r ${dir}/* %{buildroot}%{erlang_libdir}/%{app_name}-%{app_ver}/${dir}/
|
|
done
|
|
|
|
%check
|
|
# setup test env
|
|
initdb --locale en_GB.UTF-8 pgsql
|
|
echo "ssl = on" >> pgsql/postgresql.conf
|
|
if [[ $(perl -e 'print shift cmp shift' $(/usr/bin/pg_config --version | awk '{print $2}') "9.2") -ge 0 ]]
|
|
then
|
|
echo "ssl_ca_file = 'root.crt'" >> pgsql/postgresql.conf
|
|
fi
|
|
cp test_data/epgsql.crt pgsql/server.crt
|
|
cp test_data/epgsql.key pgsql/server.key
|
|
cp test_data/root.crt pgsql/root.crt
|
|
cp test_data/root.key pgsql/root.key
|
|
chmod 0600 pgsql/server.key
|
|
cat > pgsql/pg_hba.conf <<EOF
|
|
local all $USER trust
|
|
host $USER $USER 127.0.0.1/32 trust
|
|
host epgsql_test_db1 $USER 127.0.0.1/32 trust
|
|
host epgsql_test_db1 epgsql_test 127.0.0.1/32 trust
|
|
host epgsql_test_db1 epgsql_test_md5 127.0.0.1/32 md5
|
|
host epgsql_test_db1 epgsql_test_cleartext 127.0.0.1/32 password
|
|
hostssl epgsql_test_db1 epgsql_test_cert 127.0.0.1/32 cert
|
|
EOF
|
|
/usr/bin/pg_ctl start -w -D $PWD/pgsql
|
|
sleep 2
|
|
# end setup test env
|
|
make create_testdbs
|
|
echo "CREATE DATABASE $USER;" | psql template1
|
|
if [[ $(perl -e 'print shift cmp shift' $(/usr/bin/pg_config --version | awk '{print $2}') "9.1") -ge 0 ]]
|
|
then
|
|
echo "CREATE EXTENSION sslinfo;" | psql epgsql_test_db1
|
|
else
|
|
psql -d epgsql_test_db1 -f $(/usr/bin/pg_config --sharedir)/contrib/sslinfo.sql
|
|
fi
|
|
make test
|
|
make dialyzer
|
|
|
|
%files
|
|
%defattr(-,root,root)
|
|
%doc README CHANGES
|
|
%dir %{erlang_libdir}/%{app_name}-%{app_ver}
|
|
%dir %{erlang_libdir}/%{app_name}-%{app_ver}/ebin
|
|
%{erlang_libdir}/%{app_name}-%{app_ver}/ebin/%{app_name}.app
|
|
%{erlang_libdir}/%{app_name}-%{app_ver}/ebin/*.beam
|
|
%dir %{erlang_libdir}/%{app_name}-%{app_ver}/include
|
|
%{erlang_libdir}/%{app_name}-%{app_ver}/include/*.hrl
|
|
|
|
%changelog
|