]> code.ossystems Code Review - openembedded-core.git/commitdiff
devtool: upgrade: handle upgrading recipes with a versioned inc file
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Tue, 24 May 2016 04:18:50 +0000 (16:18 +1200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 25 May 2016 06:49:52 +0000 (07:49 +0100)
The gdb recipe in OE-Core has an inc file with the version in it;
since the inc file is pulled in with a "require ${PV}.inc", when
upgrading the recipe we need to also rename the inc file it will fail to
parse and the upgrade itself will fail.

Fixes [YOCTO #9574].

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/lib/devtool/upgrade.py

index a085f78c439022f147cd9b433439bd0dbdd2a80b..e34234a34f7e695447c973a5b676198805b9af25 100644 (file)
@@ -77,11 +77,19 @@ def _recipe_contains(rd, var):
 
 def _rename_recipe_dirs(oldpv, newpv, path):
     for root, dirs, files in os.walk(path):
+        # Rename directories with the version in their name
         for olddir in dirs:
             if olddir.find(oldpv) != -1:
                 newdir = olddir.replace(oldpv, newpv)
                 if olddir != newdir:
                     shutil.move(os.path.join(path, olddir), os.path.join(path, newdir))
+        # Rename any inc files with the version in their name (unusual, but possible)
+        for oldfile in files:
+            if oldfile.endswith('.inc'):
+                if oldfile.find(oldpv) != -1:
+                    newfile = oldfile.replace(oldpv, newpv)
+                    if oldfile != newfile:
+                        os.rename(os.path.join(path, oldfile), os.path.join(path, newfile))
 
 def _rename_recipe_file(oldrecipe, bpn, oldpv, newpv, path):
     oldrecipe = os.path.basename(oldrecipe)