commit nodejs-which for openSUSE:Factory

Hello community, here is the log from the commit of package nodejs-which for openSUSE:Factory checked in at 2015-07-02 22:39:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/nodejs-which (Old) and /work/SRC/openSUSE:Factory/.nodejs-which.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "nodejs-which" Changes: -------- --- /work/SRC/openSUSE:Factory/nodejs-which/nodejs-which.changes 2015-04-27 13:02:13.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.nodejs-which.new/nodejs-which.changes 2015-07-02 22:39:56.000000000 +0200 @@ -1,0 +2,10 @@ +Sat Jun 6 13:03:36 UTC 2015 - i@marguerite.su + +- update version 1.1.1 + +------------------------------------------------------------------- +Fri Apr 24 13:03:05 UTC 2015 - hvogel@suse.com + +- Update to version 1.0.9 + +------------------------------------------------------------------- Old: ---- which-1.0.5.tgz New: ---- which-1.1.1.tgz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ nodejs-which.spec ++++++ --- /var/tmp/diff_new_pack.omzOxW/_old 2015-07-02 22:39:57.000000000 +0200 +++ /var/tmp/diff_new_pack.omzOxW/_new 2015-07-02 22:39:57.000000000 +0200 @@ -19,10 +19,10 @@ %define base_name which Name: nodejs-which -Version: 1.0.5 +Version: 1.1.1 Release: 0 Summary: A which(1) command for node.js -License: MIT +License: ISC Group: Development/Languages/Other Url: https://github.com/isaacs/which Source: http://registry.npmjs.org/%{base_name}/-/%{base_name}-%{version}.tgz ++++++ which-1.0.5.tgz -> which-1.1.1.tgz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/LICENSE new/package/LICENSE --- old/package/LICENSE 2011-09-23 18:46:12.000000000 +0200 +++ new/package/LICENSE 2014-11-25 11:34:19.000000000 +0100 @@ -1,23 +1,15 @@ -Copyright 2009, 2010, 2011 Isaac Z. Schlueter. -All rights reserved. +The ISC License -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: +Copyright (c) Isaac Z. Schlueter and Contributors -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/README.md new/package/README.md --- old/package/README.md 2011-08-07 20:22:07.000000000 +0200 +++ new/package/README.md 2015-05-10 06:10:58.000000000 +0200 @@ -1,5 +1,34 @@ -The "which" util from npm's guts. +# which + +Like the unix `which` utility. Finds the first instance of a specified executable in the PATH environment variable. Does not cache the results, so `hash -r` is not needed when the PATH changes. + +## USAGE + +```javascript +var which = require('which') + +// async usage +which('node', function (er, resolvedPath) { + // er is returned if no "node" is found on the PATH + // if it is found, then the absolute path to the exec is returned +}) + +// sync usage +// throws if not found +var resolved = which.sync('node') + +// Pass options to override the PATH and PATHEXT environment vars. +which('node', { path: someOtherPath }, function (er, resolved) { + if (er) + throw er + console.log('found at %j', resolved) +}) +``` + +## OPTIONS + +If you pass in options, then `path` and `pathExt` are relevant. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/package.json new/package/package.json --- old/package/package.json 2012-03-02 01:07:38.000000000 +0100 +++ new/package/package.json 2015-05-10 06:24:18.000000000 +0200 @@ -2,16 +2,23 @@ "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)", "name": "which", "description": "Like which(1) unix command. Find the first instance of an executable in the PATH.", - "version": "1.0.5", + "version": "1.1.1", "repository": { "type": "git", "url": "git://github.com/isaacs/node-which.git" }, "main": "which.js", "bin": "./bin/which", - "engines": { - "node": "*" + "license": "ISC", + "dependencies": { + "is-absolute": "^0.1.7" }, - "dependencies": {}, - "devDependencies": {} + "devDependencies": { + "mkdirp": "^0.5.0", + "rimraf": "^2.3.3", + "tap": "^1.0.2" + }, + "scripts": { + "test": "tap test/*.js" + } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/test/basic.js new/package/test/basic.js --- old/package/test/basic.js 1970-01-01 01:00:00.000000000 +0100 +++ new/package/test/basic.js 2015-05-10 06:18:16.000000000 +0200 @@ -0,0 +1,84 @@ +var t = require('tap') +var fs = require('fs') +var rimraf = require('rimraf') +var mkdirp = require('mkdirp') +var fixture = __dirname + '/fixture' +var which = require('../which.js') +var path = require('path') + +var isWindows = process.platform === 'win32' || + process.env.OSTYPE === 'cygwin' || + process.env.OSTYPE === 'msys' + +var skip = { skip: isWindows ? 'not relevant on windows' : false } + +t.test('setup', function (t) { + rimraf.sync(fixture) + mkdirp.sync(fixture) + fs.writeFileSync(fixture + '/foo.sh', 'echo foo\n') + t.end() +}) + +t.test('does not find non-executable', skip, function (t) { + t.plan(2) + + t.test('absolute', function (t) { + t.plan(2) + which(fixture + '/foo.sh', function (er) { + t.isa(er, Error) + }) + + t.throws(function () { + which.sync(fixture + '/foo.sh') + }) + }) + + t.test('with path', function (t) { + t.plan(2) + which('foo.sh', { path: fixture }, function (er) { + t.isa(er, Error) + }) + + t.throws(function () { + which.sync('foo.sh', { path: fixture }) + }) + }) +}) + +t.test('make executable', function (t) { + fs.chmodSync(fixture + '/foo.sh', '0755') + t.end() +}) + +t.test('find when executable', function (t) { + t.plan(2) + var opt = { pathExt: '.sh' } + var expect = path.resolve(fixture, 'foo.sh').toLowerCase() + + t.test('absolute', function (t) { + t.plan(2) + runTest(t) + }) + + function runTest(t) { + which(fixture + '/foo.sh', opt, function (er, found) { + if (er) + throw er + t.equal(found.toLowerCase(), expect) + }) + + var found = which.sync(fixture + '/foo.sh', opt).toLowerCase() + t.equal(found, expect) + } + + t.test('with path', function (t) { + t.plan(2) + opt.path = fixture + runTest(t) + }) +}) + +t.test('clean', function (t) { + rimraf.sync(fixture) + t.end() +}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/which.js new/package/which.js --- old/package/which.js 2012-03-02 01:07:21.000000000 +0100 +++ new/package/which.js 2015-05-10 06:23:16.000000000 +0200 @@ -1,57 +1,83 @@ module.exports = which which.sync = whichSync -var path = require("path") - , fs - , COLON = process.platform === "win32" ? ";" : ":" - , isExe - -try { - fs = require("graceful-fs") -} catch (ex) { - fs = require("fs") -} +var isWindows = process.platform === 'win32' || + process.env.OSTYPE === 'cygwin' || + process.env.OSTYPE === 'msys' + +var path = require('path') +var COLON = isWindows ? ';' : ':' +var isExe +var fs = require('fs') +var isAbsolute = require('is-absolute') -if (process.platform == "win32") { +if (isWindows) { // On windows, there is no good way to check that a file is executable isExe = function isExe () { return true } } else { isExe = function isExe (mod, uid, gid) { - //console.error(mod, uid, gid); - //console.error("isExe?", (mod & 0111).toString(8)) var ret = (mod & 0001) || (mod & 0010) && process.getgid && gid === process.getgid() || (mod & 0100) && process.getuid && uid === process.getuid() - //console.error("isExe?", ret) + || (mod & 0110) && process.getuid && 0 === process.getuid() + + if (process.getgroups && (mod & 0010)) { + var groups = process.getgroups() + for (var g = 0; g < groups.length; g++) { + if (groups[g] === gid) + return true + } + } + return ret } } +function which (cmd, opt, cb) { + if (typeof opt === 'function') { + cb = opt + opt = {} + } + var colon = opt.colon || COLON + var pathEnv = opt.path || process.env.PATH || '' + var pathExt = [''] + + // On windows, env.Path is common. + if (isWindows && !pathEnv) { + var k = Object.keys(process.env) + for (var p = 0; p < k.length; p++) { + if (p.toLowerCase() === 'path') { + pathEnv = process.env[p] + break + } + } + } + + pathEnv = pathEnv.split(colon) -function which (cmd, cb) { - if (isAbsolute(cmd)) return cb(null, cmd) - var pathEnv = (process.env.PATH || "").split(COLON) - , pathExt = [""] - if (process.platform === "win32") { - pathEnv.push(process.cwd()) - pathExt = (process.env.PATHEXT || ".EXE").split(COLON) - if (cmd.indexOf(".") !== -1) pathExt.unshift("") + if (isWindows) { + pathEnv.unshift(process.cwd()) + pathExt = (opt.pathExt || process.env.PATHEXT || '.EXE').split(colon) + if (cmd.indexOf('.') !== -1 && pathExt[0] !== '') + pathExt.unshift('') } - //console.error("pathEnv", pathEnv) + + // If it's absolute, then we don't bother searching the pathenv. + // just check the file itself, and that's it. + if (isAbsolute(cmd)) + pathEnv = [''] + ;(function F (i, l) { - if (i === l) return cb(new Error("not found: "+cmd)) + if (i === l) return cb(new Error('not found: '+cmd)) var p = path.resolve(pathEnv[i], cmd) ;(function E (ii, ll) { if (ii === ll) return F(i + 1, l) var ext = pathExt[ii] - //console.error(p + ext) fs.stat(p + ext, function (er, stat) { if (!er && - stat && stat.isFile() && isExe(stat.mode, stat.uid, stat.gid)) { - //console.error("yes, exe!", p + ext) return cb(null, p + ext) } return E(ii + 1, ll) @@ -60,45 +86,52 @@ })(0, pathEnv.length) } -function whichSync (cmd) { - if (isAbsolute(cmd)) return cmd - var pathEnv = (process.env.PATH || "").split(COLON) - , pathExt = [""] - if (process.platform === "win32") { - pathEnv.push(process.cwd()) - pathExt = (process.env.PATHEXT || ".EXE").split(COLON) - if (cmd.indexOf(".") !== -1) pathExt.unshift("") +function whichSync (cmd, opt) { + if (!opt) + opt = {} + + var colon = opt.colon || COLON + + var pathEnv = opt.path || process.env.PATH || '' + var pathExt = [''] + + // On windows, env.Path is common. + if (isWindows && !pathEnv) { + var k = Object.keys(process.env) + for (var p = 0; p < k.length; p++) { + if (p.toLowerCase() === 'path') { + pathEnv = process.env[p] + break + } + } } + + pathEnv = pathEnv.split(colon) + + if (isWindows) { + pathEnv.unshift(process.cwd()) + pathExt = (opt.pathExt || process.env.PATHEXT || '.EXE').split(colon) + if (cmd.indexOf('.') !== -1 && pathExt[0] !== '') + pathExt.unshift('') + } + + // If it's absolute, then we don't bother searching the pathenv. + // just check the file itself, and that's it. + if (isAbsolute(cmd)) + pathEnv = [''] + for (var i = 0, l = pathEnv.length; i < l; i ++) { var p = path.join(pathEnv[i], cmd) for (var j = 0, ll = pathExt.length; j < ll; j ++) { var cur = p + pathExt[j] var stat - try { stat = fs.statSync(cur) } catch (ex) {} - if (stat && - stat.isFile() && - isExe(stat.mode, stat.uid, stat.gid)) return cur + try { + stat = fs.statSync(cur) + if (stat.isFile() && isExe(stat.mode, stat.uid, stat.gid)) + return cur + } catch (ex) {} } } - throw new Error("not found: "+cmd) -} - -var isAbsolute = process.platform === "win32" ? absWin : absUnix - -function absWin (p) { - if (absUnix(p)) return true - // pull off the device/UNC bit from a windows path. - // from node's lib/path.js - var splitDeviceRe = - /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?([\\\/])?/ - , result = splitDeviceRe.exec(p) - , device = result[1] || '' - , isUnc = device && device.charAt(1) !== ':' - , isAbsolute = !!result[2] || isUnc // UNC paths are always absolute - - return isAbsolute -} -function absUnix (p) { - return p.charAt(0) === "/" || p === "" + throw new Error('not found: '+cmd) }
participants (1)
-
root@hilbert.suse.de