diff --git a/lib/cache/add-local-tarball.js b/lib/cache/add-local-tarball.js index 7a65b708..6c724bb7 100644 --- a/lib/cache/add-local-tarball.js +++ b/lib/cache/add-local-tarball.js @@ -81,11 +81,13 @@ function addLocalTarball (p, pkgData, shasum, cb_) { }) } -function addPlacedTarball (p, name, shasum, cb) { - if (!cb) cb = name, name = "" +function addPlacedTarball (p, pkgData, shasum, cb) { + assert(pkgData, "should have package data by now") + assert(typeof cb === "function", "cb function required") + getCacheStat(function (er, cs) { if (er) return cb(er) - return addPlacedTarball_(p, name, cs.uid, cs.gid, shasum, cb) + return addPlacedTarball_(p, pkgData, cs.uid, cs.gid, shasum, cb) }) } @@ -122,7 +124,7 @@ function addPlacedTarball (p, name, shasum, cb) { // When the tar and shasum streams both finish, make sure that the shasum // matches dist.shasum, and if not, clean up and bail. -function addPlacedTarball_ (p, name, uid, gid, resolvedSum, cb) { +function addPlacedTarball_ (p, pkgData, uid, gid, resolvedSum, cb) { // now we know it's in place already as .cache/name/ver/package.tgz // unpack to .cache/name/ver/package/, read the package.json, // and fire cb with the json data.