<br><br><div class="gmail_quote">On Fri, Nov 16, 2012 at 1:32 PM, Richard Purdie <span dir="ltr">&lt;<a href="mailto:richard.purdie@linuxfoundation.org" target="_blank">richard.purdie@linuxfoundation.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This is a first attempt at logic to determine when a sstate dependency needs<br>
to be installed and when it does not. Its a start at the logic and errs on the<br></blockquote><div><br></div><div>s/errs/errors/</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

side of caution, as it gets wider testing, we can refine the logic as needed.<br>
<br>
This code should allow a significant performance speedup to certain workflows, for<br>
example &quot;bitbake xxx-image -c rootfs&quot; will not populate the target sysroot.<br>
<br>
Signed-off-by: Richard Purdie &lt;<a href="mailto:richard.purdie@linuxfoundation.org">richard.purdie@linuxfoundation.org</a>&gt;<br>
---<br>
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass<br>
index c085c62..470e0ee 100644<br>
--- a/meta/classes/sstate.bbclass<br>
+++ b/meta/classes/sstate.bbclass<br>
@@ -620,3 +620,55 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d):<br>
<br>
     return ret<br>
<br>
+BB_SETSCENE_DEPVALID = &quot;setscene_depvalid&quot;<br>
+<br>
+def setscene_depvalid(task, taskdependees, notneeded, d):<br>
+    # taskdependees is a dict of tasks which depend on task, each being a 3 item list of [PN, TASKNAME, FILENAME]<br>
+    # task is included in taskdependees too<br>
+<br>
+    bb.debug(2, &quot;Considering setscene task: %s&quot; % (str(taskdependees[task])))<br>
+<br>
+    def isNative(x):<br>
+        return x.endswith(&quot;-native&quot;)<br>
+    def isNativeCross(x):<br>
+        return x.endswith(&quot;-native&quot;) or x.endswith(&quot;-cross&quot;) or x.endswith(&quot;-cross-initial&quot;)<br>
+    def isSafeDep(x):<br>
+        if x in [&quot;quilt-native&quot;, &quot;autoconf-native&quot;, &quot;automake-native&quot;, &quot;gnu-config-native&quot;, &quot;libtool-native&quot;, &quot;pkgconfig-native&quot;, &quot;gcc-cross&quot;, &quot;binutils-cross&quot;]:<br>

+            return True<br>
+        return False<br>
+<br>
+    # We can skip these &quot;safe&quot; dependencies since the aren&#39;t runtime dependencies, just build time<br>
+    if isSafeDep(taskdependees[task][0]) and taskdependees[task][1] == &quot;do_populate_sysroot&quot;:<br>
+        return True<br>
+<br>
+    # We only need to trigger populate_lic through direct dependencies<br>
+    if taskdependees[task][1] == &quot;do_populate_lic&quot;:<br>
+        return True<br>
+<br>
+    for dep in taskdependees:<br>
+        bb.debug(2, &quot;  considering dependency: %s&quot; % (str(taskdependees[dep])))<br>
+        if task == dep:<br>
+            continue<br>
+        if dep in notneeded:<br>
+            continue<br>
+        # do_package_write_* and do_package doesn&#39;t need do_package<br>
+        if taskdependees[task][1] == &quot;do_package&quot; and taskdependees[dep][1] in [&#39;do_package&#39;, &#39;do_package_write_deb&#39;, &#39;do_package_write_ipk&#39;, &#39;do_package_write_rpm&#39;]:<br>
+            continue<br></blockquote><div><br></div><div>I understand why you does this but it would be better if we had a central place to have the do_package_write_$pkg recorded or when adding new type this could be forgotten.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+        # do_package_write_* and do_package doesn&#39;t need do_populate_sysroot<br>
+        if taskdependees[task][1] == &quot;do_populate_sysroot&quot; and taskdependees[dep][1] in [&#39;do_package&#39;, &#39;do_package_write_deb&#39;, &#39;do_package_write_ipk&#39;, &#39;do_package_write_rpm&#39;]:<br>

+            continue<br>
+        # Native/Cross packages don&#39;t exist and are noexec anyway<br>
+        if isNativeCross(taskdependees[dep][0]) and taskdependees[dep][1] in [&#39;do_package_write_deb&#39;, &#39;do_package_write_ipk&#39;, &#39;do_package_write_rpm&#39;]:<br>
+            continue<br>
+        # Native/Cross populate_sysroot need their dependencies<br>
+        if isNativeCross(taskdependees[task][0]) and isNativeCross(taskdependees[dep][0]) and taskdependees[task][1] == &#39;do_populate_sysroot&#39; and taskdependees[dep][1] == &#39;do_populate_sysroot&#39;:<br>
+            return False<br>
+        # Target populate_sysroot do not need their dependencies<br>
+        if taskdependees[task][1] == &#39;do_populate_sysroot&#39; and taskdependees[dep][1] == &#39;do_populate_sysroot&#39;:<br>
+            continue<br>
+<br>
+        # Safe fallthrough default<br>
+        bb.debug(2, &quot; Default setscene dependency fall through due to dependency: %s&quot; % (str(taskdependees[dep])))<br>
+        return False<br>
+    return True<br>
+<br></blockquote><div><br></div></div>-- <br>Otavio Salvador                             O.S. Systems<br>E-mail: <a href="mailto:otavio@ossystems.com.br" target="_blank">otavio@ossystems.com.br</a>  <a href="http://www.ossystems.com.br" target="_blank">http://www.ossystems.com.br</a><br>
Mobile: +55 53 9981-7854              <a href="http://projetos.ossystems.com.br" target="_blank">http://projetos.ossystems.com.br</a><br><br>