diff options
-rw-r--r-- | lib/bb/fetch2/__init__.py | 2 | ||||
-rw-r--r-- | lib/bb/tests/fetch.py | 7 |
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py index 68c8329e2b..87cf7e61a6 100644 --- a/lib/bb/fetch2/__init__.py +++ b/lib/bb/fetch2/__init__.py @@ -1264,6 +1264,8 @@ class FetchMethod(object): # items. So, only do so for file:// entries. if urldata.type == "file" and urldata.path.find("/") != -1: destdir = urldata.path.rsplit("/", 1)[0] + if urldata.parm.get('subdir') != None: + destdir = urldata.parm.get('subdir') + "/" + destdir else: if urldata.parm.get('subdir') != None: destdir = urldata.parm.get('subdir') diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py index 7df7a0ef51..d95b43a5e3 100644 --- a/lib/bb/tests/fetch.py +++ b/lib/bb/tests/fetch.py @@ -444,6 +444,13 @@ class FetcherLocalTest(FetcherTest): tree = self.fetchUnpack(['file://dir/subdir/e']) self.assertEqual(tree, ['dir/subdir/e']) + def test_local_subdirparam(self): + tree = self.fetchUnpack(['file://a;subdir=bar']) + self.assertEqual(tree, ['bar/a']) + + def test_local_deepsubdirparam(self): + tree = self.fetchUnpack(['file://dir/subdir/e;subdir=bar']) + self.assertEqual(tree, ['bar/dir/subdir/e']) class FetcherNetworkTest(FetcherTest): |