From 1a6b5d3eca0f223e0059378b2930b5d64a8ce790 Mon Sep 17 00:00:00 2001 From: Jared K. Smith Date: Mar 25 2017 17:36:08 +0000 Subject: Initial packaging --- diff --git a/.gitignore b/.gitignore index e69de29..0b01851 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/needle-1.5.2.tgz diff --git a/nodejs-needle.spec b/nodejs-needle.spec new file mode 100644 index 0000000..0dafca6 --- /dev/null +++ b/nodejs-needle.spec @@ -0,0 +1,97 @@ +%{?nodejs_find_provides_and_requires} + +%global packagename needle +# Tests disabled until npm(jschardet) is packaged +%global enable_tests 0 + +Name: nodejs-needle +Version: 1.5.2 +Release: 1%{?dist} +Summary: The leanest and most handsome HTTP client in the Nodelands + +License: MIT +# License file requested upstream at https://github.com/tomas/needle/issues/152 +URL: https://github.com/tomas/needle.git +Source0: https://registry.npmjs.org/%{packagename}/-/%{packagename}-%{version}.tgz +Patch0: nodejs-needle_fix-tests.patch + +BuildArch: noarch +%if 0%{?fedora} >= 19 +ExclusiveArch: %{nodejs_arches} noarch +%else +ExclusiveArch: %{ix86} x86_64 %{arm} noarch +%endif + +BuildRequires: nodejs-packaging +BuildRequires: npm(debug) +%if 0%{?enable_tests} +BuildRequires: npm(jschardet) +BuildRequires: npm(q) +BuildRequires: npm(should) +BuildRequires: npm(sinon) +BuildRequires: npm(xml2js) +BuildRequires: mocha +%endif + +Requires: nodejs + +%description +The leanest and most handsome HTTP client in the Nodelands. + + +%prep +%setup -q -n package +%patch0 -p1 + +# fix script interpreter +sed -i '1s;env node;node;' bin/needle + +%build +# nothing to do! + +%install +mkdir -p %{buildroot}%{nodejs_sitelib}/%{packagename} +cp -pr package.json lib/ \ + %{buildroot}%{nodejs_sitelib}/%{packagename} +mkdir -p %{buildroot}%{nodejs_sitelib}/%{packagename}/bin +install -p -D -m0755 bin/needle %{buildroot}%{nodejs_sitelib}/%{packagename}/bin/needle + +mkdir -p %{buildroot}%{_bindir} +ln -sf %{nodejs_sitelib}/%{packagename}/bin/needle \ + %{buildroot}%{_bindir}/needle + + +%nodejs_symlink_deps + +%check +%nodejs_symlink_deps --check +%{__nodejs} -e 'require("./")' +%if 0%{?enable_tests} +mkdir -p test/keys +openssl genrsa -out test/keys/ssl.key 2048 +openssl req -new -key test/keys/ssl.key -x509 -subj /CN=test@example.com -days \ +999 -out test/keys/ssl.cert +%{_bindir}/mocha -R spec +%else +%{_bindir}/echo -e "\e[101m -=#=- Tests disabled -=#=- \e[0m" +%endif + + +%files +%{!?_licensedir:%global license %doc} +%doc *.md examples/ +%license license.txt +%{nodejs_sitelib}/%{packagename} +%{_bindir}/needle + + + +%changelog +* Fri Mar 24 2017 Jared Smith - 1.5.2-1 +- Update to upstream 1.5.2 release + +* Sat Jan 07 2017 Jared Smith - 1.4.3-1 +- Update to upstream 1.4.3 release + +* Mon Nov 30 2015 Jared Smith - 0.11.0-1 +- Initial packaging diff --git a/nodejs-needle_fix-tests.patch b/nodejs-needle_fix-tests.patch new file mode 100644 index 0000000..b345927 --- /dev/null +++ b/nodejs-needle_fix-tests.patch @@ -0,0 +1,39 @@ +diff --git a/test/output_spec.js b/test/output_spec.js +index 35fb10f..e5b4786 100644 +--- a/test/output_spec.js ++++ b/test/output_spec.js +@@ -185,10 +185,10 @@ describe('with output option', function() { + before(function() { + handler = function(req, res) { + res.writeHead(200, { 'Content-Type': 'application/octet-stream', 'Transfer-Encoding': 'chunked' }); +- res.write(pixel.binarySlice(0, 10), 'binary'); +- res.write(pixel.binarySlice(10, 20), 'binary'); +- res.write(pixel.binarySlice(20, 30), 'binary'); +- res.write(pixel.binarySlice(30), 'binary'); ++ res.write(pixel.slice(0, 10), 'binary'); ++ res.write(pixel.slice(10, 20), 'binary'); ++ res.write(pixel.slice(20, 30), 'binary'); ++ res.write(pixel.slice(30), 'binary'); + res.end(); + } + }) +diff --git a/test/url_spec.js b/test/url_spec.js +index 8892c72..279eab2 100644 +--- a/test/url_spec.js ++++ b/test/url_spec.js +@@ -48,6 +48,7 @@ describe('urls', function() { + + }) + ++/* + describe('invalid host', function(){ + + before(function() { +@@ -64,7 +65,6 @@ describe('urls', function() { + + }) + +-/* + describe('invalid path', function(){ + + before(function() { diff --git a/sources b/sources index e69de29..8bedabf 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +SHA512 (needle-1.5.2.tgz) = e32bede8aedb3e97ee88eda5b2a9ad8df86c38ba28045882752ded6eecde27be2c7ba5eabad00ac8a30c1978cd2d3d4d6e2c863ccf2ca8d6cdd348ad25318d61