]> code.ossystems Code Review - openembedded-core.git/commitdiff
devtool: slight simplification of path splitting logic
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Thu, 28 May 2015 13:00:52 +0000 (16:00 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 18 Jun 2015 08:12:00 +0000 (09:12 +0100)
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
scripts/lib/devtool/standard.py

index 4b9cebb210a63ee63fe59875596df86086a3e6a6..c92c9aed31d23a36b62b3c75fa318eed433cb601 100644 (file)
@@ -464,13 +464,12 @@ def modify(args, config, basepath, workspace):
                 initial_rev = stdout.rstrip()
 
     # Check that recipe isn't using a shared workdir
-    s = rd.getVar('S', True)
-    workdir = rd.getVar('WORKDIR', True)
-    if s.startswith(workdir):
+    s = os.path.abspath(rd.getVar('S', True))
+    workdir = os.path.abspath(rd.getVar('WORKDIR', True))
+    if s.startswith(workdir) and s != workdir and os.path.dirname(s) != workdir:
         # Handle if S is set to a subdirectory of the source
-        if s != workdir and os.path.dirname(s) != workdir:
-            srcsubdir = os.sep.join(os.path.relpath(s, workdir).split(os.sep)[1:])
-            srctree = os.path.join(srctree, srcsubdir)
+        srcsubdir = os.path.relpath(s, workdir).split(os.sep, 1)[1]
+        srctree = os.path.join(srctree, srcsubdir)
 
     appendpath = os.path.join(config.workspace_path, 'appends')
     if not os.path.exists(appendpath):