Openembedded Bitbake Development
 help / color / mirror / Atom feed
* [PATCH] fetch: Extend testing of subdir unpack parameter and fix
@ 2014-09-24 14:23 Richard Purdie
  0 siblings, 0 replies; only message in thread
From: Richard Purdie @ 2014-09-24 14:23 UTC (permalink / raw)
  To: bitbake-devel

This fixes urls of the form file://some/path/file;subdir=b. It also
adds in a couple of tests so we now tests these corner cases.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 66f0e36..2e147ec 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/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/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index 0476541..8db7575 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -445,6 +445,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):
 




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-09-24 14:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-24 14:23 [PATCH] fetch: Extend testing of subdir unpack parameter and fix Richard Purdie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox