diff --git a/nodejs-readdirp-pause.patch b/nodejs-readdirp-pause.patch new file mode 100644 index 0000000..3060488 --- /dev/null +++ b/nodejs-readdirp-pause.patch @@ -0,0 +1,45 @@ +commit 4145b1c18762a46af04be129aec48eed30754956 +Author: Tom Hughes +Date: Thu Dec 31 12:18:02 2015 +0000 + + Wait until the next tick to pause the stream + + Registering handlers on a stream with `on` causes resume to be + called, but only on the next tick. + + This leads to a race condition where the pause can happen before + that delayed resume, which then resumes the stream earlier than we + were expecting. + +diff --git a/test/readdirp-stream.js b/test/readdirp-stream.js +index c43d132..e45bab5 100644 +--- a/test/readdirp-stream.js ++++ b/test/readdirp-stream.js +@@ -252,16 +252,19 @@ test('\napi separately', function (t) { + t.equals(data, processedData, 'emits the buffered data'); + t.ok(resumed, 'emits data only after it was resumed'); + }) +- .pause() + +- api.processEntry(processedData); +- api.handleError(nonfatalError); +- api.handleFatalError(fatalError); ++ process.nextTick(function() { ++ api.stream.pause(); ++ ++ api.processEntry(processedData); ++ api.handleError(nonfatalError); ++ api.handleFatalError(fatalError); + +- setTimeout(function () { +- resumed = true; +- api.stream.resume(); +- }, 1) ++ setTimeout(function () { ++ resumed = true; ++ api.stream.resume(); ++ }, 1) ++ }) + }) + + t.test('\n# when a stream is paused it stops walking the fs', function (t) { diff --git a/nodejs-readdirp.spec b/nodejs-readdirp.spec new file mode 100644 index 0000000..b291eea --- /dev/null +++ b/nodejs-readdirp.spec @@ -0,0 +1,54 @@ +%{?nodejs_find_provides_and_requires} +%global enable_tests 1 +Name: nodejs-readdirp +Version: 2.1.0 +Release: 1 +Summary: Recursive version of Node's fs.readdir with a streaming API +License: MIT +URL: https://github.com/thlorenz/readdirp +Source0: https://registry.npmjs.org/readdirp/-/readdirp-%{version}.tgz +#git clone git://github.com/thlorenz/readdirp.git +#cd readdirp +#git archive --prefix="test/" --format=tar tags/v%{version}:test/ | bzip2 > tests-%{version}.tar.bz2 +Source1: tests-v%{version}.tar.bz2 +Patch0: nodejs-readdirp-pause.patch +BuildArch: noarch +ExclusiveArch: %{nodejs_arches} noarch +BuildRequires: nodejs-packaging +%if 0%{?enable_tests} +BuildRequires: npm(graceful-fs) npm(minimatch) npm(proxyquire) npm(readable-stream) +BuildRequires: npm(set-immediate-shim) npm(tap) npm(through2) +%endif +%description +%{summary}. + +%prep +%setup -q -n package +rm -rf test/ +%setup -q -T -D -a 1 -n package +%patch0 -p1 +find . -type f -exec chmod -x '{}' \; +%nodejs_fixdep minimatch "^3.0.0" + +%build + +%install +mkdir -p %{buildroot}%{nodejs_sitelib}/readdirp +cp -pr package.json readdirp.js stream-api.js \ + %{buildroot}%{nodejs_sitelib}/readdirp +%nodejs_symlink_deps +%if 0%{?enable_tests} + +%check +%nodejs_symlink_deps --check +%__tap test/*.js +%endif + +%files +%doc README.md examples/ +%license LICENSE +%{nodejs_sitelib}/readdirp + +%changelog +* Sat Aug 22 2020 wangyue - 2.1.0-1 +- package init diff --git a/nodejs-readdirp.yaml b/nodejs-readdirp.yaml new file mode 100644 index 0000000..901d075 --- /dev/null +++ b/nodejs-readdirp.yaml @@ -0,0 +1,5 @@ +git_url: https://github.com/thlorenz/readdirp +version_control: github +src_repo: thlorenz/readdirp +tag_prefix: "^" +seperator: "." diff --git a/readdirp-2.1.0.tgz b/readdirp-2.1.0.tgz new file mode 100644 index 0000000..57b450f Binary files /dev/null and b/readdirp-2.1.0.tgz differ diff --git a/tests-v2.1.0.tar.bz2 b/tests-v2.1.0.tar.bz2 new file mode 100644 index 0000000..b091cff Binary files /dev/null and b/tests-v2.1.0.tar.bz2 differ