From: "Scott Weaver" <weaverjs@gmail.com>
To: bitbake-devel@lists.openembedded.org
Cc: Scott Weaver <weaverjs@gmail.com>
Subject: [bitbake-devel][ 3/3] bitbake: tests/fetch: add and fix npm tests
Date: Sun, 5 Sep 2021 18:27:38 -0400 [thread overview]
Message-ID: <20210905222738.1050768-4-weaverjs@gmail.com> (raw)
In-Reply-To: <20210905222738.1050768-1-weaverjs@gmail.com>
This adds one new test that verifies the use of a specific filename
when defined in PREMIRRORS.
bb.tests.fetch.NPMTest:
- test_npm_premirrors_with_specified_filename
While testing bz#13039, it was found that test_npm_registry_alternate
fails with ENOTFOUND. This was corrected by using npmjs's public mirror.
The change to fetch2 for bz#13039 highlighted an issue with the
test_npm_premirrors test where the created file:// mirror was using the
downloadfilename rather than the tarball that is defined by the npm url.
Signed-off-by: Scott Weaver <weaverjs@gmail.com>
---
bitbake/lib/bb/tests/fetch.py | 26 ++++++++++++++++++++++++--
1 file 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):
fetcher.download()
self.assertTrue(os.path.exists(ud.localpath))
# Setup the mirror
+ pkgname = os.path.basename(ud.proxy.urls[0].split(';')[0])
mirrordir = os.path.join(self.tempdir, 'mirror')
bb.utils.mkdirhier(mirrordir)
- os.replace(ud.localpath, os.path.join(mirrordir, os.path.basename(ud.localpath)))
+ os.replace(ud.localpath, os.path.join(mirrordir, pkgname))
self.d.setVar('PREMIRRORS', 'https?$://.*/.* file://%s/\n' % mirrordir)
self.d.setVar('BB_FETCH_PREMIRRORONLY', '1')
# Fetch again
@@ -2288,6 +2289,27 @@ class NPMTest(FetcherTest):
fetcher.download()
self.assertTrue(os.path.exists(ud.localpath))
+ @skipIfNoNpm()
+ @skipIfNoNetwork()
+ def test_npm_premirrors_with_specified_filename(self):
+ url = 'npm://registry.npmjs.org;package=@savoirfairelinux/node-server-example;version=1.0.0'
+ # Fetch once to get a tarball
+ fetcher = bb.fetch.Fetch([url], self.d)
+ ud = fetcher.ud[fetcher.urls[0]]
+ fetcher.download()
+ self.assertTrue(os.path.exists(ud.localpath))
+ # Setup the mirror
+ mirrordir = os.path.join(self.tempdir, 'mirror')
+ bb.utils.mkdirhier(mirrordir)
+ mirrorfilename = os.path.join(mirrordir, os.path.basename(ud.localpath))
+ os.replace(ud.localpath, mirrorfilename)
+ self.d.setVar('PREMIRRORS', 'https?$://.*/.* file://%s\n' % mirrorfilename)
+ self.d.setVar('BB_FETCH_PREMIRRORONLY', '1')
+ # Fetch again
+ self.assertFalse(os.path.exists(ud.localpath))
+ fetcher.download()
+ self.assertTrue(os.path.exists(ud.localpath))
+
@skipIfNoNpm()
@skipIfNoNetwork()
def test_npm_mirrors(self):
@@ -2350,7 +2372,7 @@ class NPMTest(FetcherTest):
@skipIfNoNpm()
@skipIfNoNetwork()
def test_npm_registry_alternate(self):
- url = 'npm://registry.freajs.org;package=@savoirfairelinux/node-server-example;version=1.0.0'
+ url = 'npm://skimdb.npmjs.com;package=@savoirfairelinux/node-server-example;version=1.0.0'
fetcher = bb.fetch.Fetch([url], self.d)
fetcher.download()
fetcher.unpack(self.unpackdir)
--
2.25.1
prev parent reply other threads:[~2021-09-05 22:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-05 22:27 [bitbake-devel][0/3] BZ#13039: updates to fetch2 and tests/fetch Scott Weaver
2021-09-05 22:27 ` [bitbake-devel][ 1/3] bitbake: fetch2: fix premirror URI when downloadfilename defined Scott Weaver
2021-09-22 1:58 ` kai
2021-09-28 2:00 ` Scott Weaver
2021-10-14 9:01 ` Robert Yang
2021-10-15 6:37 ` ChenQi
[not found] ` <16AE2029FEDEE475.7161@lists.openembedded.org>
2021-10-15 6:40 ` ChenQi
2021-09-05 22:27 ` [bitbake-devel][ 2/3] bitbake: tests/fetch: add downloadfilename tests Scott Weaver
2021-09-05 22:27 ` Scott Weaver [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210905222738.1050768-4-weaverjs@gmail.com \
--to=weaverjs@gmail.com \
--cc=bitbake-devel@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.