Blob Blame History Raw
%{?nodejs_find_provides_and_requires}

Name:           nodejs-libpq
Version:        1.8.8
Release:        1%{?dist}
Summary:        Node native bindings to the PostgreSQL libpq C client library

License:        MIT
URL:            https://www.npmjs.com/package/libpq
Source0:        https://registry.npmjs.org/libpq/-/libpq-%{version}.tgz
ExclusiveArch:  %{nodejs_arches}

BuildRequires:  nodejs-devel
BuildRequires:  node-gyp
BuildRequires:  postgresql-devel
BuildRequires:  npm(nan)

BuildRequires:  npm(mocha)
BuildRequires:  npm(async)
BuildRequires:  npm(bindings)
BuildRequires:  npm(lodash)
BuildRequires:  npm(okay)
BuildRequires:  postgresql-server


%description
Node native bindings to the PostgreSQL libpq C client library. This module
attempts to mirror as closely as possible the C API provided by libpq and
provides the absolute minimum level of abstraction. It is intended to be
extremely low level and allow you the same access as you would have to libpq
directly from C, except in node.js! The obvious trade-off for being "close to
the metal" is having to use a very "c style" API in JavaScript.


%prep
%autosetup -p 1 -n package
%nodejs_fixdep bindings "^1.2.1"
%nodejs_fixdep --dev --move nan
rm -rf node_modules


%build
%nodejs_symlink_deps --build
%set_build_flags
node-gyp configure
node-gyp build


%install
mkdir -p %{buildroot}%{nodejs_sitearch}/libpq
cp -pr package.json index.js %{buildroot}%{nodejs_sitearch}/libpq
mkdir -p %{buildroot}%{nodejs_sitearch}/libpq/build
cp -p build/Release/addon.node %{buildroot}%{nodejs_sitearch}/libpq/build
%nodejs_symlink_deps


%check
%nodejs_symlink_deps --check
# Start a postgres server
pg_ctl initdb -D pg_data -o "-A trust -E utf8"
pg_ctl start -w -D pg_data -l pg_log -o "-k $PWD -p 12345"
createdb -h $PWD -p 12345 test
# Run tests
PGHOST=$PWD PGPORT=12345 PGDATABASE=test %{_bindir}/mocha -t 10000
# Stop the postgres server
pg_ctl stop -D pg_data


%files
%doc README.md
%{nodejs_sitearch}/libpq


%changelog
* Fri Jun 22 2018 Tom Hughes <tom@compton.nu> - 1.8.8-1
- Update to 1.8.8 upstream release

* Fri Jun 22 2018 Tom Hughes <tom@compton.nu> - 1.8.7-2
- Rebuild for Node.js 10.5.0

* Tue Mar  6 2018 Tom Hughes <tom@compton.nu> - 1.8.7-1
- Initial build of 1.8.7