summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2
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-15 12:15:07 +0100
commitd5698c0afca89f81d95a4850dcffec56de9bbe3e (patch)
tree233742eb04399d21a1be50a90e3d1219e2d979f5 /bitbake/lib/bb/fetch2
parentd649c64bebb0ae756ac65068f5b64262bcfffdd2 (diff)
downloadpoky-d5698c0afca89f81d95a4850dcffec56de9bbe3e.tar.gz
bitbake: 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. (Bitbake rev: b4705c80add1f618c11a9223cdd9578d763b50ec) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2')
-rw-r--r--bitbake/lib/bb/fetch2/npm.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/bitbake/lib/bb/fetch2/npm.py b/bitbake/lib/bb/fetch2/npm.py
index 43929ce9a3..699ae72e05 100644
--- a/bitbake/lib/bb/fetch2/npm.py
+++ b/bitbake/lib/bb/fetch2/npm.py
@@ -165,7 +165,9 @@ class Npm(FetchMethod):
165 pdata = json.loads('\n'.join(datalines)) 165 pdata = json.loads('\n'.join(datalines))
166 return pdata 166 return pdata
167 167
168 def _getdependencies(self, pkg, data, version, d, ud, optional=False): 168 def _getdependencies(self, pkg, data, version, d, ud, optional=False, fetchedlist=None):
169 if fetchedlist is None:
170 fetchedlist = []
169 pkgfullname = pkg 171 pkgfullname = pkg
170 if version != '*' and not '/' in version: 172 if version != '*' and not '/' in version:
171 pkgfullname += "@'%s'" % version 173 pkgfullname += "@'%s'" % version
@@ -187,7 +189,9 @@ class Npm(FetchMethod):
187 outputurl = pdata['dist']['tarball'] 189 outputurl = pdata['dist']['tarball']
188 data[pkg] = {} 190 data[pkg] = {}
189 data[pkg]['tgz'] = os.path.basename(outputurl) 191 data[pkg]['tgz'] = os.path.basename(outputurl)
190 self._runwget(ud, d, "%s --directory-prefix=%s %s" % (self.basecmd, ud.prefixdir, outputurl), False) 192 if not outputurl in fetchedlist:
193 self._runwget(ud, d, "%s --directory-prefix=%s %s" % (self.basecmd, ud.prefixdir, outputurl), False)
194 fetchedlist.append(outputurl)
191 195
192 dependencies = pdata.get('dependencies', {}) 196 dependencies = pdata.get('dependencies', {})
193 optionalDependencies = pdata.get('optionalDependencies', {}) 197 optionalDependencies = pdata.get('optionalDependencies', {})
@@ -200,9 +204,9 @@ class Npm(FetchMethod):
200 else: 204 else:
201 depsfound[dep] = dependencies[dep] 205 depsfound[dep] = dependencies[dep]
202 for dep, version in optdepsfound.items(): 206 for dep, version in optdepsfound.items():
203 self._getdependencies(dep, data[pkg]['deps'], version, d, ud, optional=True) 207 self._getdependencies(dep, data[pkg]['deps'], version, d, ud, optional=True, fetchedlist=fetchedlist)
204 for dep, version in depsfound.items(): 208 for dep, version in depsfound.items():
205 self._getdependencies(dep, data[pkg]['deps'], version, d, ud) 209 self._getdependencies(dep, data[pkg]['deps'], version, d, ud, fetchedlist=fetchedlist)
206 210
207 def _getshrinkeddependencies(self, pkg, data, version, d, ud, lockdown, manifest, toplevel=True): 211 def _getshrinkeddependencies(self, pkg, data, version, d, ud, lockdown, manifest, toplevel=True):
208 logger.debug(2, "NPM shrinkwrap file is %s" % data) 212 logger.debug(2, "NPM shrinkwrap file is %s" % data)