diff options
author | Ross Burton <ross.burton@intel.com> | 2016-09-21 17:31:27 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-09-22 11:18:11 +0100 |
commit | 37d5307db01fa3d708db1abd7bfb134edbba6dc0 (patch) | |
tree | cb7c2cc39e271a4fdecadf3739b5dfd2e713008e /bitbake/lib/bb/tests | |
parent | 7358cbf36b6e1da0d51a67258da61226f8013e06 (diff) | |
download | poky-37d5307db01fa3d708db1abd7bfb134edbba6dc0.tar.gz |
bitbake: fetch2: handle absolute paths in subdir
Currently if you use the subdir parameter in a SRC_URI and pass an absolute path
then it gets appended to the unpack directory instead of being used directly.
This is inconvenient as it may be useful to use ${S} when you want to unpack a
file into the source tree.
Change this behaviour so that absolute paths are used directly instead of being
appended to the root directory. To ensure that recipes cannot write files to an
arbitrary location enforce that the subdir starts with the unpack root.
(Bitbake rev: c3873346c6fa1021a1d63bddd9b898a77c618432)
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/tests')
-rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index d7c73dda02..0fd2c02163 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
@@ -508,6 +508,15 @@ class FetcherLocalTest(FetcherTest): | |||
508 | tree = self.fetchUnpack(['file://dir/subdir/e;subdir=bar']) | 508 | tree = self.fetchUnpack(['file://dir/subdir/e;subdir=bar']) |
509 | self.assertEqual(tree, ['bar/dir/subdir/e']) | 509 | self.assertEqual(tree, ['bar/dir/subdir/e']) |
510 | 510 | ||
511 | def test_local_absolutedir(self): | ||
512 | # Unpacking to an absolute path that is a subdirectory of the root | ||
513 | # should work | ||
514 | tree = self.fetchUnpack(['file://a;subdir=%s' % os.path.join(self.unpackdir, 'bar')]) | ||
515 | |||
516 | # Unpacking to an absolute path outside of the root should fail | ||
517 | with self.assertRaises(bb.fetch2.UnpackError): | ||
518 | self.fetchUnpack(['file://a;subdir=/bin/sh']) | ||
519 | |||
511 | class FetcherNetworkTest(FetcherTest): | 520 | class FetcherNetworkTest(FetcherTest): |
512 | 521 | ||
513 | if os.environ.get("BB_SKIP_NETTESTS") == "yes": | 522 | if os.environ.get("BB_SKIP_NETTESTS") == "yes": |