summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorStefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>2021-11-25 13:59:54 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-11-26 17:01:37 +0000
commita0320f394423a20d3af08e1833f43ce94e2e1c7e (patch)
tree2dc2bc9048fd8e6d8f6280851140643ab8868fab /bitbake
parent6497b6ac6700d318e5036f9514a46ab44ea3a849 (diff)
downloadpoky-a0320f394423a20d3af08e1833f43ce94e2e1c7e.tar.gz
bitbake: test/fetch: Add striplevel unpack parameter test
(Bitbake rev: 7e1ca7ab50e3c6b642c3c11504c7c8f52cfa4528) Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/tests/fetch.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index d6c0af788f..dc45eb2e13 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -626,6 +626,9 @@ class FetcherLocalTest(FetcherTest):
626 os.makedirs(os.path.join(self.localsrcdir, 'dir', 'subdir')) 626 os.makedirs(os.path.join(self.localsrcdir, 'dir', 'subdir'))
627 touch(os.path.join(self.localsrcdir, 'dir', 'subdir', 'e')) 627 touch(os.path.join(self.localsrcdir, 'dir', 'subdir', 'e'))
628 touch(os.path.join(self.localsrcdir, r'backslash\x2dsystemd-unit.device')) 628 touch(os.path.join(self.localsrcdir, r'backslash\x2dsystemd-unit.device'))
629 bb.process.run('tar cf archive.tar -C dir .', cwd=self.localsrcdir)
630 bb.process.run('tar czf archive.tar.gz -C dir .', cwd=self.localsrcdir)
631 bb.process.run('tar cjf archive.tar.bz2 -C dir .', cwd=self.localsrcdir)
629 self.d.setVar("FILESPATH", self.localsrcdir) 632 self.d.setVar("FILESPATH", self.localsrcdir)
630 633
631 def fetchUnpack(self, uris): 634 def fetchUnpack(self, uris):
@@ -680,6 +683,18 @@ class FetcherLocalTest(FetcherTest):
680 with self.assertRaises(bb.fetch2.UnpackError): 683 with self.assertRaises(bb.fetch2.UnpackError):
681 self.fetchUnpack(['file://a;subdir=/bin/sh']) 684 self.fetchUnpack(['file://a;subdir=/bin/sh'])
682 685
686 def test_local_striplevel(self):
687 tree = self.fetchUnpack(['file://archive.tar;subdir=bar;striplevel=1'])
688 self.assertEqual(tree, ['bar/c', 'bar/d', 'bar/subdir/e'])
689
690 def test_local_striplevel_gzip(self):
691 tree = self.fetchUnpack(['file://archive.tar.gz;subdir=bar;striplevel=1'])
692 self.assertEqual(tree, ['bar/c', 'bar/d', 'bar/subdir/e'])
693
694 def test_local_striplevel_bzip2(self):
695 tree = self.fetchUnpack(['file://archive.tar.bz2;subdir=bar;striplevel=1'])
696 self.assertEqual(tree, ['bar/c', 'bar/d', 'bar/subdir/e'])
697
683 def dummyGitTest(self, suffix): 698 def dummyGitTest(self, suffix):
684 # Create dummy local Git repo 699 # Create dummy local Git repo
685 src_dir = tempfile.mkdtemp(dir=self.tempdir, 700 src_dir = tempfile.mkdtemp(dir=self.tempdir,