[21/22] package.bbclass: Pre-expand some variables to save time

Submitted by Richard Purdie on Feb. 3, 2013, 11:55 p.m.

Details

Message ID e8a6486cef549bb28ccdab376f73699e1597795c.1359935562.git.richard.purdie@linuxfoundation.org
State Accepted
Commit 5b7c822609a42e58e96a004071978c9ff196e955
Headers show

Commit Message

Richard Purdie Feb. 3, 2013, 11:55 p.m.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/classes/package.bbclass |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

Patch hide | download patch | download mbox

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 2c3f173..2bae65b 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -1798,6 +1798,20 @@  python do_package () {
         return
 
     ###########################################################################
+    # Optimisations
+    ###########################################################################
+
+    # Contunually rexpanding complex expressions is inefficient, particularly when
+    # we write to the datastore and invalidate the expansion cache. This code 
+    # pre-expands some frequently used variables
+
+    def expandVar(x, d):
+        d.setVar(x, d.getVar(x, True))
+
+    for x in 'PN', 'PV', 'BPN', 'TARGET_SYS', 'EXTENDPRAUTO':
+        expandVar(x, d)
+
+    ###########################################################################
     # Setup PKGD (from D)
     ###########################################################################