All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: openembedded-core <openembedded-core@lists.openembedded.org>
Subject: [PATCH] sstatesig.py: Add handling for machine specific module depenedencies
Date: Wed, 22 Feb 2012 22:50:44 +0000	[thread overview]
Message-ID: <1329951044.32110.32.camel@ted> (raw)

Adding dependencies on machine specific recipes from generic packages
causes a rebuild of the generic package per machine if using signatures
for the stamp files which is unacceptable.

We need to declare that RRECOMMENDS on kernel-module-* are safe
and that we shouldn't care about these machine specific dependencies
from a stamp perspective. This change adds code which does this.

It depends on a change in bitbake to expose the dataCache object
which can be used to make the calculations we need to allow this to
work correctly.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py
index ee7cbad..5a64882 100644
--- a/meta/lib/oe/sstatesig.py
+++ b/meta/lib/oe/sstatesig.py
@@ -1,6 +1,6 @@
 import bb.siggen
 
-def sstate_rundepfilter(fn, recipename, task, dep, depname):
+def sstate_rundepfilter(fn, recipename, task, dep, depname, dataCache):
     # Return True if we should keep the dependency, False to drop it
     def isNative(x):
         return x.endswith("-native")
@@ -8,13 +8,16 @@ def sstate_rundepfilter(fn, recipename, task, dep, depname):
         return x.endswith("-cross") or x.endswith("-cross-initial") or x.endswith("-cross-intermediate")
     def isNativeSDK(x):
         return x.endswith("-nativesdk")
+    def isKernel(fn):
+        inherits = " ".join(dataCache.inherits[fn])
+        return inherits.find("module-base.bbclass") != -1 or inherits.find("linux-kernel-base.bbclass") != -1
 
     # Always include our own inter-task dependencies
     if recipename == depname:
         return True
 
     # Quilt (patch application) changing isn't likely to affect anything
-    if depname == "quilt-native":
+    if depname == "quilt-native" and recipename != "quilt-native":
         return False
     # Don't change native/cross/nativesdk recipe dependencies any further
     if isNative(recipename) or isCross(recipename) or isNativeSDK(recipename):
@@ -30,6 +33,17 @@ def sstate_rundepfilter(fn, recipename, task, dep, depname):
     if depname in ['sysvinit-inittab', 'shadow-securetty', 'opkg-config-base', 'netbase', 'formfactor', 'xserver-xf86-config', 'pointercal', 'base-files']:
         return False
 
+    # Kernel modules are well namespaced. We don't want to depend on the kernel's checksum
+    # if we're just doing an RRECOMMENDS_xxx = "kernel-module-*", not least because the checksum
+    # is machine specific.
+    # Therefore if we're not a kernel or a module recipe (inheriting the kernel classes)
+    # and we reccomend a kernel-module, we exclude the dependency.
+    depfn = dep.rsplit(".", 1)[0]
+    if dataCache and isKernel(depfn) and not isKernel(fn):
+        for pkg in dataCache.runrecs[fn]:
+            if " ".join(dataCache.runrecs[fn][pkg]).find("kernel-module-") != -1:
+                return False
+
     # Default to keep dependencies
     return True
 
@@ -37,15 +51,15 @@ class SignatureGeneratorOEBasic(bb.siggen.SignatureGeneratorBasic):
     name = "OEBasic"
     def init_rundepcheck(self, data):
         pass
-    def rundep_check(self, fn, recipename, task, dep, depname):
-        return sstate_rundepfilter(fn, recipename, task, dep, depname)
+    def rundep_check(self, fn, recipename, task, dep, depname, dataCache = None):
+        return sstate_rundepfilter(fn, recipename, task, dep, depname, dataCache)
 
 class SignatureGeneratorOEBasicHash(bb.siggen.SignatureGeneratorBasicHash):
     name = "OEBasicHash"
     def init_rundepcheck(self, data):
         pass
-    def rundep_check(self, fn, recipename, task, dep, depname):
-        return sstate_rundepfilter(fn, recipename, task, dep, depname)
+    def rundep_check(self, fn, recipename, task, dep, depname, dataCache = None):
+        return sstate_rundepfilter(fn, recipename, task, dep, depname, dataCache)
 
 # Insert these classes into siggen's namespace so it can see and select them
 bb.siggen.SignatureGeneratorOEBasic = SignatureGeneratorOEBasic





                 reply	other threads:[~2012-02-22 22:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1329951044.32110.32.camel@ted \
    --to=richard.purdie@linuxfoundation.org \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.