# # 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 <