diff options
-rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index 1735d0b071..242be36891 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
@@ -2278,9 +2278,10 @@ class NPMTest(FetcherTest): | |||
2278 | fetcher.download() | 2278 | fetcher.download() |
2279 | self.assertTrue(os.path.exists(ud.localpath)) | 2279 | self.assertTrue(os.path.exists(ud.localpath)) |
2280 | # Setup the mirror | 2280 | # Setup the mirror |
2281 | pkgname = os.path.basename(ud.proxy.urls[0].split(';')[0]) | ||
2281 | mirrordir = os.path.join(self.tempdir, 'mirror') | 2282 | mirrordir = os.path.join(self.tempdir, 'mirror') |
2282 | bb.utils.mkdirhier(mirrordir) | 2283 | bb.utils.mkdirhier(mirrordir) |
2283 | os.replace(ud.localpath, os.path.join(mirrordir, os.path.basename(ud.localpath))) | 2284 | os.replace(ud.localpath, os.path.join(mirrordir, pkgname)) |
2284 | self.d.setVar('PREMIRRORS', 'https?$://.*/.* file://%s/\n' % mirrordir) | 2285 | self.d.setVar('PREMIRRORS', 'https?$://.*/.* file://%s/\n' % mirrordir) |
2285 | self.d.setVar('BB_FETCH_PREMIRRORONLY', '1') | 2286 | self.d.setVar('BB_FETCH_PREMIRRORONLY', '1') |
2286 | # Fetch again | 2287 | # Fetch again |
@@ -2290,6 +2291,27 @@ class NPMTest(FetcherTest): | |||
2290 | 2291 | ||
2291 | @skipIfNoNpm() | 2292 | @skipIfNoNpm() |
2292 | @skipIfNoNetwork() | 2293 | @skipIfNoNetwork() |
2294 | def test_npm_premirrors_with_specified_filename(self): | ||
2295 | url = 'npm://registry.npmjs.org;package=@savoirfairelinux/node-server-example;version=1.0.0' | ||
2296 | # Fetch once to get a tarball | ||
2297 | fetcher = bb.fetch.Fetch([url], self.d) | ||
2298 | ud = fetcher.ud[fetcher.urls[0]] | ||
2299 | fetcher.download() | ||
2300 | self.assertTrue(os.path.exists(ud.localpath)) | ||
2301 | # Setup the mirror | ||
2302 | mirrordir = os.path.join(self.tempdir, 'mirror') | ||
2303 | bb.utils.mkdirhier(mirrordir) | ||
2304 | mirrorfilename = os.path.join(mirrordir, os.path.basename(ud.localpath)) | ||
2305 | os.replace(ud.localpath, mirrorfilename) | ||
2306 | self.d.setVar('PREMIRRORS', 'https?$://.*/.* file://%s\n' % mirrorfilename) | ||
2307 | self.d.setVar('BB_FETCH_PREMIRRORONLY', '1') | ||
2308 | # Fetch again | ||
2309 | self.assertFalse(os.path.exists(ud.localpath)) | ||
2310 | fetcher.download() | ||
2311 | self.assertTrue(os.path.exists(ud.localpath)) | ||
2312 | |||
2313 | @skipIfNoNpm() | ||
2314 | @skipIfNoNetwork() | ||
2293 | def test_npm_mirrors(self): | 2315 | def test_npm_mirrors(self): |
2294 | # Fetch once to get a tarball | 2316 | # Fetch once to get a tarball |
2295 | url = 'npm://registry.npmjs.org;package=@savoirfairelinux/node-server-example;version=1.0.0' | 2317 | url = 'npm://registry.npmjs.org;package=@savoirfairelinux/node-server-example;version=1.0.0' |
@@ -2350,7 +2372,7 @@ class NPMTest(FetcherTest): | |||
2350 | @skipIfNoNpm() | 2372 | @skipIfNoNpm() |
2351 | @skipIfNoNetwork() | 2373 | @skipIfNoNetwork() |
2352 | def test_npm_registry_alternate(self): | 2374 | def test_npm_registry_alternate(self): |
2353 | url = 'npm://registry.freajs.org;package=@savoirfairelinux/node-server-example;version=1.0.0' | 2375 | url = 'npm://skimdb.npmjs.com;package=@savoirfairelinux/node-server-example;version=1.0.0' |
2354 | fetcher = bb.fetch.Fetch([url], self.d) | 2376 | fetcher = bb.fetch.Fetch([url], self.d) |
2355 | fetcher.download() | 2377 | fetcher.download() |
2356 | fetcher.unpack(self.unpackdir) | 2378 | fetcher.unpack(self.unpackdir) |