Skip to contentSkip to conversation

BBFILES_DYNAMIC: add inverse mode

PATCH Konrad Weihmann 2 participants 2 messages Jun 13, 2020 – Jun 18, 2020 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Friendly reminder.
If the patch isn't applicable for some reason: I'd like to ask how I could 'emulate' the patch.

If I read the code correctly it isn't possible to do the same as part of the layer.conf, as the list is filled one layer.conf after another and so the existence of a layer name in BBFILE_COLLECTIONS is dependent on the order in BBLAYERS - which makes it prone to errors.

I currently have some recipes which are provided by some optional layer, but as they tend to provide/override more than needed (in this case just a single recipe) it would be nice to have that backfill possibility. So it's up to the user to choose if the full layer meets his needs or the backfill recipe is just enough.

Looking forward to some feedback.
Regards
Konrad

Quoted 30 lines · Konrad Weihmann

Add an inverse mode for BBFILES_DYNAMIC.
Entries where the layername is prefix with '!' will act in inverted mode including given glob mask in absence of the referenced layer. This is useful to backfill recipes from potentially missing layer.

---
  lib/bb/cookerdata.py | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
lib/bb/cookerdata.py +4 -1
index 472423fd..bf72a8b3 100644
@@ -387,7 +387,10 @@ class CookerDataBuilder(object):
                      invalid.append(entry)
                      continue
                  l, f = parts
-                if l in collections:
+                invert = l[0] == "!"
+                if invert:
+                    l = l[1:]
+                if (l in collections and not invert) or (l not in collections and invert):
                      data.appendVar("BBFILES", " " + f)
              if invalid:
                  bb.fatal("BBFILES_DYNAMIC entries must be of the form <collection name>:<filename pattern>, not:\n    %s" % "\n    ".join(invalid))
#2 lore raw
Quoted 21 lines · Konrad Weihmann

Friendly reminder.
If the patch isn't applicable for some reason: I'd like to ask how I could 'emulate' the patch.

If I read the code correctly it isn't possible to do the same as part of
the layer.conf, as the list is filled one layer.conf after another and
so the existence of a layer name in BBFILE_COLLECTIONS is dependent on
the order in BBLAYERS - which makes it prone to errors.

I currently have some recipes which are provided by some optional layer,
but as they tend to provide/override more than needed (in this case just
a single recipe) it would be nice to have that backfill possibility. So it's up to the user to choose if the full layer meets his needs or
the backfill recipe is just enough.

Quoted 1 line

Looking forward to some feedback.

I wanted to give that patch some thought but it does make sense. Could you please update the patch or send a followup which updates the manual with the new syntax though please?

Cheers,

Richard