Patchwork [08/17] package.bbclass: Check FILES once, not once per loop iteration

login
register
mail settings
Submitter Richard Purdie
Date Jan. 30, 2013, 2:01 p.m.
Message ID <7e0e3ec1d580926bac6d4ed70deb31325316067a.1359554291.git.richard.purdie@linuxfoundation.org>
Download mbox | patch
Permalink /patch/43701/
State Accepted
Commit 40542f7a46bfb8431e31eca9af06adb4b343d810
Headers show

Comments

Richard Purdie - Jan. 30, 2013, 2:01 p.m.
There is no need to check FILES in each loop iteration, we can just check it once
at the start when we read the variable.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/classes/package.bbclass |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Patch

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 8b256cf..51ab009 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -961,12 +961,12 @@  python populate_packages () {
         bb.data.update_data(localdata)
 
         filesvar = localdata.getVar('FILES', True) or ""
+        if "//" in filesvar:
+            bb.warn("FILES variable for package %s contains '//' which is invalid. Attempting to fix this but you should correct the metadata.\n" % pkg)
+            filesvar.replace("//", "/")
         files = filesvar.split()
         file_links = {}
         for file in files:
-            if file.find("//") != -1:
-                bb.warn("FILES variable for package %s contains '//' which is invalid. Attempting to fix this but you should correct the metadata.\n" % pkg)
-                file.replace("//", "/")
             if os.path.isabs(file):
                 file = '.' + file
             if not os.path.islink(file):