summaryrefslogtreecommitdiffstats
path: root/lib/bb/fetch2/npm.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-09-13 14:11:41 +1200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-09-14 23:04:04 +0100
commitb4705c80add1f618c11a9223cdd9578d763b50ec (patch)
treef3c0a8f9cd47f1dd141d163e007a438b3ce117e4 /lib/bb/fetch2/npm.py
parent56ac0d4c7a5f47aeb707b15a0c305d9f73aae945 (diff)
downloadbitbake-contrib-b4705c80add1f618c11a9223cdd9578d763b50ec.tar.gz
fetch2/npm: don't download same URL multiple times
If we've already fetched a particular URL then we do not need to do so again within in the same operation. Maintain an internal list of fetched URLs to avoid doing that. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/fetch2/npm.py')
-rw-r--r--lib/bb/fetch2/npm.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/bb/fetch2/npm.py b/lib/bb/fetch2/npm.py
index 43929ce9a..699ae72e0 100644
--- a/lib/bb/fetch2/npm.py
+++ b/lib/bb/fetch2/npm.py
@@ -165,7 +165,9 @@ class Npm(FetchMethod):
pdata = json.loads('\n'.join(datalines))
return pdata
- def _getdependencies(self, pkg, data, version, d, ud, optional=False):
+ def _getdependencies(self, pkg, data, version, d, ud, optional=False, fetchedlist=None):
+ if fetchedlist is None:
+ fetchedlist = []
pkgfullname = pkg
if version != '*' and not '/' in version:
pkgfullname += "@'%s'" % version
@@ -187,7 +189,9 @@ class Npm(FetchMethod):
outputurl = pdata['dist']['tarball']
data[pkg] = {}
data[pkg]['tgz'] = os.path.basename(outputurl)
- self._runwget(ud, d, "%s --directory-prefix=%s %s" % (self.basecmd, ud.prefixdir, outputurl), False)
+ if not outputurl in fetchedlist:
+ self._runwget(ud, d, "%s --directory-prefix=%s %s" % (self.basecmd, ud.prefixdir, outputurl), False)
+ fetchedlist.append(outputurl)
dependencies = pdata.get('dependencies', {})
optionalDependencies = pdata.get('optionalDependencies', {})
@@ -200,9 +204,9 @@ class Npm(FetchMethod):
else:
depsfound[dep] = dependencies[dep]
for dep, version in optdepsfound.items():
- self._getdependencies(dep, data[pkg]['deps'], version, d, ud, optional=True)
+ self._getdependencies(dep, data[pkg]['deps'], version, d, ud, optional=True, fetchedlist=fetchedlist)
for dep, version in depsfound.items():
- self._getdependencies(dep, data[pkg]['deps'], version, d, ud)
+ self._getdependencies(dep, data[pkg]['deps'], version, d, ud, fetchedlist=fetchedlist)
def _getshrinkeddependencies(self, pkg, data, version, d, ud, lockdown, manifest, toplevel=True):
logger.debug(2, "NPM shrinkwrap file is %s" % data)