diff --git a/0001-Fix-Buffer-warnings-by-switching-to-Buffer.from.patch b/0001-Fix-Buffer-warnings-by-switching-to-Buffer.from.patch new file mode 100644 index 0000000..4b5531d --- /dev/null +++ b/0001-Fix-Buffer-warnings-by-switching-to-Buffer.from.patch @@ -0,0 +1,64 @@ +From 6be9fdb20b77842151aa52d49e9dab183345b4b1 Mon Sep 17 00:00:00 2001 +From: lei_ju +Date: Thu, 3 Dec 2020 15:34:48 +0800 +Subject: [PATCH] Fix Buffer warnings by switching to Buffer.from + + +diff --git a/index.js b/index.js +index a61d9cc..7f389e6 100644 +--- a/index.js ++++ b/index.js +@@ -182,16 +182,16 @@ util.spawn = function(opts, done) { + } + + var child = spawn(cmd, args, opts.opts); +- var stdout = new Buffer(''); +- var stderr = new Buffer(''); ++ var stdout = Buffer.from(''); ++ var stderr = Buffer.from(''); + if (child.stdout) { + child.stdout.on('data', function(buf) { +- stdout = Buffer.concat([stdout, new Buffer(buf)]); ++ stdout = Buffer.concat([stdout, Buffer.from(buf)]); + }); + } + if (child.stderr) { + child.stderr.on('data', function(buf) { +- stderr = Buffer.concat([stderr, new Buffer(buf)]); ++ stderr = Buffer.concat([stderr, Buffer.from(buf)]); + }); + } + child.on('close', function(code) { +diff --git a/test/fixtures/spawn-multibyte.js b/test/fixtures/spawn-multibyte.js +index 8277711..b592341 100644 +--- a/test/fixtures/spawn-multibyte.js ++++ b/test/fixtures/spawn-multibyte.js +@@ -4,7 +4,7 @@ + // A multibyte buffer containing all our output. We will slice it later. + // In this case we are using a Japanese word for hello / good day, where each + // character takes three bytes. +-var fullOutput = new Buffer('こんにちは'); ++var fullOutput = Buffer.from('こんにちは'); + + // Output one full character and one third of a character + process.stdout.write(fullOutput.slice(0, 4)); +diff --git a/test/index.js b/test/index.js +index 4a657be..55cf79f 100644 +--- a/test/index.js ++++ b/test/index.js +@@ -477,10 +477,10 @@ exports['util.recurse'] = { + 'buffer': function(test) { + test.expect(1); + var actual = util.recurse({ +- buf: new Buffer('buf'), ++ buf: Buffer.from('buf'), + }, this.typeValue); + var expected = { +- buf: {type: 'buffer', value: new Buffer('buf')}, ++ buf: {type: 'buffer', value: Buffer.from('buf')}, + }; + test.deepEqual(actual, expected, 'Should not mangle Buffer instances.'); + test.done(); +-- +2.23.0 + diff --git a/nodejs-grunt-legacy-util.spec b/nodejs-grunt-legacy-util.spec index fd77d19..711bf1e 100644 --- a/nodejs-grunt-legacy-util.spec +++ b/nodejs-grunt-legacy-util.spec @@ -1,12 +1,13 @@ %global enable_tests 1 Name: nodejs-grunt-legacy-util Version: 1.0.0 -Release: 1 +Release: 2 Summary: Deprecated Grunt utils provided for backwards compatibility License: MIT URL: https://github.com/gruntjs/grunt-legacy-util Source0: https://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-%{version}.tgz BuildArch: noarch +Patch0: 0001-Fix-Buffer-warnings-by-switching-to-Buffer.from.patch ExclusiveArch: %{nodejs_arches} noarch BuildRequires: nodejs-packaging %if 0%{?enable_tests} @@ -19,6 +20,7 @@ BuildRequires: npm(async) npm(hooker) %prep %setup -q -n package +%patch0 -p1 %nodejs_fixdep async '^1.5.0' %nodejs_fixdep lodash '^3.10.1' %nodejs_fixdep underscore.string '~2.3.1' @@ -47,5 +49,8 @@ cp -pr package.json index.js \ %{nodejs_sitelib}/grunt-legacy-util %changelog +* Fri Sep 18 2020 leiju - 1.0.0-2 +- Fix check failure + * Thu Aug 20 2020 Anan Fu - 1.0.0-1 - package init