Bug 11449 - Allow overriding classes to override overridden classes
Summary: Allow overriding classes to override overridden classes
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 2.3
Hardware: x86 Multiple
: Medium+ enhancement
Target Milestone: 3.4 M3
Assignee: Richard Purdie
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2017-05-03 16:31 UTC by Ross Burton
Modified: 2021-08-04 21:56 UTC (History)
2 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ross Burton 2017-05-03 16:31:32 UTC
devupstream is great, but it can't work on native recipes.  We should try and fix that.
Comment 1 Robin Jordan 2018-02-26 20:40:05 UTC
Please provide a status update to this.  Will it make it into YP 2.5 M3?
Comment 2 Ross Burton 2018-05-15 08:51:15 UTC
Changing title and reassigning to RP.

Context: devupstream is a class which creates new recipes which use git AUTOREV SRC_URI instead of tarballs.  However to work for BBCLASSEXTEND'd native recipes, it needs to be able to see and override the native form.
Comment 3 Richard Purdie 2021-08-04 11:52:53 UTC
I had a play with this and after much experimentation, I found this which worked:

diff --git a/meta/classes/devupstream.bbclass b/meta/classes/devupstream.bbclass
index 1230fa12ea7..f6d0c88212a 100644
--- a/meta/classes/devupstream.bbclass
+++ b/meta/classes/devupstream.bbclass
@@ -25,23 +25,30 @@ python devupstream_virtclass_handler () {
         return
 
     variant = d.getVar("BBEXTENDVARIANT")
-    if variant not in ("target"):
-        bb.error("Pass the variant when using devupstream, for example devupstream:target")
-        return
+    #if variant not in ("target"):
+    #    bb.error("Pass the variant when using devupstream, for example devupstream:target")
+    #    return
 
     # Develpment releases are never preferred by default
     d.setVar("DEFAULT_PREFERENCE", "-1")
 
     uri = bb.fetch2.URI(d.getVar("SRC_URI").split()[0])
 
-    if uri.scheme == "git":
-        d.setVar("S", "${WORKDIR}/git")
+    #if uri.scheme == "git":
+    #    d.setVar("S", "${WORKDIR}/git")
 
     # Modify the PV if the recipe hasn't already overridden it
     pv = d.getVar("PV")
     proto_marker = "+" + uri.scheme
     if proto_marker not in pv:
         d.setVar("PV", pv + proto_marker + "${SRCPV}")
+
+    if variant == "native":
+        pn = d.getVar("PN")
+        d.setVar("PN", "%s-native" % (pn))
+        fn = d.getVar("FILE")
+        bb.parse.BBHandler.inherit("native", fn, 0, d)
+        d.appendVar("CLASSOVERRIDE", ":class-devupstream")
 }
 
 addhandler devupstream_virtclass_handler
diff --git a/meta/recipes-extended/bzip2/bzip2_1.0.8.bb b/meta/recipes-extended/bzip2/bzip2_1.0.8.bb
index 296bc68d412..c9c6b77565f 100644
--- a/meta/recipes-extended/bzip2/bzip2_1.0.8.bb
+++ b/meta/recipes-extended/bzip2/bzip2_1.0.8.bb
@@ -68,3 +68,21 @@ RDEPENDS:${PN}-ptest += "make bash"
 
 PROVIDES:append:class-native = " bzip2-replacement-native"
 BBCLASSEXTEND = "native nativesdk"
+
+
+
+
+BBCLASSEXTEND += "devupstream:target devupstream:native"
+SRC_URI:class-devupstream = "git://sourceware.org/git/bzip2.git;name=main;destsuffix=bzip2-1.0.8 \
+           git://sourceware.org/git/bzip2-tests.git;name=bzip2-tests \
+           file://configure.ac;subdir=bzip2-1.0.8 \
+           file://Makefile.am;subdir=bzip2-1.0.8 \
+           file://run-ptest \
+"
+
+DEFAULT_PREFERENCE:class-devupstream = "-1"
+SRCREV_main:class-devupstream = "8ca1faa31f396d94ab927b257f3a05236c84e330"
+PV:class-devupstream = "1.0.8+git${SRCPV}"
+S:class-devupstream = "${WORKDIR}/bzip2-1.0.8"
+SRCREV_FORMAT = "main_bzip2-tests"
+
Comment 4 Richard Purdie 2021-08-04 13:11:13 UTC
Patch on mailing list