diff mbox series

data/data_smart/build: Clean up datastore finalize/update_data references

Message ID 20221111142618.2309492-1-richard.purdie@linuxfoundation.org
State Accepted, archived
Commit 584989ed2b5af4e8799571dece0cf94f995ef14e
Headers show
Series data/data_smart/build: Clean up datastore finalize/update_data references | expand

Commit Message

Richard Purdie Nov. 11, 2022, 2:26 p.m. UTC
We dropped the update_data calls a while ago. Clean up the code
to match the reality and drop the remaining no-op pieces. Update
the comments to reflect the slowest operations and let the cookie
monster's spirit live on!

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/bb/build.py      |  1 -
 lib/bb/data.py       | 12 +++++-------
 lib/bb/data_smart.py |  9 +--------
 3 files changed, 6 insertions(+), 16 deletions(-)

Comments

Christopher Larson Nov. 11, 2022, 2:55 p.m. UTC | #1
Huzzah!

Acked-by: Christopher Larson <chris_larson@mentor.com>

On Fri, Nov 11, 2022 at 7:26 AM Richard Purdie <
richard.purdie@linuxfoundation.org> wrote:

> We dropped the update_data calls a while ago. Clean up the code
> to match the reality and drop the remaining no-op pieces. Update
> the comments to reflect the slowest operations and let the cookie
> monster's spirit live on!
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
>  lib/bb/build.py      |  1 -
>  lib/bb/data.py       | 12 +++++-------
>  lib/bb/data_smart.py |  9 +--------
>  3 files changed, 6 insertions(+), 16 deletions(-)
>
> diff --git a/lib/bb/build.py b/lib/bb/build.py
> index b8c1099ef5..db706d0a3a 100644
> --- a/lib/bb/build.py
> +++ b/lib/bb/build.py
> @@ -572,7 +572,6 @@ def _task_data(fn, task, d):
>      localdata.setVar('BB_FILENAME', fn)
>      localdata.setVar('OVERRIDES', 'task-%s:%s' %
>                       (task[3:].replace('_', '-'), d.getVar('OVERRIDES',
> False)))
> -    localdata.finalize()
>      bb.data.expandKeys(localdata)
>      return localdata
>
> diff --git a/lib/bb/data.py b/lib/bb/data.py
> index 4be26367d2..3a6af325f4 100644
> --- a/lib/bb/data.py
> +++ b/lib/bb/data.py
> @@ -4,14 +4,16 @@ BitBake 'Data' implementations
>  Functions for interacting with the data structure used by the
>  BitBake build tools.
>
> -The expandKeys and update_data are the most expensive
> -operations. At night the cookie monster came by and
> +expandKeys and datastore iteration are the most expensive
> +operations. Updating overrides is now "on the fly" but still based
> +on the idea of the cookie monster introduced by zecke:
> +"At night the cookie monster came by and
>  suggested 'give me cookies on setting the variables and
>  things will work out'. Taking this suggestion into account
>  applying the skills from the not yet passed 'Entwurf und
>  Analyse von Algorithmen' lecture and the cookie
>  monster seems to be right. We will track setVar more carefully
> -to have faster update_data and expandKeys operations.
> +to have faster datastore operations."
>
>  This is a trade-off between speed and memory again but
>  the speed is more critical here.
> @@ -264,10 +266,6 @@ def emit_func_python(func, o=sys.__stdout__, d =
> init()):
>                 newdeps |= set((d.getVarFlag(dep, "vardeps") or
> "").split())
>          newdeps -= seen
>
> -def update_data(d):
> -    """Performs final steps upon the datastore, including application of
> overrides"""
> -    d.finalize(parent = True)
> -
>  def build_dependencies(key, keys, shelldeps, varflagsexcl, ignored_vars,
> d):
>      deps = set()
>      try:
> diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py
> index 62d0c01c41..5415f2fccf 100644
> --- a/lib/bb/data_smart.py
> +++ b/lib/bb/data_smart.py
> @@ -481,13 +481,6 @@ class DataSmart(MutableMapping):
>      def expand(self, s, varname = None):
>          return self.expandWithRefs(s, varname).value
>
> -    def finalize(self, parent = False):
> -        return
> -
> -    def internal_finalize(self, parent = False):
> -        """Performs final steps upon the datastore, including application
> of overrides"""
> -        self.overrides = None
> -
>      def need_overrides(self):
>          if self.overrides is not None:
>              return
> @@ -638,7 +631,7 @@ class DataSmart(MutableMapping):
>                  nextnew.update(vardata.references)
>                  nextnew.update(vardata.contains.keys())
>              new = nextnew
> -        self.internal_finalize(True)
> +        self.overrides = None
>
>      def _setvar_update_overrides(self, var, **loginfo):
>          # aka pay the cookie monster
> --
> 2.34.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#14070):
> https://lists.openembedded.org/g/bitbake-devel/message/14070
> Mute This Topic: https://lists.openembedded.org/mt/94959431/3617123
> Group Owner: bitbake-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [
> kergoth@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
diff mbox series

Patch

diff --git a/lib/bb/build.py b/lib/bb/build.py
index b8c1099ef5..db706d0a3a 100644
--- a/lib/bb/build.py
+++ b/lib/bb/build.py
@@ -572,7 +572,6 @@  def _task_data(fn, task, d):
     localdata.setVar('BB_FILENAME', fn)
     localdata.setVar('OVERRIDES', 'task-%s:%s' %
                      (task[3:].replace('_', '-'), d.getVar('OVERRIDES', False)))
-    localdata.finalize()
     bb.data.expandKeys(localdata)
     return localdata
 
diff --git a/lib/bb/data.py b/lib/bb/data.py
index 4be26367d2..3a6af325f4 100644
--- a/lib/bb/data.py
+++ b/lib/bb/data.py
@@ -4,14 +4,16 @@  BitBake 'Data' implementations
 Functions for interacting with the data structure used by the
 BitBake build tools.
 
-The expandKeys and update_data are the most expensive
-operations. At night the cookie monster came by and
+expandKeys and datastore iteration are the most expensive
+operations. Updating overrides is now "on the fly" but still based
+on the idea of the cookie monster introduced by zecke:
+"At night the cookie monster came by and
 suggested 'give me cookies on setting the variables and
 things will work out'. Taking this suggestion into account
 applying the skills from the not yet passed 'Entwurf und
 Analyse von Algorithmen' lecture and the cookie
 monster seems to be right. We will track setVar more carefully
-to have faster update_data and expandKeys operations.
+to have faster datastore operations."
 
 This is a trade-off between speed and memory again but
 the speed is more critical here.
@@ -264,10 +266,6 @@  def emit_func_python(func, o=sys.__stdout__, d = init()):
                newdeps |= set((d.getVarFlag(dep, "vardeps") or "").split())
         newdeps -= seen
 
-def update_data(d):
-    """Performs final steps upon the datastore, including application of overrides"""
-    d.finalize(parent = True)
-
 def build_dependencies(key, keys, shelldeps, varflagsexcl, ignored_vars, d):
     deps = set()
     try:
diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py
index 62d0c01c41..5415f2fccf 100644
--- a/lib/bb/data_smart.py
+++ b/lib/bb/data_smart.py
@@ -481,13 +481,6 @@  class DataSmart(MutableMapping):
     def expand(self, s, varname = None):
         return self.expandWithRefs(s, varname).value
 
-    def finalize(self, parent = False):
-        return
-
-    def internal_finalize(self, parent = False):
-        """Performs final steps upon the datastore, including application of overrides"""
-        self.overrides = None
-
     def need_overrides(self):
         if self.overrides is not None:
             return
@@ -638,7 +631,7 @@  class DataSmart(MutableMapping):
                 nextnew.update(vardata.references)
                 nextnew.update(vardata.contains.keys())
             new = nextnew
-        self.internal_finalize(True)
+        self.overrides = None
 
     def _setvar_update_overrides(self, var, **loginfo):
         # aka pay the cookie monster