commit nodejs-tar for openSUSE:Factory

Hello community, here is the log from the commit of package nodejs-tar for openSUSE:Factory checked in at 2015-07-02 22:40:01 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/nodejs-tar (Old) and /work/SRC/openSUSE:Factory/.nodejs-tar.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "nodejs-tar" Changes: -------- --- /work/SRC/openSUSE:Factory/nodejs-tar/nodejs-tar.changes 2015-04-27 13:03:58.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.nodejs-tar.new/nodejs-tar.changes 2015-07-02 22:40:02.000000000 +0200 @@ -1,0 +2,10 @@ +Sat Jun 6 13:00:48 UTC 2015 - i@marguerite.su + +- update version 2.1.1 + +------------------------------------------------------------------- +Fri Apr 24 12:59:52 UTC 2015 - hvogel@suse.com + +- Update to version 2.1.0 + +------------------------------------------------------------------- Old: ---- tar-1.0.1.tgz New: ---- tar-2.1.1.tgz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ nodejs-tar.spec ++++++ --- /var/tmp/diff_new_pack.uLuNYU/_old 2015-07-02 22:40:03.000000000 +0200 +++ /var/tmp/diff_new_pack.uLuNYU/_new 2015-07-02 22:40:03.000000000 +0200 @@ -19,10 +19,10 @@ %define base_name tar Name: nodejs-tar -Version: 1.0.1 +Version: 2.1.1 Release: 0 Summary: Tar for node.js -License: BSD-2-Clause +License: ISC Group: Development/Languages/Other Url: https://github.com/isaacs/node-tar Source: http://registry.npmjs.org/%{base_name}/-/%{base_name}-%{version}.tgz @@ -47,7 +47,7 @@ %files %defattr(-,root,root,-) -%doc LICENCE README.md examples +%doc LICENSE README.md examples %{nodejs_modulesdir}/%{base_name} %changelog ++++++ tar-1.0.1.tgz -> tar-2.1.1.tgz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/.travis.yml new/package/.travis.yml --- old/package/.travis.yml 2013-03-20 07:22:05.000000000 +0100 +++ new/package/.travis.yml 2014-11-28 02:45:55.000000000 +0100 @@ -1,3 +1,4 @@ language: node_js node_js: - - 0.6 + - 0.10 + - 0.11 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/LICENCE new/package/LICENCE --- old/package/LICENCE 2014-06-24 20:07:02.000000000 +0200 +++ new/package/LICENCE 1970-01-01 01:00:00.000000000 +0100 @@ -1,25 +0,0 @@ -Copyright (c) Isaac Z. Schlueter -All rights reserved. - -The BSD License - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/LICENSE new/package/LICENSE --- old/package/LICENSE 1970-01-01 01:00:00.000000000 +0100 +++ new/package/LICENSE 2015-05-08 02:35:48.000000000 +0200 @@ -0,0 +1,12 @@ +The ISC License +Copyright (c) Isaac Z. Schlueter and Contributors +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/README.md new/package/README.md --- old/package/README.md 2014-06-24 22:51:52.000000000 +0200 +++ new/package/README.md 2015-04-17 08:27:57.000000000 +0200 @@ -22,7 +22,9 @@ This only works with directories, it does not work with individual files. The optional `properties` object are used to set properties in the tar -'Global Extended Header'. +'Global Extended Header'. If the `fromBase` property is set to true, +the tar will contain files relative to the path passed, and not with +the path included. ### tar.Extract([options]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/examples/extracter.js new/package/examples/extracter.js --- old/package/examples/extracter.js 2013-01-23 19:59:39.000000000 +0100 +++ new/package/examples/extracter.js 2014-11-28 02:45:55.000000000 +0100 @@ -1,11 +1,19 @@ var tar = require("../tar.js") , fs = require("fs") + +function onError(err) { + console.error('An error occurred:', err) +} + +function onEnd() { + console.log('Extracted!') +} + +var extractor = tar.Extract({path: __dirname + "/extract"}) + .on('error', onError) + .on('end', onEnd); + fs.createReadStream(__dirname + "/../test/fixtures/c.tar") - .pipe(tar.Extract({ path: __dirname + "/extract" })) - .on("error", function (er) { - console.error("error here") - }) - .on("end", function () { - console.error("done") - }) + .on('error', onError) + .pipe(extractor); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/examples/packer.js new/package/examples/packer.js --- old/package/examples/packer.js 2014-06-24 22:51:52.000000000 +0200 +++ new/package/examples/packer.js 2014-11-28 02:45:55.000000000 +0100 @@ -2,9 +2,23 @@ , fstream = require("fstream") , fs = require("fs") -var dir_destination = fs.createWriteStream('dir.tar') +var dirDest = fs.createWriteStream('dir.tar') + + +function onError(err) { + console.error('An error occurred:', err) +} + +function onEnd() { + console.log('Packed!') +} + +var packer = tar.Pack({ noProprietary: true }) + .on('error', onError) + .on('end', onEnd); // This must be a "directory" fstream.Reader({ path: __dirname, type: "Directory" }) - .pipe(tar.Pack({ noProprietary: true })) - .pipe(dir_destination) \ No newline at end of file + .on('error', onError) + .pipe(packer) + .pipe(dirDest) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/lib/extract.js new/package/lib/extract.js --- old/package/lib/extract.js 2014-06-24 20:07:02.000000000 +0200 +++ new/package/lib/extract.js 2015-04-17 09:01:18.000000000 +0200 @@ -11,10 +11,6 @@ if (!(this instanceof Extract)) return new Extract(opts) tar.Parse.apply(this) - // have to dump into a directory - opts.type = "Directory" - opts.Directory = true - if (typeof opts !== "object") { opts = { path: opts } } @@ -47,9 +43,20 @@ entry.linkpath = entry.props.linkpath = lp } } - if (entry.type !== "Link") return - entry.linkpath = entry.props.linkpath = - path.join(opts.path, path.join("/", entry.props.linkpath)) + if (entry.type === "Link") { + entry.linkpath = entry.props.linkpath = + path.join(opts.path, path.join("/", entry.props.linkpath)) + } + + if (entry.type === "SymbolicLink") { + var dn = path.dirname(entry.path) || "" + var linkpath = entry.props.linkpath + var target = path.resolve(opts.path, dn, linkpath) + if (target.indexOf(opts.path) !== 0) { + linkpath = path.join(opts.path, path.join("/", linkpath)) + } + entry.linkpath = entry.props.linkpath = linkpath + } }) this._fst.on("ready", function () { @@ -57,12 +64,21 @@ me.resume() }) + this._fst.on('error', function(err) { + me.emit('error', err) + }) + + this._fst.on('drain', function() { + me.emit('drain') + }) + // this._fst.on("end", function () { // console.error("\nEEEE Extract End", me._fst.path) // }) this._fst.on("close", function () { // console.error("\nEEEE Extract End", me._fst.path) + me.emit("finish") me.emit("end") me.emit("close") }) @@ -72,7 +88,7 @@ Extract.prototype._streamEnd = function () { var me = this - if (!me._ended) me.error("unexpected eof") + if (!me._ended || me._entry) me.error("unexpected eof") me._fst.end() // my .end() is coming later. } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/lib/pack.js new/package/lib/pack.js --- old/package/lib/pack.js 2014-06-24 20:07:02.000000000 +0200 +++ new/package/lib/pack.js 2015-04-17 08:27:57.000000000 +0200 @@ -131,7 +131,12 @@ // in the tarball to use. That way we can skip a lot of extra // work when resolving symlinks for bundled dependencies in npm. - var root = path.dirname((entry.root || entry).path) + var root = path.dirname((entry.root || entry).path); + if (me._global && me._global.fromBase && entry.root && entry.root.path) { + // user set 'fromBase: true' indicating tar root should be directory itself + root = entry.root.path; + } + var wprops = {} Object.keys(entry.props || {}).forEach(function (k) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/lib/parse.js new/package/lib/parse.js --- old/package/lib/parse.js 2014-06-24 20:07:02.000000000 +0200 +++ new/package/lib/parse.js 2015-04-17 09:01:18.000000000 +0200 @@ -61,7 +61,7 @@ // emitting "end" Parse.prototype._streamEnd = function () { var me = this - if (!me._ended) me.error("unexpected eof") + if (!me._ended || me._entry) me.error("unexpected eof") me.emit("end") } @@ -146,7 +146,7 @@ e.header = header e.tar_file_offset = this.position e.tar_block = this.position / 512 - this.emit("error", e) + return this.emit("error", e) } switch (tar.types[header.type]) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/package.json new/package/package.json --- old/package/package.json 2014-08-19 21:27:39.000000000 +0200 +++ new/package/package.json 2015-05-08 02:37:15.000000000 +0200 @@ -2,7 +2,7 @@ "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)", "name": "tar", "description": "tar for node", - "version": "1.0.1", + "version": "2.1.1", "repository": { "type": "git", "url": "git://github.com/isaacs/node-tar.git" @@ -19,7 +19,8 @@ "devDependencies": { "graceful-fs": "^3.0.2", "rimraf": "1.x", - "tap": "0.x" + "tap": "0.x", + "mkdirp": "^0.5.0" }, - "license": "BSD" + "license": "ISC" } Files old/package/test/cb-never-called-1.0.1.tgz and new/package/test/cb-never-called-1.0.1.tgz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/test/dir-normalization.js new/package/test/dir-normalization.js --- old/package/test/dir-normalization.js 1970-01-01 01:00:00.000000000 +0100 +++ new/package/test/dir-normalization.js 2015-04-15 02:40:22.000000000 +0200 @@ -0,0 +1,177 @@ +// Set the umask, so that it works the same everywhere. +process.umask(parseInt('22', 8)) + +var fs = require('fs') +var path = require('path') + +var fstream = require('fstream') +var test = require('tap').test + +var tar = require('../tar.js') +var file = path.resolve(__dirname, 'dir-normalization.tar') +var target = path.resolve(__dirname, 'tmp/dir-normalization-test') +var ee = 0 + +var expectEntries = [ + { path: 'fixtures/', + mode: '755', + type: '5', + linkpath: '' + }, + { path: 'fixtures/a/', + mode: '755', + type: '5', + linkpath: '' + }, + { path: 'fixtures/the-chumbler', + mode: '755', + type: '2', + linkpath: path.resolve(target, 'a/b/c/d/the-chumbler'), + }, + { path: 'fixtures/a/b/', + mode: '755', + type: '5', + linkpath: '' + }, + { path: 'fixtures/a/x', + mode: '644', + type: '0', + linkpath: '' + }, + { path: 'fixtures/a/b/c/', + mode: '755', + type: '5', + linkpath: '' + }, + { path: 'fixtures/a/b/c/y', + mode: '755', + type: '2', + linkpath: '../../x', + } +] + +var ef = 0 +var expectFiles = [ + { path: '', + mode: '40755', + type: 'Directory', + depth: 0, + linkpath: undefined + }, + { path: '/fixtures', + mode: '40755', + type: 'Directory', + depth: 1, + linkpath: undefined + }, + { path: '/fixtures/a', + mode: '40755', + type: 'Directory', + depth: 2, + linkpath: undefined + }, + { path: '/fixtures/a/b', + mode: '40755', + type: 'Directory', + depth: 3, + linkpath: undefined + }, + { path: '/fixtures/a/b/c', + mode: '40755', + type: 'Directory', + depth: 4, + linkpath: undefined + }, + { path: '/fixtures/a/b/c/y', + mode: '120755', + type: 'SymbolicLink', + depth: 5, + linkpath: '../../x' + }, + { path: '/fixtures/a/x', + mode: '100644', + type: 'File', + depth: 3, + linkpath: undefined + }, + { path: '/fixtures/the-chumbler', + mode: '120755', + type: 'SymbolicLink', + depth: 2, + linkpath: path.resolve(target, 'a/b/c/d/the-chumbler') + } +] + +test('preclean', function (t) { + require('rimraf').sync(path.join(__dirname, '/tmp/dir-normalization-test')) + t.pass('cleaned!') + t.end() +}) + +test('extract test', function (t) { + var extract = tar.Extract(target) + var inp = fs.createReadStream(file) + + inp.pipe(extract) + + extract.on('end', function () { + t.equal(ee, expectEntries.length, 'should see ' + expectEntries.length + ' entries') + + // should get no more entries after end + extract.removeAllListeners('entry') + extract.on('entry', function (e) { + t.fail('Should not get entries after end!') + }) + + next() + }) + + extract.on('entry', function (entry) { + var mode = entry.props.mode & (~parseInt('22', 8)) + var found = { + path: entry.path, + mode: mode.toString(8), + type: entry.props.type, + linkpath: entry.props.linkpath, + } + + var wanted = expectEntries[ee++] + t.equivalent(found, wanted, 'tar entry ' + ee + ' ' + (wanted && wanted.path)) + }) + + function next () { + var r = fstream.Reader({ + path: target, + type: 'Directory', + sort: 'alpha' + }) + + r.on('ready', function () { + foundEntry(r) + }) + + r.on('end', finish) + + function foundEntry (entry) { + var p = entry.path.substr(target.length) + var mode = entry.props.mode & (~parseInt('22', 8)) + var found = { + path: p, + mode: mode.toString(8), + type: entry.props.type, + depth: entry.props.depth, + linkpath: entry.props.linkpath + } + + var wanted = expectFiles[ef++] + t.equivalent(found, wanted, 'unpacked file ' + ef + ' ' + (wanted && wanted.path)) + + entry.on('entry', foundEntry) + } + + function finish () { + t.equal(ef, expectFiles.length, 'should have ' + ef + ' items') + t.end() + } + } +}) Files old/package/test/dir-normalization.tar and new/package/test/dir-normalization.tar differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/test/error-on-broken.js new/package/test/error-on-broken.js --- old/package/test/error-on-broken.js 1970-01-01 01:00:00.000000000 +0100 +++ new/package/test/error-on-broken.js 2015-04-17 09:28:49.000000000 +0200 @@ -0,0 +1,33 @@ +var fs = require('fs') +var path = require('path') +var zlib = require('zlib') + +var tap = require('tap') + +var tar = require('../tar.js') + +var file = path.join(__dirname, 'cb-never-called-1.0.1.tgz') +var target = path.join(__dirname, 'tmp/extract-test') + +tap.test('preclean', function (t) { + require('rimraf').sync(__dirname + '/tmp/extract-test') + t.pass('cleaned!') + t.end() +}) + +tap.test('extract test', function (t) { + var extract = tar.Extract(target) + var inp = fs.createReadStream(file) + + inp.pipe(zlib.createGunzip()).pipe(extract) + + extract.on('error', function (er) { + t.equal(er.message, 'unexpected eof', 'error noticed') + t.end() + }) + + extract.on('end', function () { + t.fail('shouldn\'t reach this point due to errors') + t.end() + }) +}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/test/extract.js new/package/test/extract.js --- old/package/test/extract.js 2014-06-24 21:07:24.000000000 +0200 +++ new/package/test/extract.js 2015-04-17 08:35:53.000000000 +0200 @@ -118,7 +118,7 @@ linkpath: undefined, nlink: 2 }, { path: '/200LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL', - mode: '120755', + mode: '120777', type: 'SymbolicLink', depth: 1, size: 200, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/test/pack.js new/package/test/pack.js --- old/package/test/pack.js 2014-08-19 21:22:05.000000000 +0200 +++ new/package/test/pack.js 2015-04-17 08:27:57.000000000 +0200 @@ -830,6 +830,10 @@ runTest(t, false) }) +tap.test("with from base", { timeout: 10000 }, function (t) { + runTest(t, true, true) +}) + function alphasort (a, b) { return a === b ? 0 : a.toLowerCase() > b.toLowerCase() ? 1 @@ -839,7 +843,7 @@ } -function runTest (t, doGH) { +function runTest (t, doGH, doFromBase) { var reader = Reader({ path: input , filter: function () { return !this.path.match(/\.(tar|hex)$/) @@ -847,7 +851,10 @@ , sort: alphasort }) - var pack = Pack(doGH ? pkg : null) + var props = doGH ? pkg : {} + if(doFromBase) props.fromBase = true; + + var pack = Pack(props) var writer = Writer(target) // skip the global header if we're not doing that. @@ -901,6 +908,17 @@ } t.equal(ev, wanted[0], "event type should be "+wanted[0]) + if(doFromBase) { + if(wanted[1].path.indexOf('fixtures/') && wanted[1].path.length == 100) + wanted[1].path = wanted[1].path.replace('fixtures/', '') + 'ccccccccc' + + if(wanted[1]) wanted[1].path = wanted[1].path.replace('fixtures/', '').replace('//', '/') + if(wanted[1].path == '') wanted[1].path = '/' + if(wanted[2] && wanted[2].path) wanted[2].path = wanted[2].path.replace('fixtures', '').replace(/^\//, '') + + wanted[1].linkpath = wanted[1].linkpath.replace('fixtures/', '') + } + if (ev !== wanted[0] || e.path !== wanted[1].path) { console.error("wanted", wanted) console.error([ev, e.props])
participants (1)
-
root@hilbert.suse.de