summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/tests/fetch.py
diff options
context:
space:
mode:
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>2022-01-29 03:29:33 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-02-05 17:46:44 +0000
commit66a7541b4fcbaf2f2c810f040f21f7f7350bf7ee (patch)
tree5a5f150816a34f77fc029eeee5b3fb51f1ac4221 /bitbake/lib/bb/tests/fetch.py
parent63cebdc8e8fa4c29d9baa325e8ada7301738266d (diff)
downloadpoky-66a7541b4fcbaf2f2c810f040f21f7f7350bf7ee.tar.gz
bitbake: tests/fetch: Skip the crate tests if network tests are disabled
Both test_crate_url and test_crate_url_multi require Internet access. (Bitbake rev: 34e9daed6a7f766bb6e27c7e02c94b545f4791d8) Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/tests/fetch.py')
-rw-r--r--bitbake/lib/bb/tests/fetch.py46
1 files changed, 23 insertions, 23 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index ec7d83c959..e1d79bf964 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -442,10 +442,10 @@ class MirrorUriTest(FetcherTest):
442 #("file://sstate-xyz.tgz", "file://.*/.*", "file:///somewhere/1234/sstate-cache") : "file:///somewhere/1234/sstate-cache/sstate-xyz.tgz", 442 #("file://sstate-xyz.tgz", "file://.*/.*", "file:///somewhere/1234/sstate-cache") : "file:///somewhere/1234/sstate-cache/sstate-xyz.tgz",
443 } 443 }
444 444
445 mirrorvar = "http://.*/.* file:///somepath/downloads/ \n" \ 445 mirrorvar = "http://.*/.* file:///somepath/downloads/ " \
446 "git://someserver.org/bitbake git://git.openembedded.org/bitbake \n" \ 446 "git://someserver.org/bitbake git://git.openembedded.org/bitbake " \
447 "https://.*/.* file:///someotherpath/downloads/ \n" \ 447 "https://.*/.* file:///someotherpath/downloads/ " \
448 "http://.*/.* file:///someotherpath/downloads/ \n" 448 "http://.*/.* file:///someotherpath/downloads/"
449 449
450 def test_urireplace(self): 450 def test_urireplace(self):
451 for k, v in self.replaceuris.items(): 451 for k, v in self.replaceuris.items():
@@ -470,8 +470,8 @@ class MirrorUriTest(FetcherTest):
470 470
471 def test_mirror_of_mirror(self): 471 def test_mirror_of_mirror(self):
472 # Test if mirror of a mirror works 472 # Test if mirror of a mirror works
473 mirrorvar = self.mirrorvar + " http://.*/.* http://otherdownloads.yoctoproject.org/downloads/ \n" 473 mirrorvar = self.mirrorvar + " http://.*/.* http://otherdownloads.yoctoproject.org/downloads/"
474 mirrorvar = mirrorvar + " http://otherdownloads.yoctoproject.org/.* http://downloads2.yoctoproject.org/downloads/ \n" 474 mirrorvar = mirrorvar + " http://otherdownloads.yoctoproject.org/.* http://downloads2.yoctoproject.org/downloads/"
475 fetcher = bb.fetch.FetchData("http://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", self.d) 475 fetcher = bb.fetch.FetchData("http://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", self.d)
476 mirrors = bb.fetch2.mirror_from_string(mirrorvar) 476 mirrors = bb.fetch2.mirror_from_string(mirrorvar)
477 uris, uds = bb.fetch2.build_mirroruris(fetcher, mirrors, self.d) 477 uris, uds = bb.fetch2.build_mirroruris(fetcher, mirrors, self.d)
@@ -480,8 +480,8 @@ class MirrorUriTest(FetcherTest):
480 'http://otherdownloads.yoctoproject.org/downloads/bitbake-1.0.tar.gz', 480 'http://otherdownloads.yoctoproject.org/downloads/bitbake-1.0.tar.gz',
481 'http://downloads2.yoctoproject.org/downloads/bitbake-1.0.tar.gz']) 481 'http://downloads2.yoctoproject.org/downloads/bitbake-1.0.tar.gz'])
482 482
483 recmirrorvar = "https://.*/[^/]* http://AAAA/A/A/A/ \n" \ 483 recmirrorvar = "https://.*/[^/]* http://AAAA/A/A/A/ " \
484 "https://.*/[^/]* https://BBBB/B/B/B/ \n" 484 "https://.*/[^/]* https://BBBB/B/B/B/"
485 485
486 def test_recursive(self): 486 def test_recursive(self):
487 fetcher = bb.fetch.FetchData("https://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", self.d) 487 fetcher = bb.fetch.FetchData("https://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", self.d)
@@ -503,7 +503,7 @@ class GitDownloadDirectoryNamingTest(FetcherTest):
503 self.d.setVar('SRCREV', '82ea737a0b42a8b53e11c9cde141e9e9c0bd8c40') 503 self.d.setVar('SRCREV', '82ea737a0b42a8b53e11c9cde141e9e9c0bd8c40')
504 504
505 def setup_mirror_rewrite(self): 505 def setup_mirror_rewrite(self):
506 self.d.setVar("PREMIRRORS", self.recipe_url + " " + self.mirror_url + " \n") 506 self.d.setVar("PREMIRRORS", self.recipe_url + " " + self.mirror_url)
507 507
508 @skipIfNoNetwork() 508 @skipIfNoNetwork()
509 def test_that_directory_is_named_after_recipe_url_when_no_mirroring_is_used(self): 509 def test_that_directory_is_named_after_recipe_url_when_no_mirroring_is_used(self):
@@ -552,7 +552,7 @@ class TarballNamingTest(FetcherTest):
552 self.d.setVar('SRCREV', '82ea737a0b42a8b53e11c9cde141e9e9c0bd8c40') 552 self.d.setVar('SRCREV', '82ea737a0b42a8b53e11c9cde141e9e9c0bd8c40')
553 553
554 def setup_mirror_rewrite(self): 554 def setup_mirror_rewrite(self):
555 self.d.setVar("PREMIRRORS", self.recipe_url + " " + self.mirror_url + " \n") 555 self.d.setVar("PREMIRRORS", self.recipe_url + " " + self.mirror_url)
556 556
557 @skipIfNoNetwork() 557 @skipIfNoNetwork()
558 def test_that_the_recipe_tarball_is_created_when_no_mirroring_is_used(self): 558 def test_that_the_recipe_tarball_is_created_when_no_mirroring_is_used(self):
@@ -587,7 +587,7 @@ class GitShallowTarballNamingTest(FetcherTest):
587 self.d.setVar('SRCREV', '82ea737a0b42a8b53e11c9cde141e9e9c0bd8c40') 587 self.d.setVar('SRCREV', '82ea737a0b42a8b53e11c9cde141e9e9c0bd8c40')
588 588
589 def setup_mirror_rewrite(self): 589 def setup_mirror_rewrite(self):
590 self.d.setVar("PREMIRRORS", self.recipe_url + " " + self.mirror_url + " \n") 590 self.d.setVar("PREMIRRORS", self.recipe_url + " " + self.mirror_url)
591 591
592 @skipIfNoNetwork() 592 @skipIfNoNetwork()
593 def test_that_the_tarball_is_named_after_recipe_url_when_no_mirroring_is_used(self): 593 def test_that_the_tarball_is_named_after_recipe_url_when_no_mirroring_is_used(self):
@@ -867,14 +867,14 @@ class FetcherNetworkTest(FetcherTest):
867 867
868 @skipIfNoNetwork() 868 @skipIfNoNetwork()
869 def test_fetch_mirror_of_mirror(self): 869 def test_fetch_mirror_of_mirror(self):
870 self.d.setVar("MIRRORS", "http://.*/.* http://invalid2.yoctoproject.org/ \n http://invalid2.yoctoproject.org/.* https://downloads.yoctoproject.org/releases/bitbake") 870 self.d.setVar("MIRRORS", "http://.*/.* http://invalid2.yoctoproject.org/ http://invalid2.yoctoproject.org/.* https://downloads.yoctoproject.org/releases/bitbake")
871 fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz"], self.d) 871 fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz"], self.d)
872 fetcher.download() 872 fetcher.download()
873 self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.0.tar.gz"), 57749) 873 self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.0.tar.gz"), 57749)
874 874
875 @skipIfNoNetwork() 875 @skipIfNoNetwork()
876 def test_fetch_file_mirror_of_mirror(self): 876 def test_fetch_file_mirror_of_mirror(self):
877 self.d.setVar("MIRRORS", "http://.*/.* file:///some1where/ \n file:///some1where/.* file://some2where/ \n file://some2where/.* https://downloads.yoctoproject.org/releases/bitbake") 877 self.d.setVar("MIRRORS", "http://.*/.* file:///some1where/ file:///some1where/.* file://some2where/ file://some2where/.* https://downloads.yoctoproject.org/releases/bitbake")
878 fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz"], self.d) 878 fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz"], self.d)
879 os.mkdir(self.dldir + "/some2where") 879 os.mkdir(self.dldir + "/some2where")
880 fetcher.download() 880 fetcher.download()
@@ -981,13 +981,13 @@ class FetcherNetworkTest(FetcherTest):
981 def test_gitfetch_finds_local_tarball_for_mirrored_url_when_previous_downloaded_by_the_recipe_url(self): 981 def test_gitfetch_finds_local_tarball_for_mirrored_url_when_previous_downloaded_by_the_recipe_url(self):
982 recipeurl = "git://git.openembedded.org/bitbake" 982 recipeurl = "git://git.openembedded.org/bitbake"
983 mirrorurl = "git://someserver.org/bitbake" 983 mirrorurl = "git://someserver.org/bitbake"
984 self.d.setVar("PREMIRRORS", "git://someserver.org/bitbake git://git.openembedded.org/bitbake \n") 984 self.d.setVar("PREMIRRORS", "git://someserver.org/bitbake git://git.openembedded.org/bitbake")
985 self.gitfetcher(recipeurl, mirrorurl) 985 self.gitfetcher(recipeurl, mirrorurl)
986 986
987 @skipIfNoNetwork() 987 @skipIfNoNetwork()
988 def test_gitfetch_finds_local_tarball_when_previous_downloaded_from_a_premirror(self): 988 def test_gitfetch_finds_local_tarball_when_previous_downloaded_from_a_premirror(self):
989 recipeurl = "git://someserver.org/bitbake" 989 recipeurl = "git://someserver.org/bitbake"
990 self.d.setVar("PREMIRRORS", "git://someserver.org/bitbake git://git.openembedded.org/bitbake \n") 990 self.d.setVar("PREMIRRORS", "git://someserver.org/bitbake git://git.openembedded.org/bitbake")
991 self.gitfetcher(recipeurl, recipeurl) 991 self.gitfetcher(recipeurl, recipeurl)
992 992
993 @skipIfNoNetwork() 993 @skipIfNoNetwork()
@@ -997,7 +997,7 @@ class FetcherNetworkTest(FetcherTest):
997 self.sourcedir = self.unpackdir.replace("unpacked", "sourcemirror.git") 997 self.sourcedir = self.unpackdir.replace("unpacked", "sourcemirror.git")
998 os.chdir(self.tempdir) 998 os.chdir(self.tempdir)
999 bb.process.run("git clone %s %s 2> /dev/null" % (realurl, self.sourcedir), shell=True) 999 bb.process.run("git clone %s %s 2> /dev/null" % (realurl, self.sourcedir), shell=True)
1000 self.d.setVar("PREMIRRORS", "%s git://%s;protocol=file \n" % (recipeurl, self.sourcedir)) 1000 self.d.setVar("PREMIRRORS", "%s git://%s;protocol=file" % (recipeurl, self.sourcedir))
1001 self.gitfetcher(recipeurl, recipeurl) 1001 self.gitfetcher(recipeurl, recipeurl)
1002 1002
1003 @skipIfNoNetwork() 1003 @skipIfNoNetwork()
@@ -1852,7 +1852,7 @@ class GitShallowTest(FetcherTest):
1852 # Set up the mirror 1852 # Set up the mirror
1853 mirrordir = os.path.join(self.tempdir, 'mirror') 1853 mirrordir = os.path.join(self.tempdir, 'mirror')
1854 bb.utils.rename(self.dldir, mirrordir) 1854 bb.utils.rename(self.dldir, mirrordir)
1855 self.d.setVar('PREMIRRORS', 'gitsm://.*/.* file://%s/\n' % mirrordir) 1855 self.d.setVar('PREMIRRORS', 'gitsm://.*/.* file://%s/' % mirrordir)
1856 1856
1857 # Fetch from the mirror 1857 # Fetch from the mirror
1858 bb.utils.remove(self.dldir, recurse=True) 1858 bb.utils.remove(self.dldir, recurse=True)
@@ -1967,7 +1967,7 @@ class GitShallowTest(FetcherTest):
1967 # Set up the mirror 1967 # Set up the mirror
1968 mirrordir = os.path.join(self.tempdir, 'mirror') 1968 mirrordir = os.path.join(self.tempdir, 'mirror')
1969 bb.utils.mkdirhier(mirrordir) 1969 bb.utils.mkdirhier(mirrordir)
1970 self.d.setVar('PREMIRRORS', 'git://.*/.* file://%s/\n' % mirrordir) 1970 self.d.setVar('PREMIRRORS', 'git://.*/.* file://%s/' % mirrordir)
1971 1971
1972 bb.utils.rename(os.path.join(self.dldir, mirrortarball), 1972 bb.utils.rename(os.path.join(self.dldir, mirrortarball),
1973 os.path.join(mirrordir, mirrortarball)) 1973 os.path.join(mirrordir, mirrortarball))
@@ -2349,7 +2349,7 @@ class NPMTest(FetcherTest):
2349 mirrordir = os.path.join(self.tempdir, 'mirror') 2349 mirrordir = os.path.join(self.tempdir, 'mirror')
2350 bb.utils.mkdirhier(mirrordir) 2350 bb.utils.mkdirhier(mirrordir)
2351 os.replace(ud.localpath, os.path.join(mirrordir, pkgname)) 2351 os.replace(ud.localpath, os.path.join(mirrordir, pkgname))
2352 self.d.setVar('PREMIRRORS', 'https?$://.*/.* file://%s/\n' % mirrordir) 2352 self.d.setVar('PREMIRRORS', 'https?$://.*/.* file://%s/' % mirrordir)
2353 self.d.setVar('BB_FETCH_PREMIRRORONLY', '1') 2353 self.d.setVar('BB_FETCH_PREMIRRORONLY', '1')
2354 # Fetch again 2354 # Fetch again
2355 self.assertFalse(os.path.exists(ud.localpath)) 2355 self.assertFalse(os.path.exists(ud.localpath))
@@ -2370,7 +2370,7 @@ class NPMTest(FetcherTest):
2370 bb.utils.mkdirhier(mirrordir) 2370 bb.utils.mkdirhier(mirrordir)
2371 mirrorfilename = os.path.join(mirrordir, os.path.basename(ud.localpath)) 2371 mirrorfilename = os.path.join(mirrordir, os.path.basename(ud.localpath))
2372 os.replace(ud.localpath, mirrorfilename) 2372 os.replace(ud.localpath, mirrorfilename)
2373 self.d.setVar('PREMIRRORS', 'https?$://.*/.* file://%s\n' % mirrorfilename) 2373 self.d.setVar('PREMIRRORS', 'https?$://.*/.* file://%s' % mirrorfilename)
2374 self.d.setVar('BB_FETCH_PREMIRRORONLY', '1') 2374 self.d.setVar('BB_FETCH_PREMIRRORONLY', '1')
2375 # Fetch again 2375 # Fetch again
2376 self.assertFalse(os.path.exists(ud.localpath)) 2376 self.assertFalse(os.path.exists(ud.localpath))
@@ -2390,7 +2390,7 @@ class NPMTest(FetcherTest):
2390 mirrordir = os.path.join(self.tempdir, 'mirror') 2390 mirrordir = os.path.join(self.tempdir, 'mirror')
2391 bb.utils.mkdirhier(mirrordir) 2391 bb.utils.mkdirhier(mirrordir)
2392 os.replace(ud.localpath, os.path.join(mirrordir, os.path.basename(ud.localpath))) 2392 os.replace(ud.localpath, os.path.join(mirrordir, os.path.basename(ud.localpath)))
2393 self.d.setVar('MIRRORS', 'https?$://.*/.* file://%s/\n' % mirrordir) 2393 self.d.setVar('MIRRORS', 'https?$://.*/.* file://%s/' % mirrordir)
2394 # Update the resolved url to an invalid url 2394 # Update the resolved url to an invalid url
2395 with open(ud.resolvefile, 'r') as f: 2395 with open(ud.resolvefile, 'r') as f:
2396 url = f.read() 2396 url = f.read()
@@ -2706,7 +2706,7 @@ class NPMTest(FetcherTest):
2706 mirrordir = os.path.join(self.tempdir, 'mirror') 2706 mirrordir = os.path.join(self.tempdir, 'mirror')
2707 bb.utils.mkdirhier(mirrordir) 2707 bb.utils.mkdirhier(mirrordir)
2708 os.replace(ud.localpath, os.path.join(mirrordir, os.path.basename(ud.localpath))) 2708 os.replace(ud.localpath, os.path.join(mirrordir, os.path.basename(ud.localpath)))
2709 self.d.setVar('PREMIRRORS', 'https?$://.*/.* file://%s/\n' % mirrordir) 2709 self.d.setVar('PREMIRRORS', 'https?$://.*/.* file://%s/' % mirrordir)
2710 self.d.setVar('BB_FETCH_PREMIRRORONLY', '1') 2710 self.d.setVar('BB_FETCH_PREMIRRORONLY', '1')
2711 # Fetch again 2711 # Fetch again
2712 self.assertFalse(os.path.exists(ud.localpath)) 2712 self.assertFalse(os.path.exists(ud.localpath))
@@ -2735,7 +2735,7 @@ class NPMTest(FetcherTest):
2735 mirrordir = os.path.join(self.tempdir, 'mirror') 2735 mirrordir = os.path.join(self.tempdir, 'mirror')
2736 bb.utils.mkdirhier(mirrordir) 2736 bb.utils.mkdirhier(mirrordir)
2737 os.replace(ud.localpath, os.path.join(mirrordir, os.path.basename(ud.localpath))) 2737 os.replace(ud.localpath, os.path.join(mirrordir, os.path.basename(ud.localpath)))
2738 self.d.setVar('MIRRORS', 'https?$://.*/.* file://%s/\n' % mirrordir) 2738 self.d.setVar('MIRRORS', 'https?$://.*/.* file://%s/' % mirrordir)
2739 # Fetch again with invalid url 2739 # Fetch again with invalid url
2740 self.assertFalse(os.path.exists(ud.localpath)) 2740 self.assertFalse(os.path.exists(ud.localpath))
2741 swfile = self.create_shrinkwrap_file({ 2741 swfile = self.create_shrinkwrap_file({