]> code.ossystems Code Review - openembedded-core.git/commit
lib/oe/path: implement is_path_parent()
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Mon, 26 Feb 2018 01:49:54 +0000 (14:49 +1300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 1 Mar 2018 22:09:17 +0000 (22:09 +0000)
commitdd3d4b0367272a5826a9a51afa26f426dd003e5d
tree08e60a8ad8e3944653b52cb40aff5921abc2ba1c
parent5b3afc9cfe38a9fb435fbe5fcabc59b9a60f4657
lib/oe/path: implement is_path_parent()

In a few places we have checks to see path B is the parent of path A, by
adding / to the end of the path B and then seeing if path A starts with
the suffixed path B. Unfortunately there are two potential flaws:
(1) path A needs to be suffixed with / as well or the directory itself
won't match (semantics perhaps, but in a lot of scenarios returning True
is correct); (2) you need to run os.path.abspath() on both paths first
or you will wrongly return False for some relative paths where you
should return True. Let's solve this once and for all by writing a
function that takes care of these and put it in oe.path.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oe/path.py