All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
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
Date: Wed, 20 Oct 2021 01:31:40 +0000	[thread overview]
Message-ID: <8adcd454ae1742dab4c9ef0edd98fc1c@axis.com> (raw)
In-Reply-To: <CANPvuR=noMymOncORwNan6-D-DCkSKQDXYjjWR+8yhqx3JxY=Q@mail.gmail.com>

[-- 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 --]

  reply	other threads:[~2021-10-20  1:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
     [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

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=8adcd454ae1742dab4c9ef0edd98fc1c@axis.com \
    --to=peter.kjellerstedt@axis.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=quaresma.jose@gmail.com \
    /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.