* [PATCH] externalsrc.bbclass: Allow externalsrc to be extended with extra classes @ 2021-10-19 17:03 Peter Kjellerstedt 2021-10-19 17:15 ` [OE-core] " Jose Quaresma 0 siblings, 1 reply; 10+ messages in thread From: Peter Kjellerstedt @ 2021-10-19 17:03 UTC (permalink / raw) To: openembedded-core The EXTERNALSRC_EXTENSIONS variable holds a list of additional classes that will be inherited when externalsrc is inherited. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> --- We have had a local copy of this class for a long time since we need to make it suppport a local class when checking BBCLASSEXTEND. And now we wanted to add some more functionality that should be active when externalsrc is in use. So instead of forking the class even more, I thought it would be better to make the upstream class extendable. The solution was inspired by USERADDEXTENSION in useradd.bbclass. meta/classes/externalsrc.bbclass | 5 +++++ meta/conf/documentation.conf | 1 + 2 files changed, 6 insertions(+) diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass index abfe24bace..488d75760f 100644 --- a/meta/classes/externalsrc.bbclass +++ b/meta/classes/externalsrc.bbclass @@ -265,3 +265,8 @@ def srctree_configure_hash_files(d): return ' '.join(out_items) EXPORT_FUNCTIONS do_buildclean + +# Use the following to extend externalsrc with custom functionality +EXTERNALSRC_EXTENSIONS ??= "" + +inherit ${EXTERNALSRC_EXTENSIONS} diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf index 80ad8e10d5..6d5b734b02 100644 --- a/meta/conf/documentation.conf +++ b/meta/conf/documentation.conf @@ -160,6 +160,7 @@ EXTENDPE[doc] = "Used with file and pathnames to create a prefix for a recipe's EXTENDPKGV[doc] = "The full package version specification as it appears on the final packages produced by a recipe." EXTERNALSRC[doc] = "If externalsrc.bbclass is inherited, this variable points to the source tree, which is outside of the OpenEmbedded build system." EXTERNALSRC_BUILD[doc] = "If externalsrc.bbclass is inherited, this variable points to the directory in which the recipe's source code is built, which is outside of the OpenEmbedded build system." +EXTERNALSRC_EXTENSIONS[doc] = "A list of additional classes that will be inherited when externalsrc is inherited." EXTRA_IMAGE_FEATURES[doc] = "The list of additional features to include in an image. Configure this variable in the conf/local.conf file in the Build Directory." EXTRA_IMAGEDEPENDS[doc] = "A list of recipes to build that do not provide packages for installing into the root filesystem. Use this variable to list recipes that are required to build the final image, but not needed in the root filesystem." EXTRA_OECMAKE[doc] = "Additional cmake options." ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [OE-core] [PATCH] externalsrc.bbclass: Allow externalsrc to be extended with extra classes 2021-10-19 17:03 [PATCH] externalsrc.bbclass: Allow externalsrc to be extended with extra classes Peter Kjellerstedt @ 2021-10-19 17:15 ` Jose Quaresma 2021-10-20 1:31 ` Peter Kjellerstedt [not found] ` <16AF9916496D59D2.6466@lists.openembedded.org> 0 siblings, 2 replies; 10+ messages in thread From: Jose Quaresma @ 2021-10-19 17:15 UTC (permalink / raw) To: Peter Kjellerstedt; +Cc: OE-core [-- Attachment #1: Type: text/plain, Size: 3463 bytes --] Hi Peter, require the class on the new one will do the same and we don't need any changes for that but I may not be seeing everything require ${COREBASE}/meta/classes/externalsrc.bbclass Jose Peter Kjellerstedt <peter.kjellerstedt@axis.com> escreveu no dia terça, 19/10/2021 à(s) 18:03: > The EXTERNALSRC_EXTENSIONS variable holds a list of additional classes > that will be inherited when externalsrc is inherited. > > Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> > --- > > We have had a local copy of this class for a long time since we need > to make it suppport a local class when checking BBCLASSEXTEND. And > now we wanted to add some more functionality that should be active > when externalsrc is in use. So instead of forking the class even > more, I thought it would be better to make the upstream class > extendable. The solution was inspired by USERADDEXTENSION in > useradd.bbclass. > > meta/classes/externalsrc.bbclass | 5 +++++ > meta/conf/documentation.conf | 1 + > 2 files changed, 6 insertions(+) > > diff --git a/meta/classes/externalsrc.bbclass > b/meta/classes/externalsrc.bbclass > index abfe24bace..488d75760f 100644 > --- a/meta/classes/externalsrc.bbclass > +++ b/meta/classes/externalsrc.bbclass > @@ -265,3 +265,8 @@ def srctree_configure_hash_files(d): > return ' '.join(out_items) > > EXPORT_FUNCTIONS do_buildclean > + > +# Use the following to extend externalsrc with custom functionality > +EXTERNALSRC_EXTENSIONS ??= "" > + > +inherit ${EXTERNALSRC_EXTENSIONS} > diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf > index 80ad8e10d5..6d5b734b02 100644 > --- a/meta/conf/documentation.conf > +++ b/meta/conf/documentation.conf > @@ -160,6 +160,7 @@ EXTENDPE[doc] = "Used with file and pathnames to > create a prefix for a recipe's > EXTENDPKGV[doc] = "The full package version specification as it appears > on the final packages produced by a recipe." > EXTERNALSRC[doc] = "If externalsrc.bbclass is inherited, this variable > points to the source tree, which is outside of the OpenEmbedded build > system." > EXTERNALSRC_BUILD[doc] = "If externalsrc.bbclass is inherited, this > variable points to the directory in which the recipe's source code is > built, which is outside of the OpenEmbedded build system." > +EXTERNALSRC_EXTENSIONS[doc] = "A list of additional classes that will be > inherited when externalsrc is inherited." > EXTRA_IMAGE_FEATURES[doc] = "The list of additional features to include > in an image. Configure this variable in the conf/local.conf file in the > Build Directory." > EXTRA_IMAGEDEPENDS[doc] = "A list of recipes to build that do not provide > packages for installing into the root filesystem. Use this variable to list > recipes that are required to build the final image, but not needed in the > root filesystem." > EXTRA_OECMAKE[doc] = "Additional cmake options." > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#157190): > https://lists.openembedded.org/g/openembedded-core/message/157190 > Mute This Topic: https://lists.openembedded.org/mt/86444902/5052612 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ > quaresma.jose@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- > > -- Best regards, José Quaresma [-- Attachment #2: Type: text/html, Size: 4715 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [OE-core] [PATCH] externalsrc.bbclass: Allow externalsrc to be extended with extra classes 2021-10-19 17:15 ` [OE-core] " Jose Quaresma @ 2021-10-20 1:31 ` Peter Kjellerstedt [not found] ` <16AF9916496D59D2.6466@lists.openembedded.org> 1 sibling, 0 replies; 10+ messages in thread From: Peter Kjellerstedt @ 2021-10-20 1:31 UTC (permalink / raw) To: Jose Quaresma; +Cc: OE-core [-- Attachment #1: Type: text/plain, Size: 4260 bytes --] Well, I had not considered that option. I can’t say I am to keen on having wrapper classes with the same name as the upstream classes as I think it leads to confusion. And the solution doesn’t scale very well (what if two layers want to override the same class?). But on the positive side it works for any class without requiring changes to OE-Core. And I guess the latter wins. I wish there was a more bitbakey way to add to classes though (bbclassappend anyone? 😉). //Peter From: Jose Quaresma <quaresma.jose@gmail.com> Sent: den 19 oktober 2021 19:15 To: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Cc: OE-core <openembedded-core@lists.openembedded.org> Subject: Re: [OE-core] [PATCH] externalsrc.bbclass: Allow externalsrc to be extended with extra classes Hi Peter, require the class on the new one will do the same and we don't need any changes for that but I may not be seeing everything require ${COREBASE}/meta/classes/externalsrc.bbclass Jose Peter Kjellerstedt <peter.kjellerstedt@axis.com<mailto:peter.kjellerstedt@axis.com>> escreveu no dia terça, 19/10/2021 à(s) 18:03: The EXTERNALSRC_EXTENSIONS variable holds a list of additional classes that will be inherited when externalsrc is inherited. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com<mailto:peter.kjellerstedt@axis.com>> --- We have had a local copy of this class for a long time since we need to make it suppport a local class when checking BBCLASSEXTEND. And now we wanted to add some more functionality that should be active when externalsrc is in use. So instead of forking the class even more, I thought it would be better to make the upstream class extendable. The solution was inspired by USERADDEXTENSION in useradd.bbclass. meta/classes/externalsrc.bbclass | 5 +++++ meta/conf/documentation.conf | 1 + 2 files changed, 6 insertions(+) diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass index abfe24bace..488d75760f 100644 --- a/meta/classes/externalsrc.bbclass +++ b/meta/classes/externalsrc.bbclass @@ -265,3 +265,8 @@ def srctree_configure_hash_files(d): return ' '.join(out_items) EXPORT_FUNCTIONS do_buildclean + +# Use the following to extend externalsrc with custom functionality +EXTERNALSRC_EXTENSIONS ??= "" + +inherit ${EXTERNALSRC_EXTENSIONS} diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf index 80ad8e10d5..6d5b734b02 100644 --- a/meta/conf/documentation.conf +++ b/meta/conf/documentation.conf @@ -160,6 +160,7 @@ EXTENDPE[doc] = "Used with file and pathnames to create a prefix for a recipe's EXTENDPKGV[doc] = "The full package version specification as it appears on the final packages produced by a recipe." EXTERNALSRC[doc] = "If externalsrc.bbclass is inherited, this variable points to the source tree, which is outside of the OpenEmbedded build system." EXTERNALSRC_BUILD[doc] = "If externalsrc.bbclass is inherited, this variable points to the directory in which the recipe's source code is built, which is outside of the OpenEmbedded build system." +EXTERNALSRC_EXTENSIONS[doc] = "A list of additional classes that will be inherited when externalsrc is inherited." EXTRA_IMAGE_FEATURES[doc] = "The list of additional features to include in an image. Configure this variable in the conf/local.conf file in the Build Directory." EXTRA_IMAGEDEPENDS[doc] = "A list of recipes to build that do not provide packages for installing into the root filesystem. Use this variable to list recipes that are required to build the final image, but not needed in the root filesystem." EXTRA_OECMAKE[doc] = "Additional cmake options." -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#157190): https://lists.openembedded.org/g/openembedded-core/message/157190 Mute This Topic: https://lists.openembedded.org/mt/86444902/5052612 Group Owner: openembedded-core+owner@lists.openembedded.org<mailto:openembedded-core%2Bowner@lists.openembedded.org> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [quaresma.jose@gmail.com<mailto:quaresma.jose@gmail.com>] -=-=-=-=-=-=-=-=-=-=-=- -- Best regards, José Quaresma [-- Attachment #2: Type: text/html, Size: 8709 bytes --] ^ permalink raw reply related [flat|nested] 10+ messages in thread
[parent not found: <16AF9916496D59D2.6466@lists.openembedded.org>]
* RE: [OE-core] [PATCH] externalsrc.bbclass: Allow externalsrc to be extended with extra classes [not found] ` <16AF9916496D59D2.6466@lists.openembedded.org> @ 2021-10-20 9:09 ` Peter Kjellerstedt 2021-10-20 9:58 ` Richard Purdie 2021-10-20 20:39 ` Douglas Royds 0 siblings, 2 replies; 10+ messages in thread From: Peter Kjellerstedt @ 2021-10-20 9:09 UTC (permalink / raw) To: Jose Quaresma, Richard Purdie (richard.purdie@linuxfoundation.org); +Cc: OE-core [-- Attachment #1: Type: text/plain, Size: 5304 bytes --] I thought of another problem with the wrapper class solution: if we need to actually backport a newer version of the class from, e.g., Poky master, then there is now no natural place for it since it is occupied by the wrapper class. That means we would either have to rename the backported class, or put it somewhere else than in “classes”. It also means backporting a class requires the wrapper class to be modified. Here is a question for Richard: what do you think of an idea I had to add support in bitbake for extending classes? I do not mean to add something like bbclassappend, as I know that is troublesome. My idea instead is something like the prefuncs/postfuncs that we have for functions. I.e., before actually doing the inherit of a class foo, bitbake would inherit anything specified in BBCLASS_PRE_INHERIT:foo, and after inheriting the class it would automatically inherit anything in BBCLASS_POST_INHERIT:foo. That way one can simply extend a class through normal variable operations, making it easy to do, e.g., in the distro configuration. //Peter From: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org> On Behalf Of Peter Kjellerstedt Sent: den 20 oktober 2021 03:32 To: Jose Quaresma <quaresma.jose@gmail.com> Cc: OE-core <openembedded-core@lists.openembedded.org> Subject: Re: [OE-core] [PATCH] externalsrc.bbclass: Allow externalsrc to be extended with extra classes Well, I had not considered that option. I can’t say I am to keen on having wrapper classes with the same name as the upstream classes as I think it leads to confusion. And the solution doesn’t scale very well (what if two layers want to override the same class?). But on the positive side it works for any class without requiring changes to OE-Core. And I guess the latter wins. I wish there was a more bitbakey way to add to classes though (bbclassappend anyone? 😉). //Peter From: Jose Quaresma <quaresma.jose@gmail.com<mailto:quaresma.jose@gmail.com>> Sent: den 19 oktober 2021 19:15 To: Peter Kjellerstedt <peter.kjellerstedt@axis.com<mailto:peter.kjellerstedt@axis.com>> Cc: OE-core <openembedded-core@lists.openembedded.org<mailto:openembedded-core@lists.openembedded.org>> Subject: Re: [OE-core] [PATCH] externalsrc.bbclass: Allow externalsrc to be extended with extra classes Hi Peter, require the class on the new one will do the same and we don't need any changes for that but I may not be seeing everything require ${COREBASE}/meta/classes/externalsrc.bbclass Jose Peter Kjellerstedt <peter.kjellerstedt@axis.com<mailto:peter.kjellerstedt@axis.com>> escreveu no dia terça, 19/10/2021 à(s) 18:03: The EXTERNALSRC_EXTENSIONS variable holds a list of additional classes that will be inherited when externalsrc is inherited. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com<mailto:peter.kjellerstedt@axis.com>> --- We have had a local copy of this class for a long time since we need to make it suppport a local class when checking BBCLASSEXTEND. And now we wanted to add some more functionality that should be active when externalsrc is in use. So instead of forking the class even more, I thought it would be better to make the upstream class extendable. The solution was inspired by USERADDEXTENSION in useradd.bbclass. meta/classes/externalsrc.bbclass | 5 +++++ meta/conf/documentation.conf | 1 + 2 files changed, 6 insertions(+) diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass index abfe24bace..488d75760f 100644 --- a/meta/classes/externalsrc.bbclass +++ b/meta/classes/externalsrc.bbclass @@ -265,3 +265,8 @@ def srctree_configure_hash_files(d): return ' '.join(out_items) EXPORT_FUNCTIONS do_buildclean + +# Use the following to extend externalsrc with custom functionality +EXTERNALSRC_EXTENSIONS ??= "" + +inherit ${EXTERNALSRC_EXTENSIONS} diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf index 80ad8e10d5..6d5b734b02 100644 --- a/meta/conf/documentation.conf +++ b/meta/conf/documentation.conf @@ -160,6 +160,7 @@ EXTENDPE[doc] = "Used with file and pathnames to create a prefix for a recipe's EXTENDPKGV[doc] = "The full package version specification as it appears on the final packages produced by a recipe." EXTERNALSRC[doc] = "If externalsrc.bbclass is inherited, this variable points to the source tree, which is outside of the OpenEmbedded build system." EXTERNALSRC_BUILD[doc] = "If externalsrc.bbclass is inherited, this variable points to the directory in which the recipe's source code is built, which is outside of the OpenEmbedded build system." +EXTERNALSRC_EXTENSIONS[doc] = "A list of additional classes that will be inherited when externalsrc is inherited." EXTRA_IMAGE_FEATURES[doc] = "The list of additional features to include in an image. Configure this variable in the conf/local.conf file in the Build Directory." EXTRA_IMAGEDEPENDS[doc] = "A list of recipes to build that do not provide packages for installing into the root filesystem. Use this variable to list recipes that are required to build the final image, but not needed in the root filesystem." EXTRA_OECMAKE[doc] = "Additional cmake options." -- Best regards, José Quaresma [-- Attachment #2: Type: text/html, Size: 11183 bytes --] ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [OE-core] [PATCH] externalsrc.bbclass: Allow externalsrc to be extended with extra classes 2021-10-20 9:09 ` Peter Kjellerstedt @ 2021-10-20 9:58 ` Richard Purdie 2021-10-20 10:57 ` Peter Kjellerstedt 2021-10-20 20:39 ` Douglas Royds 1 sibling, 1 reply; 10+ messages in thread From: Richard Purdie @ 2021-10-20 9:58 UTC (permalink / raw) To: Peter Kjellerstedt, Jose Quaresma; +Cc: OE-core On Wed, 2021-10-20 at 09:09 +0000, Peter Kjellerstedt wrote: > I thought of another problem with the wrapper class solution: if we need to > actually backport a newer version of the class from, e.g., Poky master, then > there is now no natural place for it since it is occupied by the wrapper > class. That means we would either have to rename the backported class, or put > it somewhere else than in “classes”. It also means backporting a class > requires the wrapper class to be modified. > > Here is a question for Richard: what do you think of an idea I had to add > support in bitbake for extending classes? I do not mean to add something like > bbclassappend, as I know that is troublesome. My idea instead is something > like the prefuncs/postfuncs that we have for functions. I.e., before actually > doing the inherit of a classfoo, bitbake would inherit anything specified > inBBCLASS_PRE_INHERIT:foo, and after inheriting the class it would > automatically inherit anything in BBCLASS_POST_INHERIT:foo. That way one can > simply extend a class through normal variable operations, making it easy to > do, e.g., in the distro configuration. That sounds very like a bbclassappend under a different name? Cheers, Richard ^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [OE-core] [PATCH] externalsrc.bbclass: Allow externalsrc to be extended with extra classes 2021-10-20 9:58 ` Richard Purdie @ 2021-10-20 10:57 ` Peter Kjellerstedt 2021-10-20 11:21 ` Richard Purdie 0 siblings, 1 reply; 10+ messages in thread From: Peter Kjellerstedt @ 2021-10-20 10:57 UTC (permalink / raw) To: Richard Purdie, Jose Quaresma; +Cc: OE-core > -----Original Message----- > From: Richard Purdie <richard.purdie@linuxfoundation.org> > Sent: den 20 oktober 2021 11:59 > To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>; Jose Quaresma > <quaresma.jose@gmail.com> > Cc: OE-core <openembedded-core@lists.openembedded.org> > Subject: Re: [OE-core] [PATCH] externalsrc.bbclass: Allow externalsrc to > be extended with extra classes > > On Wed, 2021-10-20 at 09:09 +0000, Peter Kjellerstedt wrote: > > I thought of another problem with the wrapper class solution: if we > > needto actually backport a newer version of the class from, e.g., > > Poky master, then there is now no natural place for it since it is > > occupied by the wrapper class. That means we would either have to > > rename the backported class, or put it somewhere else than in > > "classes". It also means backporting a class requires the wrapper > > class to be modified. > > > > Here is a question for Richard: what do you think of an idea I had to > > add support in bitbake for extending classes? I do not mean to add > > something like bbclassappend, as I know that is troublesome. My idea > > instead is something like the prefuncs/postfuncs that we have for > > functions. I.e., before actually doing the inherit of a classfoo, > > bitbake would inherit anything specified in BBCLASS_PRE_INHERIT:foo, > > and after inheriting the class it would automatically inherit > > anything in BBCLASS_POST_INHERIT:foo. That way one can simply extend > > a class through normal variable operations, making it easy to do, > > e.g., in the distro configuration. > > That sounds very like a bbclassappend under a different name? > > Cheers, > > Richard Well, I guess it is similar to what a bbclassappend file suffix would entail, but more flexible and controlled. Do you think something like this would work, or have I missed some technical problems that would prevent it? And if you think it is technically possible, would you be willing to accept a patch that implements it? //Peter ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [OE-core] [PATCH] externalsrc.bbclass: Allow externalsrc to be extended with extra classes 2021-10-20 10:57 ` Peter Kjellerstedt @ 2021-10-20 11:21 ` Richard Purdie 2021-10-20 12:42 ` Peter Kjellerstedt 0 siblings, 1 reply; 10+ messages in thread From: Richard Purdie @ 2021-10-20 11:21 UTC (permalink / raw) To: Peter Kjellerstedt, Jose Quaresma; +Cc: OE-core On Wed, 2021-10-20 at 10:57 +0000, Peter Kjellerstedt wrote: > > -----Original Message----- > > From: Richard Purdie <richard.purdie@linuxfoundation.org> > > Sent: den 20 oktober 2021 11:59 > > To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>; Jose Quaresma > > <quaresma.jose@gmail.com> > > Cc: OE-core <openembedded-core@lists.openembedded.org> > > Subject: Re: [OE-core] [PATCH] externalsrc.bbclass: Allow externalsrc to > > be extended with extra classes > > > > On Wed, 2021-10-20 at 09:09 +0000, Peter Kjellerstedt wrote: > > > I thought of another problem with the wrapper class solution: if we > > > needto actually backport a newer version of the class from, e.g., > > > Poky master, then there is now no natural place for it since it is > > > occupied by the wrapper class. That means we would either have to > > > rename the backported class, or put it somewhere else than in > > > "classes". It also means backporting a class requires the wrapper > > > class to be modified. > > > > > > Here is a question for Richard: what do you think of an idea I had to > > > add support in bitbake for extending classes? I do not mean to add > > > something like bbclassappend, as I know that is troublesome. My idea > > > instead is something like the prefuncs/postfuncs that we have for > > > functions. I.e., before actually doing the inherit of a classfoo, > > > bitbake would inherit anything specified in BBCLASS_PRE_INHERIT:foo, > > > and after inheriting the class it would automatically inherit > > > anything in BBCLASS_POST_INHERIT:foo. That way one can simply extend > > > a class through normal variable operations, making it easy to do, > > > e.g., in the distro configuration. > > > > That sounds very like a bbclassappend under a different name? > > > > Cheers, > > > > Richard > > Well, I guess it is similar to what a bbclassappend file suffix would Do we > want to allow users to do whatever > entail, but more flexible and controlled. Do you think something like > this would work, or have I missed some technical problems that would > prevent it? And if you think it is technically possible, would you be > willing to accept a patch that implements it? How is it more flexible and controlled? We'd swap a concept most users understand (bbappend) for one that is less obvious and more complex. The issue with bbclassappend was never a technical one, it is a question of policy. We already allow users to do pretty much anything to the system but the question is how easy we make certain things. We've tended to believe that encouraging class changes back to their parent classes was a good thing overall. You are basically saying we no longer want to do that and stop encouraging people to do it. I'm not sure that is true, quite the opposite. We actively chose not to implement bbclassappend and I'm not sure the underlying reasons for doing that have changed. Cheers, Richard ^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [OE-core] [PATCH] externalsrc.bbclass: Allow externalsrc to be extended with extra classes 2021-10-20 11:21 ` Richard Purdie @ 2021-10-20 12:42 ` Peter Kjellerstedt 2021-10-20 12:58 ` Alexander Kanavin 0 siblings, 1 reply; 10+ messages in thread From: Peter Kjellerstedt @ 2021-10-20 12:42 UTC (permalink / raw) To: Richard Purdie, Jose Quaresma; +Cc: OE-core > -----Original Message----- > From: openembedded-core@lists.openembedded.org <openembedded- > core@lists.openembedded.org> On Behalf Of Richard Purdie > Sent: den 20 oktober 2021 13:22 > To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>; Jose Quaresma > <quaresma.jose@gmail.com> > Cc: OE-core <openembedded-core@lists.openembedded.org> > Subject: Re: [OE-core] [PATCH] externalsrc.bbclass: Allow externalsrc to > be extended with extra classes > > On Wed, 2021-10-20 at 10:57 +0000, Peter Kjellerstedt wrote: > > > -----Original Message----- > > > From: Richard Purdie <richard.purdie@linuxfoundation.org> > > > Sent: den 20 oktober 2021 11:59 > > > To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>; Jose Quaresma > > > <quaresma.jose@gmail.com> > > > Cc: OE-core <openembedded-core@lists.openembedded.org> > > > Subject: Re: [OE-core] [PATCH] externalsrc.bbclass: Allow externalsrc > to > > > be extended with extra classes > > > > > > On Wed, 2021-10-20 at 09:09 +0000, Peter Kjellerstedt wrote: > > > > I thought of another problem with the wrapper class solution: if we > > > > needto actually backport a newer version of the class from, e.g., > > > > Poky master, then there is now no natural place for it since it is > > > > occupied by the wrapper class. That means we would either have to > > > > rename the backported class, or put it somewhere else than in > > > > "classes". It also means backporting a class requires the wrapper > > > > class to be modified. > > > > > > > > Here is a question for Richard: what do you think of an idea I had > to > > > > add support in bitbake for extending classes? I do not mean to add > > > > something like bbclassappend, as I know that is troublesome. My idea > > > > instead is something like the prefuncs/postfuncs that we have for > > > > functions. I.e., before actually doing the inherit of a classfoo, > > > > bitbake would inherit anything specified in BBCLASS_PRE_INHERIT:foo, > > > > and after inheriting the class it would automatically inherit > > > > anything in BBCLASS_POST_INHERIT:foo. That way one can simply > extend > > > > a class through normal variable operations, making it easy to do, > > > > e.g., in the distro configuration. > > > > > > That sounds very like a bbclassappend under a different name? > > > > > > Cheers, > > > > > > Richard > > > > Well, I guess it is similar to what a bbclassappend file suffix would Do > we > > want to allow users to do whatever > > entail, but more flexible and controlled. Do you think something like > > this would work, or have I missed some technical problems that would > > prevent it? And if you think it is technically possible, would you be > > willing to accept a patch that implements it? > > How is it more flexible and controlled? We'd swap a concept most users > understand (bbappend) for one that is less obvious and more complex. More flexible in that it allows prepending changes as well as appending them. More controlled in that it is not automatically applied the way bbappends are just by including a layer (which I believe is good from a Yocto Compatible standpoint). You actually need to set the variables, which, e.g., can be done differently in different distro files. > The issue with bbclassappend was never a technical one, it is a question > of policy. We already allow users to do pretty much anything to the system > but the question is how easy we make certain things. We've tended to believe > that encouraging class changes back to their parent classes was a good thing > overall. And I absolutely agree that changes that are relevant for upstream should be upstreamed. But just like bbappends, not all changes are relevant for upstream. In our case we have this unittest class that is an extension of native and it is typically used by adding to BBCLASSEXTEND. It is used to run our unit tests as native, which makes them extremely quick to run. However, this is IMHO a horrible hack that I wish we had never invented, but it is what we have and I do not see an easy way out of it. So obviously I do not want to upstream this, but at the same time we need to make some adoptions to upstream classes to handle unittest where there are hardcoded tests for native, like in the externalsrc class. > You are basically saying we no longer want to do that and stop encouraging > people to do it. I'm not sure that is true, quite the opposite. > > We actively chose not to implement bbclassappend and I'm not sure the > underlying reasons for doing that have changed. I definitely do not want to change the policy that changes that can be upstreamed should be upstreamed. However, I do see a need for supporting changes that cannot be upstreamed. And sure, there are always workarounds; we can manage with an externalsrc wrapper class, so it is not like we cannot proceed, but it would have been nicer to use an officially supported method for extending classes rather than hacking around it. So, I will not push for this change. I think it would have been nice with an official way to extend classes and I am willing to implement it, but if you think it is too much of an issue and stops encouraging people to upstream their changes, then we will make do with the workarounds. It is not like we have to backport that many classes, so it is definitely manageable, albeit a bit inconvenient. > Cheers, > > Richard //Peter ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [OE-core] [PATCH] externalsrc.bbclass: Allow externalsrc to be extended with extra classes 2021-10-20 12:42 ` Peter Kjellerstedt @ 2021-10-20 12:58 ` Alexander Kanavin 0 siblings, 0 replies; 10+ messages in thread From: Alexander Kanavin @ 2021-10-20 12:58 UTC (permalink / raw) To: Peter Kjellerstedt; +Cc: Richard Purdie, Jose Quaresma, OE-core [-- Attachment #1: Type: text/plain, Size: 829 bytes --] On Wed, 20 Oct 2021 at 14:42, Peter Kjellerstedt < peter.kjellerstedt@axis.com> wrote: > So, I will not push for this change. I think it would have been nice with > an official way to extend classes and I am willing to implement it, but if > you think it is too much of an issue and stops encouraging people to > upstream their changes, then we will make do with the workarounds. It is > not like we have to backport that many classes, so it is definitely > manageable, albeit a bit inconvenient. > I would not want a mechanism for extending classes for a different reason: it makes it a lot harder to understand and reason about the build. bbappends are already bad enough, but at least they're influencing only specific recipes unconditionally; conditional class appends would just end up producing horrible spaghetti. Alex [-- Attachment #2: Type: text/html, Size: 1303 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [OE-core] [PATCH] externalsrc.bbclass: Allow externalsrc to be extended with extra classes 2021-10-20 9:09 ` Peter Kjellerstedt 2021-10-20 9:58 ` Richard Purdie @ 2021-10-20 20:39 ` Douglas Royds 1 sibling, 0 replies; 10+ messages in thread From: Douglas Royds @ 2021-10-20 20:39 UTC (permalink / raw) To: Peter Kjellerstedt, Jose Quaresma, Richard Purdie (richard.purdie@linuxfoundation.org) Cc: OE-core [-- Attachment #1: Type: text/plain, Size: 6567 bytes --] We do "wrap" classes in our own proprietary layer. In a layer called meta-abc, we name the wrapper-class classname-abc.bbclass. For instance, we wrap cmake.bbclass as follows: # cmake-abc.bbclass inherit cmake # Additions to cmake behaviour go here ... Our meta-abc recipes inherit cmake-abc. In this way, the wrapper-class behaves very much like a bbappend. On 20/10/21 10:09 pm, Peter Kjellerstedt wrote: > > I thought of another problem with the wrapper class solution: if we > need to actually backport a newer version of the class from, e.g., > Poky master, then there is now no natural place for it since it is > occupied by the wrapper class. That means we would either have to > rename the backported class, or put it somewhere else than in > “classes”. It also means backporting a class requires the wrapper > class to be modified. > > Here is a question for Richard: what do you think of an idea I had to > add support in bitbake for extending classes? I do not mean to add > something like bbclassappend, as I know that is troublesome. My idea > instead is something like the prefuncs/postfuncs that we have for > functions. I.e., before actually doing the inherit of a class foo, > bitbake would inherit anything specified in BBCLASS_PRE_INHERIT:foo, > and after inheriting the class it would automatically inherit anything > in BBCLASS_POST_INHERIT:foo. That way one can simply extend a class > through normal variable operations, making it easy to do, e.g., in the > distro configuration. > > //Peter > > *From:*openembedded-core@lists.openembedded.org > <openembedded-core@lists.openembedded.org> *On Behalf Of *Peter > Kjellerstedt > *Sent:* den 20 oktober 2021 03:32 > *To:* Jose Quaresma <quaresma.jose@gmail.com> > *Cc:* OE-core <openembedded-core@lists.openembedded.org> > *Subject:* Re: [OE-core] [PATCH] externalsrc.bbclass: Allow > externalsrc to be extended with extra classes > > Well, I had not considered that option. I can’t say I am to keen on > having wrapper classes with the same name as the upstream classes as I > think it leads to confusion. And the solution doesn’t scale very well > (what if two layers want to override the same class?). But on the > positive side it works for any class without requiring changes to > OE-Core. And I guess the latter wins. I wish there was a more bitbakey > way to add to classes though (bbclassappend anyone? 😉). > > //Peter > > *From:*Jose Quaresma <quaresma.jose@gmail.com> > *Sent:* den 19 oktober 2021 19:15 > *To:* Peter Kjellerstedt <peter.kjellerstedt@axis.com> > *Cc:* OE-core <openembedded-core@lists.openembedded.org> > *Subject:* Re: [OE-core] [PATCH] externalsrc.bbclass: Allow > externalsrc to be extended with extra classes > > Hi Peter, > > require the class on the new one will do the same > > and we don't need any changes for that > > but I may not be seeing everything > > require ${COREBASE}/meta/classes/externalsrc.bbclass > > Jose > > Peter Kjellerstedt <peter.kjellerstedt@axis.com> escreveu no dia > terça, 19/10/2021 à(s) 18:03: > > The EXTERNALSRC_EXTENSIONS variable holds a list of additional classes > that will be inherited when externalsrc is inherited. > > Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> > --- > > We have had a local copy of this class for a long time since we need > to make it suppport a local class when checking BBCLASSEXTEND. And > now we wanted to add some more functionality that should be active > when externalsrc is in use. So instead of forking the class even > more, I thought it would be better to make the upstream class > extendable. The solution was inspired by USERADDEXTENSION in > useradd.bbclass. > > meta/classes/externalsrc.bbclass | 5 +++++ > meta/conf/documentation.conf | 1 + > 2 files changed, 6 insertions(+) > > diff --git a/meta/classes/externalsrc.bbclass > b/meta/classes/externalsrc.bbclass > index abfe24bace..488d75760f 100644 > --- a/meta/classes/externalsrc.bbclass > +++ b/meta/classes/externalsrc.bbclass > @@ -265,3 +265,8 @@ def srctree_configure_hash_files(d): > return ' '.join(out_items) > > EXPORT_FUNCTIONS do_buildclean > + > +# Use the following to extend externalsrc with custom functionality > +EXTERNALSRC_EXTENSIONS ??= "" > + > +inherit ${EXTERNALSRC_EXTENSIONS} > diff --git a/meta/conf/documentation.conf > b/meta/conf/documentation.conf > index 80ad8e10d5..6d5b734b02 100644 > --- a/meta/conf/documentation.conf > +++ b/meta/conf/documentation.conf > @@ -160,6 +160,7 @@ EXTENDPE[doc] = "Used with file and pathnames > to create a prefix for a recipe's > EXTENDPKGV[doc] = "The full package version specification as it > appears on the final packages produced by a recipe." > EXTERNALSRC[doc] = "If externalsrc.bbclass is inherited, this > variable points to the source tree, which is outside of the > OpenEmbedded build system." > EXTERNALSRC_BUILD[doc] = "If externalsrc.bbclass is inherited, > this variable points to the directory in which the recipe's source > code is built, which is outside of the OpenEmbedded build system." > +EXTERNALSRC_EXTENSIONS[doc] = "A list of additional classes that > will be inherited when externalsrc is inherited." > EXTRA_IMAGE_FEATURES[doc] = "The list of additional features to > include in an image. Configure this variable in the > conf/local.conf file in the Build Directory." > EXTRA_IMAGEDEPENDS[doc] = "A list of recipes to build that do not > provide packages for installing into the root filesystem. Use this > variable to list recipes that are required to build the final > image, but not needed in the root filesystem." > EXTRA_OECMAKE[doc] = "Additional cmake options." > > > -- > > Best regards, > > > José Quaresma > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#157255):https://lists.openembedded.org/g/openembedded-core/message/157255 > Mute This Topic:https://lists.openembedded.org/mt/86444902/4454501 > Group Owner:openembedded-core+owner@lists.openembedded.org > Unsubscribe:https://lists.openembedded.org/g/openembedded-core/unsub [douglas.royds@taitradio.com] > -=-=-=-=-=-=-=-=-=-=-=- > [-- Attachment #2: Type: text/html, Size: 17295 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2021-10-20 20:44 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-19 17:03 [PATCH] externalsrc.bbclass: Allow externalsrc to be extended with extra classes Peter Kjellerstedt
2021-10-19 17:15 ` [OE-core] " Jose Quaresma
2021-10-20 1:31 ` Peter Kjellerstedt
[not found] ` <16AF9916496D59D2.6466@lists.openembedded.org>
2021-10-20 9:09 ` Peter Kjellerstedt
2021-10-20 9:58 ` Richard Purdie
2021-10-20 10:57 ` Peter Kjellerstedt
2021-10-20 11:21 ` Richard Purdie
2021-10-20 12:42 ` Peter Kjellerstedt
2021-10-20 12:58 ` Alexander Kanavin
2021-10-20 20:39 ` Douglas Royds
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.