diff options
Diffstat (limited to 'bitbake/lib/bb/tests/fetch.py')
-rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index 16a1b6f342..9fb6378fdc 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
@@ -2322,15 +2322,24 @@ class NPMTest(FetcherTest): | |||
2322 | ud = fetcher.ud[fetcher.urls[0]] | 2322 | ud = fetcher.ud[fetcher.urls[0]] |
2323 | fetcher.download() | 2323 | fetcher.download() |
2324 | self.assertTrue(os.path.exists(ud.localpath)) | 2324 | self.assertTrue(os.path.exists(ud.localpath)) |
2325 | # Setup the mirror | 2325 | |
2326 | pkgname = os.path.basename(ud.proxy.urls[0].split(';')[0]) | 2326 | # Setup the mirror by renaming the download directory |
2327 | mirrordir = os.path.join(self.tempdir, 'mirror') | 2327 | mirrordir = os.path.join(self.tempdir, 'mirror') |
2328 | bb.utils.mkdirhier(mirrordir) | 2328 | bb.utils.rename(self.dldir, mirrordir) |
2329 | os.replace(ud.localpath, os.path.join(mirrordir, pkgname)) | 2329 | os.mkdir(self.dldir) |
2330 | self.d.setVar('PREMIRRORS', 'https?$://.*/.* file://%s/' % mirrordir) | 2330 | |
2331 | # Configure the premirror to be used | ||
2332 | self.d.setVar('PREMIRRORS', 'https?$://.*/.* file://%s/npm2' % mirrordir) | ||
2331 | self.d.setVar('BB_FETCH_PREMIRRORONLY', '1') | 2333 | self.d.setVar('BB_FETCH_PREMIRRORONLY', '1') |
2334 | |||
2332 | # Fetch again | 2335 | # Fetch again |
2333 | self.assertFalse(os.path.exists(ud.localpath)) | 2336 | self.assertFalse(os.path.exists(ud.localpath)) |
2337 | # The npm fetcher doesn't handle that the .resolved file disappears | ||
2338 | # while the fetcher object exists, which it does when we rename the | ||
2339 | # download directory to "mirror" above. Thus we need a new fetcher to go | ||
2340 | # with the now empty download directory. | ||
2341 | fetcher = bb.fetch.Fetch([url], self.d) | ||
2342 | ud = fetcher.ud[fetcher.urls[0]] | ||
2334 | fetcher.download() | 2343 | fetcher.download() |
2335 | self.assertTrue(os.path.exists(ud.localpath)) | 2344 | self.assertTrue(os.path.exists(ud.localpath)) |
2336 | 2345 | ||