From a14aeb9a7d09f49fecefa9eebb0b9a49a514b7ab Mon Sep 17 00:00:00 2001 From: isaacs Date: Wed, 14 May 2014 22:11:29 -0700 Subject: [PATCH] addPlacedTarball: send package data obj, not name --- lib/cache/add-local-tarball.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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.