mirror of
https://github.com/electron/node-gyp.git
synced 2025-09-16 05:53:41 +02:00
parent
75099414c8
commit
382c86438f
16 changed files with 51 additions and 2737 deletions
2
node_modules/tar/.npmignore
generated
vendored
2
node_modules/tar/.npmignore
generated
vendored
|
@ -2,4 +2,4 @@
|
||||||
node_modules
|
node_modules
|
||||||
examples/extract/
|
examples/extract/
|
||||||
test/tmp/
|
test/tmp/
|
||||||
test/fixtures/symlink
|
test/fixtures/
|
||||||
|
|
25
node_modules/tar/LICENCE
generated
vendored
Normal file
25
node_modules/tar/LICENCE
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
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.
|
2
node_modules/tar/examples/reader.js
generated
vendored
2
node_modules/tar/examples/reader.js
generated
vendored
|
@ -2,7 +2,7 @@ var tar = require("../tar.js")
|
||||||
, fs = require("fs")
|
, fs = require("fs")
|
||||||
|
|
||||||
fs.createReadStream(__dirname + "/../test/fixtures/c.tar")
|
fs.createReadStream(__dirname + "/../test/fixtures/c.tar")
|
||||||
.pipe(tar.Reader())
|
.pipe(tar.Parse())
|
||||||
.on("extendedHeader", function (e) {
|
.on("extendedHeader", function (e) {
|
||||||
console.error("extended pax header", e.props)
|
console.error("extended pax header", e.props)
|
||||||
e.on("end", function () {
|
e.on("end", function () {
|
||||||
|
|
2
node_modules/tar/lib/entry.js
generated
vendored
2
node_modules/tar/lib/entry.js
generated
vendored
|
@ -105,7 +105,7 @@ inherits(Entry, Stream,
|
||||||
this._reading = true
|
this._reading = true
|
||||||
|
|
||||||
// have any data to emit?
|
// have any data to emit?
|
||||||
if (this._index < this._queueLen) {
|
while (this._index < this._queueLen && !this._paused) {
|
||||||
var chunk = this._queue[this._index ++]
|
var chunk = this._queue[this._index ++]
|
||||||
this.emit("data", chunk)
|
this.emit("data", chunk)
|
||||||
}
|
}
|
||||||
|
|
9
node_modules/tar/lib/pack.js
generated
vendored
9
node_modules/tar/lib/pack.js
generated
vendored
|
@ -134,19 +134,22 @@ Pack.prototype._process = function () {
|
||||||
var root = path.dirname((entry.root || entry).path)
|
var root = path.dirname((entry.root || entry).path)
|
||||||
var wprops = {}
|
var wprops = {}
|
||||||
|
|
||||||
Object.keys(entry.props).forEach(function (k) {
|
Object.keys(entry.props || {}).forEach(function (k) {
|
||||||
wprops[k] = entry.props[k]
|
wprops[k] = entry.props[k]
|
||||||
})
|
})
|
||||||
|
|
||||||
if (me._noProprietary) wprops.noProprietary = true
|
if (me._noProprietary) wprops.noProprietary = true
|
||||||
|
|
||||||
wprops.path = path.relative(root, entry.path)
|
wprops.path = path.relative(root, entry.path || '')
|
||||||
|
|
||||||
// actually not a matter of opinion or taste.
|
// actually not a matter of opinion or taste.
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
wprops.path = wprops.path.replace(/\\/g, "/")
|
wprops.path = wprops.path.replace(/\\/g, "/")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!wprops.type)
|
||||||
|
wprops.type = 'Directory'
|
||||||
|
|
||||||
switch (wprops.type) {
|
switch (wprops.type) {
|
||||||
// sockets not supported
|
// sockets not supported
|
||||||
case "Socket":
|
case "Socket":
|
||||||
|
@ -156,11 +159,13 @@ Pack.prototype._process = function () {
|
||||||
wprops.path += "/"
|
wprops.path += "/"
|
||||||
wprops.size = 0
|
wprops.size = 0
|
||||||
break
|
break
|
||||||
|
|
||||||
case "Link":
|
case "Link":
|
||||||
var lp = path.resolve(path.dirname(entry.path), entry.linkpath)
|
var lp = path.resolve(path.dirname(entry.path), entry.linkpath)
|
||||||
wprops.linkpath = path.relative(root, lp) || "."
|
wprops.linkpath = path.relative(root, lp) || "."
|
||||||
wprops.size = 0
|
wprops.size = 0
|
||||||
break
|
break
|
||||||
|
|
||||||
case "SymbolicLink":
|
case "SymbolicLink":
|
||||||
var lp = path.resolve(path.dirname(entry.path), entry.linkpath)
|
var lp = path.resolve(path.dirname(entry.path), entry.linkpath)
|
||||||
wprops.linkpath = path.relative(path.dirname(entry.path), lp) || "."
|
wprops.linkpath = path.relative(path.dirname(entry.path), lp) || "."
|
||||||
|
|
7
node_modules/tar/node_modules/block-stream/package.json
generated
vendored
7
node_modules/tar/node_modules/block-stream/package.json
generated
vendored
|
@ -26,6 +26,11 @@
|
||||||
},
|
},
|
||||||
"license": "BSD",
|
"license": "BSD",
|
||||||
"readme": "# block-stream\n\nA stream of blocks.\n\nWrite data into it, and it'll output data in buffer blocks the size you\nspecify, padding with zeroes if necessary.\n\n```javascript\nvar block = new BlockStream(512)\nfs.createReadStream(\"some-file\").pipe(block)\nblock.pipe(fs.createWriteStream(\"block-file\"))\n```\n\nWhen `.end()` or `.flush()` is called, it'll pad the block with zeroes.\n",
|
"readme": "# block-stream\n\nA stream of blocks.\n\nWrite data into it, and it'll output data in buffer blocks the size you\nspecify, padding with zeroes if necessary.\n\n```javascript\nvar block = new BlockStream(512)\nfs.createReadStream(\"some-file\").pipe(block)\nblock.pipe(fs.createWriteStream(\"block-file\"))\n```\n\nWhen `.end()` or `.flush()` is called, it'll pad the block with zeroes.\n",
|
||||||
|
"readmeFilename": "README.md",
|
||||||
"_id": "block-stream@0.0.6",
|
"_id": "block-stream@0.0.6",
|
||||||
"_from": "block-stream@*"
|
"dist": {
|
||||||
|
"shasum": "5398f0a0f4acd378e82bd94c0c6d60a16a02b262"
|
||||||
|
},
|
||||||
|
"_from": "block-stream@*",
|
||||||
|
"_resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.6.tgz"
|
||||||
}
|
}
|
||||||
|
|
15
node_modules/tar/package.json
generated
vendored
15
node_modules/tar/package.json
generated
vendored
|
@ -6,7 +6,7 @@
|
||||||
},
|
},
|
||||||
"name": "tar",
|
"name": "tar",
|
||||||
"description": "tar for node",
|
"description": "tar for node",
|
||||||
"version": "0.1.13",
|
"version": "0.1.17",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git://github.com/isaacs/node-tar.git"
|
"url": "git://github.com/isaacs/node-tar.git"
|
||||||
|
@ -15,9 +15,6 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "tap test/*.js"
|
"test": "tap test/*.js"
|
||||||
},
|
},
|
||||||
"engines": {
|
|
||||||
"node": "~0.5.9 || 0.6 || 0.7 || 0.8"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"inherits": "1.x",
|
"inherits": "1.x",
|
||||||
"block-stream": "*",
|
"block-stream": "*",
|
||||||
|
@ -27,7 +24,13 @@
|
||||||
"tap": "0.x",
|
"tap": "0.x",
|
||||||
"rimraf": "1.x"
|
"rimraf": "1.x"
|
||||||
},
|
},
|
||||||
|
"license": "BSD",
|
||||||
"readme": "# node-tar\n\nTar for Node.js.\n\n## Goals of this project\n\n1. Be able to parse and reasonably extract the contents of any tar file\n created by any program that creates tar files, period.\n\n At least, this includes every version of:\n\n * bsdtar\n * gnutar\n * solaris posix tar\n * Joerg Schilling's star (\"Schilly tar\")\n\n2. Create tar files that can be extracted by any of the following tar\n programs:\n\n * bsdtar/libarchive version 2.6.2\n * gnutar 1.15 and above\n * SunOS Posix tar\n * Joerg Schilling's star (\"Schilly tar\")\n\n3. 100% test coverage. Speed is important. Correctness is slightly\n more important.\n\n4. Create the kind of tar interface that Node users would want to use.\n\n5. Satisfy npm's needs for a portable tar implementation with a\n JavaScript interface.\n\n6. No excuses. No complaining. No tolerance for failure.\n\n## But isn't there already a tar.js?\n\nYes, there are a few. This one is going to be better, and it will be\nfanatically maintained, because npm will depend on it.\n\nThat's why I need to write it from scratch. Creating and extracting\ntarballs is such a large part of what npm does, I simply can't have it\nbe a black box any longer.\n\n## Didn't you have something already? Where'd it go?\n\nIt's in the \"old\" folder. It's not functional. Don't use it.\n\nIt was a useful exploration to learn the issues involved, but like most\nsoftware of any reasonable complexity, node-tar won't be useful until\nit's been written at least 3 times.\n",
|
"readme": "# node-tar\n\nTar for Node.js.\n\n## Goals of this project\n\n1. Be able to parse and reasonably extract the contents of any tar file\n created by any program that creates tar files, period.\n\n At least, this includes every version of:\n\n * bsdtar\n * gnutar\n * solaris posix tar\n * Joerg Schilling's star (\"Schilly tar\")\n\n2. Create tar files that can be extracted by any of the following tar\n programs:\n\n * bsdtar/libarchive version 2.6.2\n * gnutar 1.15 and above\n * SunOS Posix tar\n * Joerg Schilling's star (\"Schilly tar\")\n\n3. 100% test coverage. Speed is important. Correctness is slightly\n more important.\n\n4. Create the kind of tar interface that Node users would want to use.\n\n5. Satisfy npm's needs for a portable tar implementation with a\n JavaScript interface.\n\n6. No excuses. No complaining. No tolerance for failure.\n\n## But isn't there already a tar.js?\n\nYes, there are a few. This one is going to be better, and it will be\nfanatically maintained, because npm will depend on it.\n\nThat's why I need to write it from scratch. Creating and extracting\ntarballs is such a large part of what npm does, I simply can't have it\nbe a black box any longer.\n\n## Didn't you have something already? Where'd it go?\n\nIt's in the \"old\" folder. It's not functional. Don't use it.\n\nIt was a useful exploration to learn the issues involved, but like most\nsoftware of any reasonable complexity, node-tar won't be useful until\nit's been written at least 3 times.\n",
|
||||||
"_id": "tar@0.1.13",
|
"readmeFilename": "README.md",
|
||||||
"_from": "tar@~0.1.12"
|
"_id": "tar@0.1.17",
|
||||||
|
"dist": {
|
||||||
|
"shasum": "1ad787d4febf4b4c513e1cea6dcb1c02d9294026"
|
||||||
|
},
|
||||||
|
"_from": "tar@0.1.17",
|
||||||
|
"_resolved": "https://registry.npmjs.org/tar/-/tar-0.1.17.tgz"
|
||||||
}
|
}
|
||||||
|
|
1
node_modules/tar/tar.js
generated
vendored
1
node_modules/tar/tar.js
generated
vendored
|
@ -75,6 +75,7 @@ Object.keys(fields).forEach(function (f) {
|
||||||
var types =
|
var types =
|
||||||
{ 0: "File"
|
{ 0: "File"
|
||||||
, "\0": "OldFile" // like 0
|
, "\0": "OldFile" // like 0
|
||||||
|
, "": "OldFile"
|
||||||
, 1: "Link"
|
, 1: "Link"
|
||||||
, 2: "SymbolicLink"
|
, 2: "SymbolicLink"
|
||||||
, 3: "CharacterDevice"
|
, 3: "CharacterDevice"
|
||||||
|
|
53
node_modules/tar/test/00-setup-fixtures.js
generated
vendored
53
node_modules/tar/test/00-setup-fixtures.js
generated
vendored
|
@ -1,53 +0,0 @@
|
||||||
// the fixtures have some weird stuff that is painful
|
|
||||||
// to include directly in the repo for various reasons.
|
|
||||||
//
|
|
||||||
// So, unpack the fixtures with the system tar first.
|
|
||||||
//
|
|
||||||
// This means, of course, that it'll only work if you
|
|
||||||
// already have a tar implementation, and some of them
|
|
||||||
// will not properly unpack the fixtures anyway.
|
|
||||||
//
|
|
||||||
// But, since usually those tests will fail on Windows
|
|
||||||
// and other systems with less capable filesystems anyway,
|
|
||||||
// at least this way we don't cause inconveniences by
|
|
||||||
// merely cloning the repo or installing the package.
|
|
||||||
|
|
||||||
var tap = require("tap")
|
|
||||||
, child_process = require("child_process")
|
|
||||||
, rimraf = require("rimraf")
|
|
||||||
, test = tap.test
|
|
||||||
, path = require("path")
|
|
||||||
|
|
||||||
test("clean fixtures", function (t) {
|
|
||||||
rimraf(path.resolve(__dirname, "fixtures"), function (er) {
|
|
||||||
t.ifError(er, "rimraf ./fixtures/")
|
|
||||||
t.end()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("clean tmp", function (t) {
|
|
||||||
rimraf(path.resolve(__dirname, "tmp"), function (er) {
|
|
||||||
t.ifError(er, "rimraf ./tmp/")
|
|
||||||
t.end()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("extract fixtures", function (t) {
|
|
||||||
var c = child_process.spawn("tar"
|
|
||||||
,["xzvf", "fixtures.tgz"]
|
|
||||||
,{ cwd: __dirname })
|
|
||||||
|
|
||||||
c.stdout.on("data", errwrite)
|
|
||||||
c.stderr.on("data", errwrite)
|
|
||||||
function errwrite (chunk) {
|
|
||||||
process.stderr.write(chunk)
|
|
||||||
}
|
|
||||||
|
|
||||||
c.on("exit", function (code) {
|
|
||||||
t.equal(code, 0, "extract fixtures should exit with 0")
|
|
||||||
if (code) {
|
|
||||||
t.comment("Note, all tests from here on out will fail because of this.")
|
|
||||||
}
|
|
||||||
t.end()
|
|
||||||
})
|
|
||||||
})
|
|
358
node_modules/tar/test/extract.js
generated
vendored
358
node_modules/tar/test/extract.js
generated
vendored
|
@ -1,358 +0,0 @@
|
||||||
var tap = require("tap")
|
|
||||||
, tar = require("../tar.js")
|
|
||||||
, fs = require("fs")
|
|
||||||
, path = require("path")
|
|
||||||
, file = path.resolve(__dirname, "fixtures/c.tar")
|
|
||||||
, target = path.resolve(__dirname, "tmp/extract-test")
|
|
||||||
, index = 0
|
|
||||||
, fstream = require("fstream")
|
|
||||||
|
|
||||||
, ee = 0
|
|
||||||
, expectEntries =
|
|
||||||
[ { path: 'c.txt',
|
|
||||||
mode: '644',
|
|
||||||
type: '0',
|
|
||||||
depth: undefined,
|
|
||||||
size: 513,
|
|
||||||
linkpath: '',
|
|
||||||
nlink: undefined,
|
|
||||||
dev: undefined,
|
|
||||||
ino: undefined },
|
|
||||||
{ path: 'cc.txt',
|
|
||||||
mode: '644',
|
|
||||||
type: '0',
|
|
||||||
depth: undefined,
|
|
||||||
size: 513,
|
|
||||||
linkpath: '',
|
|
||||||
nlink: undefined,
|
|
||||||
dev: undefined,
|
|
||||||
ino: undefined },
|
|
||||||
{ path: 'r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
|
||||||
mode: '644',
|
|
||||||
type: '0',
|
|
||||||
depth: undefined,
|
|
||||||
size: 100,
|
|
||||||
linkpath: '',
|
|
||||||
nlink: undefined,
|
|
||||||
dev: undefined,
|
|
||||||
ino: undefined },
|
|
||||||
{ path: 'Ω.txt',
|
|
||||||
mode: '644',
|
|
||||||
type: '0',
|
|
||||||
depth: undefined,
|
|
||||||
size: 2,
|
|
||||||
linkpath: '',
|
|
||||||
nlink: undefined,
|
|
||||||
dev: undefined,
|
|
||||||
ino: undefined },
|
|
||||||
{ path: 'Ω.txt',
|
|
||||||
mode: '644',
|
|
||||||
type: '0',
|
|
||||||
depth: undefined,
|
|
||||||
size: 2,
|
|
||||||
linkpath: '',
|
|
||||||
nlink: 1,
|
|
||||||
dev: 234881026,
|
|
||||||
ino: 51693379 },
|
|
||||||
{ path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
|
||||||
mode: '644',
|
|
||||||
type: '0',
|
|
||||||
depth: undefined,
|
|
||||||
size: 200,
|
|
||||||
linkpath: '',
|
|
||||||
nlink: 1,
|
|
||||||
dev: 234881026,
|
|
||||||
ino: 51681874 },
|
|
||||||
{ path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
|
||||||
mode: '644',
|
|
||||||
type: '0',
|
|
||||||
depth: undefined,
|
|
||||||
size: 201,
|
|
||||||
linkpath: '',
|
|
||||||
nlink: undefined,
|
|
||||||
dev: undefined,
|
|
||||||
ino: undefined },
|
|
||||||
{ path: '200LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL',
|
|
||||||
mode: '777',
|
|
||||||
type: '2',
|
|
||||||
depth: undefined,
|
|
||||||
size: 0,
|
|
||||||
linkpath: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
|
||||||
nlink: undefined,
|
|
||||||
dev: undefined,
|
|
||||||
ino: undefined },
|
|
||||||
{ path: '200-hard',
|
|
||||||
mode: '644',
|
|
||||||
type: '0',
|
|
||||||
depth: undefined,
|
|
||||||
size: 200,
|
|
||||||
linkpath: '',
|
|
||||||
nlink: 2,
|
|
||||||
dev: 234881026,
|
|
||||||
ino: 51681874 },
|
|
||||||
{ path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
|
||||||
mode: '644',
|
|
||||||
type: '1',
|
|
||||||
depth: undefined,
|
|
||||||
size: 0,
|
|
||||||
linkpath: path.resolve(target, '200-hard'),
|
|
||||||
nlink: 2,
|
|
||||||
dev: 234881026,
|
|
||||||
ino: 51681874 } ]
|
|
||||||
|
|
||||||
, ef = 0
|
|
||||||
, expectFiles =
|
|
||||||
[ { path: '',
|
|
||||||
mode: '40755',
|
|
||||||
type: 'Directory',
|
|
||||||
depth: 0,
|
|
||||||
linkpath: undefined },
|
|
||||||
{ path: '/200-hard',
|
|
||||||
mode: '100644',
|
|
||||||
type: 'File',
|
|
||||||
depth: 1,
|
|
||||||
size: 200,
|
|
||||||
linkpath: undefined,
|
|
||||||
nlink: 2 },
|
|
||||||
{ path: '/200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
|
||||||
mode: '100644',
|
|
||||||
type: 'Link',
|
|
||||||
depth: 1,
|
|
||||||
size: 200,
|
|
||||||
linkpath: path.join(target, '200-hard'),
|
|
||||||
nlink: 2 },
|
|
||||||
{ path: '/200LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL',
|
|
||||||
mode: '120777',
|
|
||||||
type: 'SymbolicLink',
|
|
||||||
depth: 1,
|
|
||||||
size: 200,
|
|
||||||
linkpath: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
|
||||||
nlink: 1 },
|
|
||||||
{ path: '/c.txt',
|
|
||||||
mode: '100644',
|
|
||||||
type: 'File',
|
|
||||||
depth: 1,
|
|
||||||
size: 513,
|
|
||||||
linkpath: undefined,
|
|
||||||
nlink: 1 },
|
|
||||||
{ path: '/cc.txt',
|
|
||||||
mode: '100644',
|
|
||||||
type: 'File',
|
|
||||||
depth: 1,
|
|
||||||
size: 513,
|
|
||||||
linkpath: undefined,
|
|
||||||
nlink: 1 },
|
|
||||||
{ path: '/r',
|
|
||||||
mode: '40755',
|
|
||||||
type: 'Directory',
|
|
||||||
depth: 1,
|
|
||||||
linkpath: undefined },
|
|
||||||
{ path: '/r/e',
|
|
||||||
mode: '40755',
|
|
||||||
type: 'Directory',
|
|
||||||
depth: 2,
|
|
||||||
linkpath: undefined },
|
|
||||||
{ path: '/r/e/a',
|
|
||||||
mode: '40755',
|
|
||||||
type: 'Directory',
|
|
||||||
depth: 3,
|
|
||||||
linkpath: undefined },
|
|
||||||
{ path: '/r/e/a/l',
|
|
||||||
mode: '40755',
|
|
||||||
type: 'Directory',
|
|
||||||
depth: 4,
|
|
||||||
linkpath: undefined },
|
|
||||||
{ path: '/r/e/a/l/l',
|
|
||||||
mode: '40755',
|
|
||||||
type: 'Directory',
|
|
||||||
depth: 5,
|
|
||||||
linkpath: undefined },
|
|
||||||
{ path: '/r/e/a/l/l/y',
|
|
||||||
mode: '40755',
|
|
||||||
type: 'Directory',
|
|
||||||
depth: 6,
|
|
||||||
linkpath: undefined },
|
|
||||||
{ path: '/r/e/a/l/l/y/-',
|
|
||||||
mode: '40755',
|
|
||||||
type: 'Directory',
|
|
||||||
depth: 7,
|
|
||||||
linkpath: undefined },
|
|
||||||
{ path: '/r/e/a/l/l/y/-/d',
|
|
||||||
mode: '40755',
|
|
||||||
type: 'Directory',
|
|
||||||
depth: 8,
|
|
||||||
linkpath: undefined },
|
|
||||||
{ path: '/r/e/a/l/l/y/-/d/e',
|
|
||||||
mode: '40755',
|
|
||||||
type: 'Directory',
|
|
||||||
depth: 9,
|
|
||||||
linkpath: undefined },
|
|
||||||
{ path: '/r/e/a/l/l/y/-/d/e/e',
|
|
||||||
mode: '40755',
|
|
||||||
type: 'Directory',
|
|
||||||
depth: 10,
|
|
||||||
linkpath: undefined },
|
|
||||||
{ path: '/r/e/a/l/l/y/-/d/e/e/p',
|
|
||||||
mode: '40755',
|
|
||||||
type: 'Directory',
|
|
||||||
depth: 11,
|
|
||||||
linkpath: undefined },
|
|
||||||
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-',
|
|
||||||
mode: '40755',
|
|
||||||
type: 'Directory',
|
|
||||||
depth: 12,
|
|
||||||
linkpath: undefined },
|
|
||||||
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f',
|
|
||||||
mode: '40755',
|
|
||||||
type: 'Directory',
|
|
||||||
depth: 13,
|
|
||||||
linkpath: undefined },
|
|
||||||
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o',
|
|
||||||
mode: '40755',
|
|
||||||
type: 'Directory',
|
|
||||||
depth: 14,
|
|
||||||
linkpath: undefined },
|
|
||||||
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l',
|
|
||||||
mode: '40755',
|
|
||||||
type: 'Directory',
|
|
||||||
depth: 15,
|
|
||||||
linkpath: undefined },
|
|
||||||
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d',
|
|
||||||
mode: '40755',
|
|
||||||
type: 'Directory',
|
|
||||||
depth: 16,
|
|
||||||
linkpath: undefined },
|
|
||||||
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e',
|
|
||||||
mode: '40755',
|
|
||||||
type: 'Directory',
|
|
||||||
depth: 17,
|
|
||||||
linkpath: undefined },
|
|
||||||
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r',
|
|
||||||
mode: '40755',
|
|
||||||
type: 'Directory',
|
|
||||||
depth: 18,
|
|
||||||
linkpath: undefined },
|
|
||||||
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-',
|
|
||||||
mode: '40755',
|
|
||||||
type: 'Directory',
|
|
||||||
depth: 19,
|
|
||||||
linkpath: undefined },
|
|
||||||
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p',
|
|
||||||
mode: '40755',
|
|
||||||
type: 'Directory',
|
|
||||||
depth: 20,
|
|
||||||
linkpath: undefined },
|
|
||||||
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a',
|
|
||||||
mode: '40755',
|
|
||||||
type: 'Directory',
|
|
||||||
depth: 21,
|
|
||||||
linkpath: undefined },
|
|
||||||
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t',
|
|
||||||
mode: '40755',
|
|
||||||
type: 'Directory',
|
|
||||||
depth: 22,
|
|
||||||
linkpath: undefined },
|
|
||||||
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h',
|
|
||||||
mode: '40755',
|
|
||||||
type: 'Directory',
|
|
||||||
depth: 23,
|
|
||||||
linkpath: undefined },
|
|
||||||
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
|
||||||
mode: '100644',
|
|
||||||
type: 'File',
|
|
||||||
depth: 24,
|
|
||||||
size: 100,
|
|
||||||
linkpath: undefined,
|
|
||||||
nlink: 1 },
|
|
||||||
{ path: '/Ω.txt',
|
|
||||||
mode: '100644',
|
|
||||||
type: 'File',
|
|
||||||
depth: 1,
|
|
||||||
size: 2,
|
|
||||||
linkpath: undefined,
|
|
||||||
nlink: 1 } ]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// The extract class basically just pipes the input
|
|
||||||
// to a Reader, and then to a fstream.DirWriter
|
|
||||||
|
|
||||||
// So, this is as much a test of fstream.Reader and fstream.Writer
|
|
||||||
// as it is of tar.Extract, but it sort of makes sense.
|
|
||||||
|
|
||||||
tap.test("extract test", function (t) {
|
|
||||||
var extract = tar.Extract(target)
|
|
||||||
var inp = fs.createReadStream(file)
|
|
||||||
|
|
||||||
// give it a weird buffer size to try to break in odd places
|
|
||||||
inp.bufferSize = 1234
|
|
||||||
|
|
||||||
inp.pipe(extract)
|
|
||||||
|
|
||||||
extract.on("end", function () {
|
|
||||||
t.equal(ee, expectEntries.length, "should see "+ee+" 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 found =
|
|
||||||
{ path: entry.path
|
|
||||||
, mode: entry.props.mode.toString(8)
|
|
||||||
, type: entry.props.type
|
|
||||||
, depth: entry.props.depth
|
|
||||||
, size: entry.props.size
|
|
||||||
, linkpath: entry.props.linkpath
|
|
||||||
, nlink: entry.props.nlink
|
|
||||||
, dev: entry.props.dev
|
|
||||||
, ino: entry.props.ino
|
|
||||||
}
|
|
||||||
|
|
||||||
var wanted = expectEntries[ee ++]
|
|
||||||
|
|
||||||
t.equivalent(found, wanted, "tar entry " + ee + " " + wanted.path)
|
|
||||||
})
|
|
||||||
|
|
||||||
function next () {
|
|
||||||
var r = fstream.Reader({ path: target
|
|
||||||
, type: "Directory"
|
|
||||||
// this is just to encourage consistency
|
|
||||||
, sort: "alpha" })
|
|
||||||
|
|
||||||
r.on("ready", function () {
|
|
||||||
foundEntry(r)
|
|
||||||
})
|
|
||||||
|
|
||||||
r.on("end", finish)
|
|
||||||
|
|
||||||
function foundEntry (entry) {
|
|
||||||
var p = entry.path.substr(target.length)
|
|
||||||
var found =
|
|
||||||
{ path: p
|
|
||||||
, mode: entry.props.mode.toString(8)
|
|
||||||
, type: entry.props.type
|
|
||||||
, depth: entry.props.depth
|
|
||||||
, size: entry.props.size
|
|
||||||
, linkpath: entry.props.linkpath
|
|
||||||
, nlink: entry.props.nlink
|
|
||||||
}
|
|
||||||
|
|
||||||
var wanted = expectFiles[ef ++]
|
|
||||||
|
|
||||||
t.has(found, wanted, "unpacked file " + ef + " " + wanted.path)
|
|
||||||
|
|
||||||
entry.on("entry", foundEntry)
|
|
||||||
}
|
|
||||||
|
|
||||||
function finish () {
|
|
||||||
t.equal(ef, expectFiles.length, "should have "+ef+" items")
|
|
||||||
t.end()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
BIN
node_modules/tar/test/fixtures.tgz
generated
vendored
BIN
node_modules/tar/test/fixtures.tgz
generated
vendored
Binary file not shown.
183
node_modules/tar/test/header.js
generated
vendored
183
node_modules/tar/test/header.js
generated
vendored
|
@ -1,183 +0,0 @@
|
||||||
var tap = require("tap")
|
|
||||||
var TarHeader = require("../lib/header.js")
|
|
||||||
var tar = require("../tar.js")
|
|
||||||
var fs = require("fs")
|
|
||||||
|
|
||||||
|
|
||||||
var headers =
|
|
||||||
{ "a.txt file header":
|
|
||||||
[ "612e747874000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030303036343420003035373736312000303030303234200030303030303030303430312031313635313336303333332030313234353100203000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000757374617200303069736161637300000000000000000000000000000000000000000000000000007374616666000000000000000000000000000000000000000000000000000000303030303030200030303030303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
, { cksumValid: true
|
|
||||||
, path: 'a.txt'
|
|
||||||
, mode: 420
|
|
||||||
, uid: 24561
|
|
||||||
, gid: 20
|
|
||||||
, size: 257
|
|
||||||
, mtime: 1319493851
|
|
||||||
, cksum: 5417
|
|
||||||
, type: '0'
|
|
||||||
, linkpath: ''
|
|
||||||
, ustar: 'ustar\0'
|
|
||||||
, ustarver: '00'
|
|
||||||
, uname: 'isaacs'
|
|
||||||
, gname: 'staff'
|
|
||||||
, devmaj: 0
|
|
||||||
, devmin: 0
|
|
||||||
, fill: '' }
|
|
||||||
]
|
|
||||||
|
|
||||||
, "omega pax": // the extended header from omega tar.
|
|
||||||
[ "5061784865616465722fcea92e74787400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030303036343420003035373736312000303030303234200030303030303030303137302031313534333731303631312030313530353100207800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000757374617200303069736161637300000000000000000000000000000000000000000000000000007374616666000000000000000000000000000000000000000000000000000000303030303030200030303030303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
, { cksumValid: true
|
|
||||||
, path: 'PaxHeader/Ω.txt'
|
|
||||||
, mode: 420
|
|
||||||
, uid: 24561
|
|
||||||
, gid: 20
|
|
||||||
, size: 120
|
|
||||||
, mtime: 1301254537
|
|
||||||
, cksum: 6697
|
|
||||||
, type: 'x'
|
|
||||||
, linkpath: ''
|
|
||||||
, ustar: 'ustar\0'
|
|
||||||
, ustarver: '00'
|
|
||||||
, uname: 'isaacs'
|
|
||||||
, gname: 'staff'
|
|
||||||
, devmaj: 0
|
|
||||||
, devmin: 0
|
|
||||||
, fill: '' } ]
|
|
||||||
|
|
||||||
, "omega file header":
|
|
||||||
[ "cea92e7478740000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030303036343420003035373736312000303030303234200030303030303030303030322031313534333731303631312030313330373200203000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000757374617200303069736161637300000000000000000000000000000000000000000000000000007374616666000000000000000000000000000000000000000000000000000000303030303030200030303030303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
, { cksumValid: true
|
|
||||||
, path: 'Ω.txt'
|
|
||||||
, mode: 420
|
|
||||||
, uid: 24561
|
|
||||||
, gid: 20
|
|
||||||
, size: 2
|
|
||||||
, mtime: 1301254537
|
|
||||||
, cksum: 5690
|
|
||||||
, type: '0'
|
|
||||||
, linkpath: ''
|
|
||||||
, ustar: 'ustar\0'
|
|
||||||
, ustarver: '00'
|
|
||||||
, uname: 'isaacs'
|
|
||||||
, gname: 'staff'
|
|
||||||
, devmaj: 0
|
|
||||||
, devmin: 0
|
|
||||||
, fill: '' } ]
|
|
||||||
|
|
||||||
, "foo.js file header":
|
|
||||||
[ "666f6f2e6a730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030303036343420003035373736312000303030303234200030303030303030303030342031313534333637303734312030313236313700203000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000757374617200303069736161637300000000000000000000000000000000000000000000000000007374616666000000000000000000000000000000000000000000000000000000303030303030200030303030303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
, { cksumValid: true
|
|
||||||
, path: 'foo.js'
|
|
||||||
, mode: 420
|
|
||||||
, uid: 24561
|
|
||||||
, gid: 20
|
|
||||||
, size: 4
|
|
||||||
, mtime: 1301246433
|
|
||||||
, cksum: 5519
|
|
||||||
, type: '0'
|
|
||||||
, linkpath: ''
|
|
||||||
, ustar: 'ustar\0'
|
|
||||||
, ustarver: '00'
|
|
||||||
, uname: 'isaacs'
|
|
||||||
, gname: 'staff'
|
|
||||||
, devmaj: 0
|
|
||||||
, devmin: 0
|
|
||||||
, fill: '' }
|
|
||||||
]
|
|
||||||
|
|
||||||
, "b.txt file header":
|
|
||||||
[ "622e747874000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030303036343420003035373736312000303030303234200030303030303030313030302031313635313336303637372030313234363100203000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000757374617200303069736161637300000000000000000000000000000000000000000000000000007374616666000000000000000000000000000000000000000000000000000000303030303030200030303030303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
, { cksumValid: true
|
|
||||||
, path: 'b.txt'
|
|
||||||
, mode: 420
|
|
||||||
, uid: 24561
|
|
||||||
, gid: 20
|
|
||||||
, size: 512
|
|
||||||
, mtime: 1319494079
|
|
||||||
, cksum: 5425
|
|
||||||
, type: '0'
|
|
||||||
, linkpath: ''
|
|
||||||
, ustar: 'ustar\0'
|
|
||||||
, ustarver: '00'
|
|
||||||
, uname: 'isaacs'
|
|
||||||
, gname: 'staff'
|
|
||||||
, devmaj: 0
|
|
||||||
, devmin: 0
|
|
||||||
, fill: '' }
|
|
||||||
]
|
|
||||||
|
|
||||||
, "deep nested file":
|
|
||||||
[ "636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363633030303634342000303537373631200030303030323420003030303030303030313434203131363532313531353333203034333331340020300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000075737461720030306973616163730000000000000000000000000000000000000000000000000000737461666600000000000000000000000000000000000000000000000000000030303030303020003030303030302000722f652f612f6c2f6c2f792f2d2f642f652f652f702f2d2f662f6f2f6c2f642f652f722f2d2f702f612f742f680000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
, { cksumValid: true,
|
|
||||||
path: 'r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'
|
|
||||||
, mode: 420
|
|
||||||
, uid: 24561
|
|
||||||
, gid: 20
|
|
||||||
, size: 100
|
|
||||||
, mtime: 1319687003
|
|
||||||
, cksum: 18124
|
|
||||||
, type: '0'
|
|
||||||
, linkpath: ''
|
|
||||||
, ustar: 'ustar\0'
|
|
||||||
, ustarver: '00'
|
|
||||||
, uname: 'isaacs'
|
|
||||||
, gname: 'staff'
|
|
||||||
, devmaj: 0
|
|
||||||
, devmin: 0
|
|
||||||
, fill: '' }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
tap.test("parsing", function (t) {
|
|
||||||
Object.keys(headers).forEach(function (name) {
|
|
||||||
var h = headers[name]
|
|
||||||
, header = new Buffer(h[0], "hex")
|
|
||||||
, expect = h[1]
|
|
||||||
, parsed = new TarHeader(header)
|
|
||||||
|
|
||||||
// console.error(parsed)
|
|
||||||
t.has(parsed, expect, "parse " + name)
|
|
||||||
})
|
|
||||||
t.end()
|
|
||||||
})
|
|
||||||
|
|
||||||
tap.test("encoding", function (t) {
|
|
||||||
Object.keys(headers).forEach(function (name) {
|
|
||||||
var h = headers[name]
|
|
||||||
, expect = new Buffer(h[0], "hex")
|
|
||||||
, encoded = TarHeader.encode(h[1])
|
|
||||||
|
|
||||||
// might have slightly different bytes, since the standard
|
|
||||||
// isn't very strict, but should have the same semantics
|
|
||||||
// checkSum will be different, but cksumValid will be true
|
|
||||||
|
|
||||||
var th = new TarHeader(encoded)
|
|
||||||
delete h[1].block
|
|
||||||
delete h[1].needExtended
|
|
||||||
delete h[1].cksum
|
|
||||||
t.has(th, h[1], "fields "+name)
|
|
||||||
})
|
|
||||||
t.end()
|
|
||||||
})
|
|
||||||
|
|
||||||
// test these manually. they're a bit rare to find in the wild
|
|
||||||
tap.test("parseNumeric tests", function (t) {
|
|
||||||
var parseNumeric = TarHeader.parseNumeric
|
|
||||||
, numbers =
|
|
||||||
{ "303737373737373700": 2097151
|
|
||||||
, "30373737373737373737373700": 8589934591
|
|
||||||
, "303030303036343400": 420
|
|
||||||
, "800000ffffffffffff": 281474976710655
|
|
||||||
, "ffffff000000000001": -281474976710654
|
|
||||||
, "ffffff000000000000": -281474976710655
|
|
||||||
, "800000000000200000": 2097152
|
|
||||||
, "8000000000001544c5": 1393861
|
|
||||||
, "ffffffffffff1544c5": -15383354 }
|
|
||||||
Object.keys(numbers).forEach(function (n) {
|
|
||||||
var b = new Buffer(n, "hex")
|
|
||||||
t.equal(parseNumeric(b), numbers[n], n + " === " + numbers[n])
|
|
||||||
})
|
|
||||||
t.end()
|
|
||||||
})
|
|
854
node_modules/tar/test/pack-no-proprietary.js
generated
vendored
854
node_modules/tar/test/pack-no-proprietary.js
generated
vendored
|
@ -1,854 +0,0 @@
|
||||||
// This is exactly like test/pack.js, except that it's excluding
|
|
||||||
// any proprietary headers.
|
|
||||||
//
|
|
||||||
// This loses some information about the filesystem, but creates
|
|
||||||
// tarballs that are supported by more versions of tar, especially
|
|
||||||
// old non-spec-compliant copies of gnutar.
|
|
||||||
|
|
||||||
// the symlink file is excluded from git, because it makes
|
|
||||||
// windows freak the hell out.
|
|
||||||
var fs = require("fs")
|
|
||||||
, path = require("path")
|
|
||||||
, symlink = path.resolve(__dirname, "fixtures/symlink")
|
|
||||||
try { fs.unlinkSync(symlink) } catch (e) {}
|
|
||||||
fs.symlinkSync("./hardlink-1", symlink)
|
|
||||||
process.on("exit", function () {
|
|
||||||
fs.unlinkSync(symlink)
|
|
||||||
})
|
|
||||||
|
|
||||||
var tap = require("tap")
|
|
||||||
, tar = require("../tar.js")
|
|
||||||
, pkg = require("../package.json")
|
|
||||||
, Pack = tar.Pack
|
|
||||||
, fstream = require("fstream")
|
|
||||||
, Reader = fstream.Reader
|
|
||||||
, Writer = fstream.Writer
|
|
||||||
, input = path.resolve(__dirname, "fixtures/")
|
|
||||||
, target = path.resolve(__dirname, "tmp/pack.tar")
|
|
||||||
, uid = process.getuid ? process.getuid() : 0
|
|
||||||
, gid = process.getgid ? process.getgid() : 0
|
|
||||||
|
|
||||||
, entries =
|
|
||||||
|
|
||||||
// the global header and root fixtures/ dir are going to get
|
|
||||||
// a different date each time, so omit that bit.
|
|
||||||
// Also, dev/ino values differ across machines, so that's not
|
|
||||||
// included.
|
|
||||||
[ [ 'entry',
|
|
||||||
{ path: 'fixtures/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'extendedHeader',
|
|
||||||
{ path: 'PaxHeader/fixtures/200cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
type: 'x',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' },
|
|
||||||
{ path: 'fixtures/200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 200 } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 200,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/a.txt',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 257,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/b.txt',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 512,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/c.txt',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 513,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/cc.txt',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 513,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/foo.js',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 4,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/hardlink-1',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 200,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/hardlink-2',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '1',
|
|
||||||
linkpath: 'fixtures/hardlink-1',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/omega.txt',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 2,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/packtest/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/packtest/omega.txt',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 2,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/packtest/star.4.html',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 54081,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'extendedHeader',
|
|
||||||
{ path: 'PaxHeader/fixtures/packtest/Ω.txt',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
type: 'x',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' },
|
|
||||||
{ path: 'fixtures/packtest/Ω.txt',
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 2 } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/packtest/Ω.txt',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 2,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 100,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/symlink',
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '2',
|
|
||||||
linkpath: 'hardlink-1',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'extendedHeader',
|
|
||||||
{ path: 'PaxHeader/fixtures/Ω.txt',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
type: 'x',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' },
|
|
||||||
{ path: "fixtures/Ω.txt"
|
|
||||||
, uid: uid
|
|
||||||
, gid: gid
|
|
||||||
, size: 2 } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/Ω.txt',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 2,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
// first, make sure that the hardlinks are actually hardlinks, or this
|
|
||||||
// won't work. Git has a way of replacing them with a copy.
|
|
||||||
var hard1 = path.resolve(__dirname, "fixtures/hardlink-1")
|
|
||||||
, hard2 = path.resolve(__dirname, "fixtures/hardlink-2")
|
|
||||||
, fs = require("fs")
|
|
||||||
|
|
||||||
try { fs.unlinkSync(hard2) } catch (e) {}
|
|
||||||
fs.linkSync(hard1, hard2)
|
|
||||||
|
|
||||||
tap.test("with global header", { timeout: 10000 }, function (t) {
|
|
||||||
runTest(t, true)
|
|
||||||
})
|
|
||||||
|
|
||||||
tap.test("without global header", { timeout: 10000 }, function (t) {
|
|
||||||
runTest(t, false)
|
|
||||||
})
|
|
||||||
|
|
||||||
function alphasort (a, b) {
|
|
||||||
return a === b ? 0
|
|
||||||
: a.toLowerCase() > b.toLowerCase() ? 1
|
|
||||||
: a.toLowerCase() < b.toLowerCase() ? -1
|
|
||||||
: a > b ? 1
|
|
||||||
: -1
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function runTest (t, doGH) {
|
|
||||||
var reader = Reader({ path: input
|
|
||||||
, filter: function () {
|
|
||||||
return !this.path.match(/\.(tar|hex)$/)
|
|
||||||
}
|
|
||||||
, sort: alphasort
|
|
||||||
})
|
|
||||||
|
|
||||||
var props = doGH ? pkg : {}
|
|
||||||
props.noProprietary = true
|
|
||||||
var pack = Pack(props)
|
|
||||||
var writer = Writer(target)
|
|
||||||
|
|
||||||
// global header should be skipped regardless, since it has no content.
|
|
||||||
var entry = 0
|
|
||||||
|
|
||||||
t.ok(reader, "reader ok")
|
|
||||||
t.ok(pack, "pack ok")
|
|
||||||
t.ok(writer, "writer ok")
|
|
||||||
|
|
||||||
pack.pipe(writer)
|
|
||||||
|
|
||||||
var parse = tar.Parse()
|
|
||||||
t.ok(parse, "parser should be ok")
|
|
||||||
|
|
||||||
pack.on("data", function (c) {
|
|
||||||
// console.error("PACK DATA")
|
|
||||||
if (c.length !== 512) {
|
|
||||||
// this one is too noisy, only assert if it'll be relevant
|
|
||||||
t.equal(c.length, 512, "parser should emit data in 512byte blocks")
|
|
||||||
}
|
|
||||||
parse.write(c)
|
|
||||||
})
|
|
||||||
|
|
||||||
pack.on("end", function () {
|
|
||||||
// console.error("PACK END")
|
|
||||||
t.pass("parser ends")
|
|
||||||
parse.end()
|
|
||||||
})
|
|
||||||
|
|
||||||
pack.on("error", function (er) {
|
|
||||||
t.fail("pack error", er)
|
|
||||||
})
|
|
||||||
|
|
||||||
parse.on("error", function (er) {
|
|
||||||
t.fail("parse error", er)
|
|
||||||
})
|
|
||||||
|
|
||||||
writer.on("error", function (er) {
|
|
||||||
t.fail("writer error", er)
|
|
||||||
})
|
|
||||||
|
|
||||||
reader.on("error", function (er) {
|
|
||||||
t.fail("reader error", er)
|
|
||||||
})
|
|
||||||
|
|
||||||
parse.on("*", function (ev, e) {
|
|
||||||
var wanted = entries[entry++]
|
|
||||||
if (!wanted) {
|
|
||||||
t.fail("unexpected event: "+ev)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
t.equal(ev, wanted[0], "event type should be "+wanted[0])
|
|
||||||
|
|
||||||
if (ev !== wanted[0] || e.path !== wanted[1].path) {
|
|
||||||
console.error(wanted)
|
|
||||||
console.error([ev, e.props])
|
|
||||||
e.on("end", function () {
|
|
||||||
console.error(e.fields)
|
|
||||||
throw "break"
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
t.has(e.props, wanted[1], "properties "+wanted[1].path)
|
|
||||||
if (wanted[2]) {
|
|
||||||
e.on("end", function () {
|
|
||||||
if (!e.fields) {
|
|
||||||
t.ok(e.fields, "should get fields")
|
|
||||||
} else {
|
|
||||||
t.has(e.fields, wanted[2], "should get expected fields")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
reader.pipe(pack)
|
|
||||||
|
|
||||||
writer.on("close", function () {
|
|
||||||
t.equal(entry, entries.length, "should get all expected entries")
|
|
||||||
t.pass("it finished")
|
|
||||||
t.end()
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
898
node_modules/tar/test/pack.js
generated
vendored
898
node_modules/tar/test/pack.js
generated
vendored
|
@ -1,898 +0,0 @@
|
||||||
|
|
||||||
// the symlink file is excluded from git, because it makes
|
|
||||||
// windows freak the hell out.
|
|
||||||
var fs = require("fs")
|
|
||||||
, path = require("path")
|
|
||||||
, symlink = path.resolve(__dirname, "fixtures/symlink")
|
|
||||||
try { fs.unlinkSync(symlink) } catch (e) {}
|
|
||||||
fs.symlinkSync("./hardlink-1", symlink)
|
|
||||||
process.on("exit", function () {
|
|
||||||
fs.unlinkSync(symlink)
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
var tap = require("tap")
|
|
||||||
, tar = require("../tar.js")
|
|
||||||
, pkg = require("../package.json")
|
|
||||||
, Pack = tar.Pack
|
|
||||||
, fstream = require("fstream")
|
|
||||||
, Reader = fstream.Reader
|
|
||||||
, Writer = fstream.Writer
|
|
||||||
, input = path.resolve(__dirname, "fixtures/")
|
|
||||||
, target = path.resolve(__dirname, "tmp/pack.tar")
|
|
||||||
, uid = process.getuid ? process.getuid() : 0
|
|
||||||
, gid = process.getgid ? process.getgid() : 0
|
|
||||||
|
|
||||||
, entries =
|
|
||||||
|
|
||||||
// the global header and root fixtures/ dir are going to get
|
|
||||||
// a different date each time, so omit that bit.
|
|
||||||
// Also, dev/ino values differ across machines, so that's not
|
|
||||||
// included.
|
|
||||||
[ [ 'globalExtendedHeader',
|
|
||||||
{ path: 'PaxHeader/',
|
|
||||||
mode: 438,
|
|
||||||
uid: 0,
|
|
||||||
gid: 0,
|
|
||||||
type: 'g',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' },
|
|
||||||
{ "NODETAR.author": pkg.author,
|
|
||||||
"NODETAR.name": pkg.name,
|
|
||||||
"NODETAR.description": pkg.description,
|
|
||||||
"NODETAR.version": pkg.version,
|
|
||||||
"NODETAR.repository.type": pkg.repository.type,
|
|
||||||
"NODETAR.repository.url": pkg.repository.url,
|
|
||||||
"NODETAR.main": pkg.main,
|
|
||||||
"NODETAR.scripts.test": pkg.scripts.test,
|
|
||||||
"NODETAR.engines.node": pkg.engines.node } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'extendedHeader',
|
|
||||||
{ path: 'PaxHeader/fixtures/200cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
type: 'x',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' },
|
|
||||||
{ path: 'fixtures/200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
|
||||||
'NODETAR.depth': '1',
|
|
||||||
'NODETAR.type': 'File',
|
|
||||||
nlink: 1,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 200,
|
|
||||||
'NODETAR.blksize': '4096',
|
|
||||||
'NODETAR.blocks': '8' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 200,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '',
|
|
||||||
'NODETAR.depth': '1',
|
|
||||||
'NODETAR.type': 'File',
|
|
||||||
nlink: 1,
|
|
||||||
'NODETAR.blksize': '4096',
|
|
||||||
'NODETAR.blocks': '8' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/a.txt',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 257,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/b.txt',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 512,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/c.txt',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 513,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/cc.txt',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 513,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/foo.js',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 4,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/hardlink-1',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 200,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/hardlink-2',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '1',
|
|
||||||
linkpath: 'fixtures/hardlink-1',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/omega.txt',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 2,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/packtest/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/packtest/omega.txt',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 2,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/packtest/star.4.html',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 54081,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'extendedHeader',
|
|
||||||
{ path: 'PaxHeader/fixtures/packtest/Ω.txt',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
type: 'x',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' },
|
|
||||||
{ path: 'fixtures/packtest/Ω.txt',
|
|
||||||
'NODETAR.depth': '2',
|
|
||||||
'NODETAR.type': 'File',
|
|
||||||
nlink: 1,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 2,
|
|
||||||
'NODETAR.blksize': '4096',
|
|
||||||
'NODETAR.blocks': '8' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/packtest/Ω.txt',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 2,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '',
|
|
||||||
'NODETAR.depth': '2',
|
|
||||||
'NODETAR.type': 'File',
|
|
||||||
nlink: 1,
|
|
||||||
'NODETAR.blksize': '4096',
|
|
||||||
'NODETAR.blocks': '8' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/',
|
|
||||||
mode: 493,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '5',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 100,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/symlink',
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 0,
|
|
||||||
type: '2',
|
|
||||||
linkpath: 'hardlink-1',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' } ]
|
|
||||||
|
|
||||||
, [ 'extendedHeader',
|
|
||||||
{ path: 'PaxHeader/fixtures/Ω.txt',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
type: 'x',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' },
|
|
||||||
{ path: "fixtures/Ω.txt"
|
|
||||||
, "NODETAR.depth": "1"
|
|
||||||
, "NODETAR.type": "File"
|
|
||||||
, nlink: 1
|
|
||||||
, uid: uid
|
|
||||||
, gid: gid
|
|
||||||
, size: 2
|
|
||||||
, "NODETAR.blksize": "4096"
|
|
||||||
, "NODETAR.blocks": "8" } ]
|
|
||||||
|
|
||||||
, [ 'entry',
|
|
||||||
{ path: 'fixtures/Ω.txt',
|
|
||||||
mode: 420,
|
|
||||||
uid: uid,
|
|
||||||
gid: gid,
|
|
||||||
size: 2,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\u0000',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: '',
|
|
||||||
gname: '',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '',
|
|
||||||
'NODETAR.depth': '1',
|
|
||||||
'NODETAR.type': 'File',
|
|
||||||
nlink: 1,
|
|
||||||
'NODETAR.blksize': '4096',
|
|
||||||
'NODETAR.blocks': '8' } ]
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
// first, make sure that the hardlinks are actually hardlinks, or this
|
|
||||||
// won't work. Git has a way of replacing them with a copy.
|
|
||||||
var hard1 = path.resolve(__dirname, "fixtures/hardlink-1")
|
|
||||||
, hard2 = path.resolve(__dirname, "fixtures/hardlink-2")
|
|
||||||
, fs = require("fs")
|
|
||||||
|
|
||||||
try { fs.unlinkSync(hard2) } catch (e) {}
|
|
||||||
fs.linkSync(hard1, hard2)
|
|
||||||
|
|
||||||
tap.test("with global header", { timeout: 10000 }, function (t) {
|
|
||||||
runTest(t, true)
|
|
||||||
})
|
|
||||||
|
|
||||||
tap.test("without global header", { timeout: 10000 }, function (t) {
|
|
||||||
runTest(t, false)
|
|
||||||
})
|
|
||||||
|
|
||||||
function alphasort (a, b) {
|
|
||||||
return a === b ? 0
|
|
||||||
: a.toLowerCase() > b.toLowerCase() ? 1
|
|
||||||
: a.toLowerCase() < b.toLowerCase() ? -1
|
|
||||||
: a > b ? 1
|
|
||||||
: -1
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function runTest (t, doGH) {
|
|
||||||
var reader = Reader({ path: input
|
|
||||||
, filter: function () {
|
|
||||||
return !this.path.match(/\.(tar|hex)$/)
|
|
||||||
}
|
|
||||||
, sort: alphasort
|
|
||||||
})
|
|
||||||
|
|
||||||
var pack = Pack(doGH ? pkg : null)
|
|
||||||
var writer = Writer(target)
|
|
||||||
|
|
||||||
// skip the global header if we're not doing that.
|
|
||||||
var entry = doGH ? 0 : 1
|
|
||||||
|
|
||||||
t.ok(reader, "reader ok")
|
|
||||||
t.ok(pack, "pack ok")
|
|
||||||
t.ok(writer, "writer ok")
|
|
||||||
|
|
||||||
pack.pipe(writer)
|
|
||||||
|
|
||||||
var parse = tar.Parse()
|
|
||||||
t.ok(parse, "parser should be ok")
|
|
||||||
|
|
||||||
pack.on("data", function (c) {
|
|
||||||
// console.error("PACK DATA")
|
|
||||||
if (c.length !== 512) {
|
|
||||||
// this one is too noisy, only assert if it'll be relevant
|
|
||||||
t.equal(c.length, 512, "parser should emit data in 512byte blocks")
|
|
||||||
}
|
|
||||||
parse.write(c)
|
|
||||||
})
|
|
||||||
|
|
||||||
pack.on("end", function () {
|
|
||||||
// console.error("PACK END")
|
|
||||||
t.pass("parser ends")
|
|
||||||
parse.end()
|
|
||||||
})
|
|
||||||
|
|
||||||
pack.on("error", function (er) {
|
|
||||||
t.fail("pack error", er)
|
|
||||||
})
|
|
||||||
|
|
||||||
parse.on("error", function (er) {
|
|
||||||
t.fail("parse error", er)
|
|
||||||
})
|
|
||||||
|
|
||||||
writer.on("error", function (er) {
|
|
||||||
t.fail("writer error", er)
|
|
||||||
})
|
|
||||||
|
|
||||||
reader.on("error", function (er) {
|
|
||||||
t.fail("reader error", er)
|
|
||||||
})
|
|
||||||
|
|
||||||
parse.on("*", function (ev, e) {
|
|
||||||
var wanted = entries[entry++]
|
|
||||||
if (!wanted) {
|
|
||||||
t.fail("unexpected event: "+ev)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
t.equal(ev, wanted[0], "event type should be "+wanted[0])
|
|
||||||
|
|
||||||
// if (ev !== wanted[0] || e.path !== wanted[1].path) {
|
|
||||||
// console.error(wanted)
|
|
||||||
// console.error([ev, e.props])
|
|
||||||
// throw "break"
|
|
||||||
// }
|
|
||||||
|
|
||||||
t.has(e.props, wanted[1], "properties "+wanted[1].path)
|
|
||||||
if (wanted[2]) {
|
|
||||||
e.on("end", function () {
|
|
||||||
if (!e.fields) {
|
|
||||||
t.ok(e.fields, "should get fields")
|
|
||||||
} else {
|
|
||||||
t.has(e.fields, wanted[2], "should get expected fields")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
reader.pipe(pack)
|
|
||||||
|
|
||||||
writer.on("close", function () {
|
|
||||||
t.equal(entry, entries.length, "should get all expected entries")
|
|
||||||
t.pass("it finished")
|
|
||||||
t.end()
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
359
node_modules/tar/test/parse.js
generated
vendored
359
node_modules/tar/test/parse.js
generated
vendored
|
@ -1,359 +0,0 @@
|
||||||
var tap = require("tap")
|
|
||||||
, tar = require("../tar.js")
|
|
||||||
, fs = require("fs")
|
|
||||||
, path = require("path")
|
|
||||||
, file = path.resolve(__dirname, "fixtures/c.tar")
|
|
||||||
, index = 0
|
|
||||||
|
|
||||||
, expect =
|
|
||||||
[ [ 'entry',
|
|
||||||
{ path: 'c.txt',
|
|
||||||
mode: 420,
|
|
||||||
uid: 24561,
|
|
||||||
gid: 20,
|
|
||||||
size: 513,
|
|
||||||
mtime: new Date('Wed, 26 Oct 2011 01:10:58 GMT'),
|
|
||||||
cksum: 5422,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\0',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: 'isaacs',
|
|
||||||
gname: 'staff',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' },
|
|
||||||
undefined ],
|
|
||||||
[ 'entry',
|
|
||||||
{ path: 'cc.txt',
|
|
||||||
mode: 420,
|
|
||||||
uid: 24561,
|
|
||||||
gid: 20,
|
|
||||||
size: 513,
|
|
||||||
mtime: new Date('Wed, 26 Oct 2011 01:11:02 GMT'),
|
|
||||||
cksum: 5525,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\0',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: 'isaacs',
|
|
||||||
gname: 'staff',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' },
|
|
||||||
undefined ],
|
|
||||||
[ 'entry',
|
|
||||||
{ path: 'r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
|
||||||
mode: 420,
|
|
||||||
uid: 24561,
|
|
||||||
gid: 20,
|
|
||||||
size: 100,
|
|
||||||
mtime: new Date('Thu, 27 Oct 2011 03:43:23 GMT'),
|
|
||||||
cksum: 18124,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\0',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: 'isaacs',
|
|
||||||
gname: 'staff',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' },
|
|
||||||
undefined ],
|
|
||||||
[ 'entry',
|
|
||||||
{ path: 'Ω.txt',
|
|
||||||
mode: 420,
|
|
||||||
uid: 24561,
|
|
||||||
gid: 20,
|
|
||||||
size: 2,
|
|
||||||
mtime: new Date('Thu, 27 Oct 2011 17:51:49 GMT'),
|
|
||||||
cksum: 5695,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\0',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: 'isaacs',
|
|
||||||
gname: 'staff',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' },
|
|
||||||
undefined ],
|
|
||||||
[ 'extendedHeader',
|
|
||||||
{ path: 'PaxHeader/Ω.txt',
|
|
||||||
mode: 420,
|
|
||||||
uid: 24561,
|
|
||||||
gid: 20,
|
|
||||||
size: 120,
|
|
||||||
mtime: new Date('Thu, 27 Oct 2011 17:51:49 GMT'),
|
|
||||||
cksum: 6702,
|
|
||||||
type: 'x',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\0',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: 'isaacs',
|
|
||||||
gname: 'staff',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' },
|
|
||||||
{ path: 'Ω.txt',
|
|
||||||
ctime: 1319737909,
|
|
||||||
atime: 1319739061,
|
|
||||||
dev: 234881026,
|
|
||||||
ino: 51693379,
|
|
||||||
nlink: 1 } ],
|
|
||||||
[ 'entry',
|
|
||||||
{ path: 'Ω.txt',
|
|
||||||
mode: 420,
|
|
||||||
uid: 24561,
|
|
||||||
gid: 20,
|
|
||||||
size: 2,
|
|
||||||
mtime: new Date('Thu, 27 Oct 2011 17:51:49 GMT'),
|
|
||||||
cksum: 5695,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\0',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: 'isaacs',
|
|
||||||
gname: 'staff',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '',
|
|
||||||
ctime: new Date('Thu, 27 Oct 2011 17:51:49 GMT'),
|
|
||||||
atime: new Date('Thu, 27 Oct 2011 18:11:01 GMT'),
|
|
||||||
dev: 234881026,
|
|
||||||
ino: 51693379,
|
|
||||||
nlink: 1 },
|
|
||||||
undefined ],
|
|
||||||
[ 'extendedHeader',
|
|
||||||
{ path: 'PaxHeader/200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
|
||||||
mode: 420,
|
|
||||||
uid: 24561,
|
|
||||||
gid: 20,
|
|
||||||
size: 353,
|
|
||||||
mtime: new Date('Thu, 27 Oct 2011 03:41:08 GMT'),
|
|
||||||
cksum: 14488,
|
|
||||||
type: 'x',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\0',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: 'isaacs',
|
|
||||||
gname: 'staff',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' },
|
|
||||||
{ path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
|
||||||
ctime: 1319686868,
|
|
||||||
atime: 1319741254,
|
|
||||||
'LIBARCHIVE.creationtime': '1319686852',
|
|
||||||
dev: 234881026,
|
|
||||||
ino: 51681874,
|
|
||||||
nlink: 1 } ],
|
|
||||||
[ 'entry',
|
|
||||||
{ path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
|
||||||
mode: 420,
|
|
||||||
uid: 24561,
|
|
||||||
gid: 20,
|
|
||||||
size: 200,
|
|
||||||
mtime: new Date('Thu, 27 Oct 2011 03:41:08 GMT'),
|
|
||||||
cksum: 14570,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\0',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: 'isaacs',
|
|
||||||
gname: 'staff',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '',
|
|
||||||
ctime: new Date('Thu, 27 Oct 2011 03:41:08 GMT'),
|
|
||||||
atime: new Date('Thu, 27 Oct 2011 18:47:34 GMT'),
|
|
||||||
'LIBARCHIVE.creationtime': '1319686852',
|
|
||||||
dev: 234881026,
|
|
||||||
ino: 51681874,
|
|
||||||
nlink: 1 },
|
|
||||||
undefined ],
|
|
||||||
[ 'longPath',
|
|
||||||
{ path: '././@LongLink',
|
|
||||||
mode: 0,
|
|
||||||
uid: 0,
|
|
||||||
gid: 0,
|
|
||||||
size: 201,
|
|
||||||
mtime: new Date('Thu, 01 Jan 1970 00:00:00 GMT'),
|
|
||||||
cksum: 4976,
|
|
||||||
type: 'L',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: false },
|
|
||||||
'200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' ],
|
|
||||||
[ 'entry',
|
|
||||||
{ path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
|
||||||
mode: 420,
|
|
||||||
uid: 1000,
|
|
||||||
gid: 1000,
|
|
||||||
size: 201,
|
|
||||||
mtime: new Date('Thu, 27 Oct 2011 22:21:50 GMT'),
|
|
||||||
cksum: 14086,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: false },
|
|
||||||
undefined ],
|
|
||||||
[ 'longLinkpath',
|
|
||||||
{ path: '././@LongLink',
|
|
||||||
mode: 0,
|
|
||||||
uid: 0,
|
|
||||||
gid: 0,
|
|
||||||
size: 201,
|
|
||||||
mtime: new Date('Thu, 01 Jan 1970 00:00:00 GMT'),
|
|
||||||
cksum: 4975,
|
|
||||||
type: 'K',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: false },
|
|
||||||
'200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' ],
|
|
||||||
[ 'longPath',
|
|
||||||
{ path: '././@LongLink',
|
|
||||||
mode: 0,
|
|
||||||
uid: 0,
|
|
||||||
gid: 0,
|
|
||||||
size: 201,
|
|
||||||
mtime: new Date('Thu, 01 Jan 1970 00:00:00 GMT'),
|
|
||||||
cksum: 4976,
|
|
||||||
type: 'L',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: false },
|
|
||||||
'200LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL' ],
|
|
||||||
[ 'entry',
|
|
||||||
{ path: '200LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL',
|
|
||||||
mode: 511,
|
|
||||||
uid: 1000,
|
|
||||||
gid: 1000,
|
|
||||||
size: 0,
|
|
||||||
mtime: new Date('Fri, 28 Oct 2011 23:05:17 GMT'),
|
|
||||||
cksum: 21603,
|
|
||||||
type: '2',
|
|
||||||
linkpath: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
|
||||||
ustar: false },
|
|
||||||
undefined ],
|
|
||||||
[ 'extendedHeader',
|
|
||||||
{ path: 'PaxHeader/200-hard',
|
|
||||||
mode: 420,
|
|
||||||
uid: 24561,
|
|
||||||
gid: 20,
|
|
||||||
size: 143,
|
|
||||||
mtime: new Date('Thu, 27 Oct 2011 03:41:08 GMT'),
|
|
||||||
cksum: 6533,
|
|
||||||
type: 'x',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\0',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: 'isaacs',
|
|
||||||
gname: 'staff',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' },
|
|
||||||
{ ctime: 1320617144,
|
|
||||||
atime: 1320617232,
|
|
||||||
'LIBARCHIVE.creationtime': '1319686852',
|
|
||||||
dev: 234881026,
|
|
||||||
ino: 51681874,
|
|
||||||
nlink: 2 } ],
|
|
||||||
[ 'entry',
|
|
||||||
{ path: '200-hard',
|
|
||||||
mode: 420,
|
|
||||||
uid: 24561,
|
|
||||||
gid: 20,
|
|
||||||
size: 200,
|
|
||||||
mtime: new Date('Thu, 27 Oct 2011 03:41:08 GMT'),
|
|
||||||
cksum: 5526,
|
|
||||||
type: '0',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\0',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: 'isaacs',
|
|
||||||
gname: 'staff',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '',
|
|
||||||
ctime: new Date('Sun, 06 Nov 2011 22:05:44 GMT'),
|
|
||||||
atime: new Date('Sun, 06 Nov 2011 22:07:12 GMT'),
|
|
||||||
'LIBARCHIVE.creationtime': '1319686852',
|
|
||||||
dev: 234881026,
|
|
||||||
ino: 51681874,
|
|
||||||
nlink: 2 },
|
|
||||||
undefined ],
|
|
||||||
[ 'extendedHeader',
|
|
||||||
{ path: 'PaxHeader/200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
|
||||||
mode: 420,
|
|
||||||
uid: 24561,
|
|
||||||
gid: 20,
|
|
||||||
size: 353,
|
|
||||||
mtime: new Date('Thu, 27 Oct 2011 03:41:08 GMT'),
|
|
||||||
cksum: 14488,
|
|
||||||
type: 'x',
|
|
||||||
linkpath: '',
|
|
||||||
ustar: 'ustar\0',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: 'isaacs',
|
|
||||||
gname: 'staff',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '' },
|
|
||||||
{ path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
|
||||||
ctime: 1320617144,
|
|
||||||
atime: 1320617406,
|
|
||||||
'LIBARCHIVE.creationtime': '1319686852',
|
|
||||||
dev: 234881026,
|
|
||||||
ino: 51681874,
|
|
||||||
nlink: 2 } ],
|
|
||||||
[ 'entry',
|
|
||||||
{ path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
|
||||||
mode: 420,
|
|
||||||
uid: 24561,
|
|
||||||
gid: 20,
|
|
||||||
size: 0,
|
|
||||||
mtime: new Date('Thu, 27 Oct 2011 03:41:08 GMT'),
|
|
||||||
cksum: 15173,
|
|
||||||
type: '1',
|
|
||||||
linkpath: '200-hard',
|
|
||||||
ustar: 'ustar\0',
|
|
||||||
ustarver: '00',
|
|
||||||
uname: 'isaacs',
|
|
||||||
gname: 'staff',
|
|
||||||
devmaj: 0,
|
|
||||||
devmin: 0,
|
|
||||||
fill: '',
|
|
||||||
ctime: new Date('Sun, 06 Nov 2011 22:05:44 GMT'),
|
|
||||||
atime: new Date('Sun, 06 Nov 2011 22:10:06 GMT'),
|
|
||||||
'LIBARCHIVE.creationtime': '1319686852',
|
|
||||||
dev: 234881026,
|
|
||||||
ino: 51681874,
|
|
||||||
nlink: 2 },
|
|
||||||
undefined ] ]
|
|
||||||
|
|
||||||
|
|
||||||
tap.test("parser test", function (t) {
|
|
||||||
var parser = tar.Parse()
|
|
||||||
|
|
||||||
parser.on("end", function () {
|
|
||||||
t.equal(index, expect.length, "saw all expected events")
|
|
||||||
t.end()
|
|
||||||
})
|
|
||||||
|
|
||||||
fs.createReadStream(file)
|
|
||||||
.pipe(parser)
|
|
||||||
.on("*", function (ev, entry) {
|
|
||||||
var wanted = expect[index]
|
|
||||||
if (!wanted) {
|
|
||||||
return t.fail("Unexpected event: " + ev)
|
|
||||||
}
|
|
||||||
var result = [ev, entry.props]
|
|
||||||
entry.on("end", function () {
|
|
||||||
result.push(entry.fields || entry.body)
|
|
||||||
|
|
||||||
t.equal(ev, wanted[0], index + " event type")
|
|
||||||
t.equivalent(entry.props, wanted[1], wanted[1].path + " entry properties")
|
|
||||||
if (wanted[2]) {
|
|
||||||
t.equivalent(result[2], wanted[2], "metadata values")
|
|
||||||
}
|
|
||||||
index ++
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
20
node_modules/tar/test/zz-cleanup.js
generated
vendored
20
node_modules/tar/test/zz-cleanup.js
generated
vendored
|
@ -1,20 +0,0 @@
|
||||||
// clean up the fixtures
|
|
||||||
|
|
||||||
var tap = require("tap")
|
|
||||||
, rimraf = require("rimraf")
|
|
||||||
, test = tap.test
|
|
||||||
, path = require("path")
|
|
||||||
|
|
||||||
test("clean fixtures", function (t) {
|
|
||||||
rimraf(path.resolve(__dirname, "fixtures"), function (er) {
|
|
||||||
t.ifError(er, "rimraf ./fixtures/")
|
|
||||||
t.end()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("clean tmp", function (t) {
|
|
||||||
rimraf(path.resolve(__dirname, "tmp"), function (er) {
|
|
||||||
t.ifError(er, "rimraf ./tmp/")
|
|
||||||
t.end()
|
|
||||||
})
|
|
||||||
})
|
|
Loading…
Add table
Add a link
Reference in a new issue