Blob Blame History Raw
%{?nodejs_find_provides_and_requires}

%global enable_tests 1

Name:       nodejs-pg
Version:    4.5.1
Release:    1%{?dist}
Summary:    PostgreSQL client for Node.js - pure JavaScript and libpq with the same API
# License text is included in README.md
License:    MIT
Group:      System Environment/Libraries
URL:        https://github.com/brianc/node-postgres
Source0:    http://registry.npmjs.org/pg/-/pg-%{version}.tgz
BuildArch:  noarch

BuildRequires:  nodejs-packaging

%if 0%{?enable_tests}
BuildRequires:  npm(async)
BuildRequires:  npm(buffer-writer)
BuildRequires:  npm(generic-pool)
BuildRequires:  npm(packet-reader)
BuildRequires:  npm(pgpass)
BuildRequires:  npm(pg-connection-string)
BuildRequires:  npm(pg-types)
BuildRequires:  npm(semver)
BuildRequires:  postgresql-server
%endif

%if 0%{?fedora} >= 19
ExclusiveArch: %{nodejs_arches} noarch
%else
ExclusiveArch: %{ix86} x86_64 %{arm} noarch
%endif

%description
PostgreSQL client for Node.js with pure JavaScript client and native
libpq bindings that share the same API.

Supported PostgreSQL features include:
 - parameterized queries
 - named statements with query plan caching
 - asynchronous notifications with LISTEN/NOTIFY
 - bulk import & export with COPY TO/COPY FROM
 - extensible js<->postgresql data-type coercion


%prep
%autosetup -p1 -n package
%nodejs_fixdep generic-pool "^2.0.3"
%nodejs_fixdep semver "^5.1.0"


%build


%install
mkdir -p %{buildroot}%{nodejs_sitelib}/pg
cp -pr package.json lib %{buildroot}%{nodejs_sitelib}/pg
%nodejs_symlink_deps


# https://github.com/brianc/node-postgres/wiki/Testing
%if 0%{?enable_tests}
%check
%nodejs_symlink_deps --check
# Remove test that needs pg-copy-streams
rm test/integration/gh-issues/699-tests.js
# Remove tests that need internet access
rm test/integration/client/heroku-*-tests.js 
# 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
make prepare-test-db connectionString=postgresql://localhost:12345/test
make test-missing-native connectionString=postgresql://localhost:12345/test
make test-unit connectionString=postgresql://localhost:12345/test
make test-integration connectionString=postgresql://localhost:12345/test
make test-binary connectionString=postgresql://localhost:12345/test
# Stop the postgres server
pg_ctl stop -D pg_data
%endif


%files
%doc README.md NEWS.md
%{nodejs_sitelib}/pg


%changelog
* Sat Feb 27 2016 Tom Hughes <tom@compton.nu> - 4.5.1-1
- Update to 4.5.1 upstream release

* Tue Feb 16 2016 Tom Hughes <tom@compton.nu> - 4.4.6-1
- Update to 4.4.6 upstream release

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 4.4.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Thu Jan 28 2016 Tom Hughes <tom@compton.nu> - 4.4.4-1
- Update to 4.4.4 upstream release

* Thu Dec 10 2015 Tom Hughes <tom@compton.nu> - 4.4.3-3
- Bump npm(semver) dependency for nodejs 4.2

* Thu Dec 10 2015 Tom Hughes <tom@compton.nu> - 4.4.3-2
- Correct npm(semver) dependency

* Wed Dec  9 2015 Tom Hughes <tom@compton.nu> - 4.4.3-1
- Update to 4.4.3 upstream release

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.12.3-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sat May 02 2015 Kalev Lember <kalevlember@gmail.com> - 0.12.3-7
- Rebuilt for GCC 5 C++11 ABI change

* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.12.3-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.12.3-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Fri Feb 14 2014 T.C. Hollingsworth <tchollingsworth@gmail.com> - 0.12.3-4
- rebuild for icu-53 (via v8)

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.12.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Sun Jul 07 2013 Jamie Nguyen <jamielinux@fedoraproject.org> - 0.12.3-2
- restrict to compatible arches

* Wed Feb 13 2013 Jamie Nguyen <jamielinux@fedoraproject.org> - 0.12.3-1
- initial package