Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var dh_make = function(dir, ctx) {
var d = Q.defer(),
tplDir = ctx.versioned? 'debian-npm-ver' : 'debian-npm',
cmd = [
BIN.dh_make,
//'--cdbs',
'--defaultless',
'--templates', PATH.resolve(__dirname, '..', tplDir),
'--packagename', ctx.debianName,
//'--copyright', 'gpl', // TODO
'--createorig',
'--file', PATH.resolve(NPM.cache, ctx.pkg, ctx.ver, 'package.tgz')
].join(' '),
opts = { cwd: dir, env: process.env };
console.log(cmd);
var child = CP.exec(cmd, opts, function(err, stdout, stderr) {
err? d.reject(err) : d.resolve();
});
child.stdin.write('\n');
return d.promise;
};
function _traverseWrap (depPath, name, dep) {
toHash++;
var data = localJson(path.join(depPath));
var sha = getShasum(npm.cache || cacheDir, name, dep.version);
hashCB(null, name, dep, sha);
if (dep.dependencies) {
Object.keys(dep.dependencies).forEach(function (depName) {
// skip bundled bependencies, the sha of the parent covers these
if (data.bundleDependencies && data.bundleDependencies.indexOf(depName) >= 0) return;
_traverseWrap(path.join(depPath, 'node_modules', depName), depName, dep.dependencies[depName]);
});
}
if (--toHash === 0) {
endCB(null, wrap);
}
}
}
.then(function() {
console.log('versioned = %s', opts.versioned);
console.log('bin = %s', NPM.bin);
console.log('dir = %s', NPM.dir);
console.log('cache = %s', NPM.cache);
console.log('tmp = %s', NPM.tmp);
console.log('binaries = %s', SYS.inspect(BIN));
return args.pkg.reduce(function(done, pkg) {
return Q.all([done, debianize(pkg, opts)]).get(0);
}, undefined);
});
function (info) {
var packageDir = path.resolve(npm.cache, info.name, info.version, 'package');
var packageTGZ = path.resolve(npm.cache, info.name, info.version, 'package.tgz');
return unpack.unpackTgz(packageTGZ, packageDir);
}
);
function (info) {
var packageDir = path.resolve(npm.cache, info.name, info.version, 'package');
var packageTGZ = path.resolve(npm.cache, info.name, info.version, 'package.tgz');
return unpack.unpackTgz(packageTGZ, packageDir);
}
);
cache.read(pkg, ver, function (er, data) {
if (er) return log.er(cb, "Could not read data for "+pkg+"@"+ver)(er);
unpackTar(path.join(npm.cache, pkg, ver, "package.tgz"), unpackTarget, cb);
})
}
function (info) {
var packageDir = path.resolve(npm.cache, info.name, info.version, 'package');
var packageTGZ = path.resolve(npm.cache, info.name, info.version, 'package.tgz');
return unpack.unpackTgz(packageTGZ, packageDir);
}
);
function (info) {
var packageDir = path.resolve(npm.cache, info.name, info.version, 'package');
var packageTGZ = path.resolve(npm.cache, info.name, info.version, 'package.tgz');
return unpack.unpackTgz(packageTGZ, packageDir);
}
);
}).then(function(info) {
var pkgDir = path.resolve(npm.cache, info.name, info.version, 'package');
return pkgDir;
});
}