From: Alexander Kanavin <[email protected]>

Please see the comment in the class for the rationale.

Signed-off-by: Alexander Kanavin <[email protected]>
---
 .../recipe-upgrade-additional-rename.bbclass  | 22 +++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 meta/classes-recipe/recipe-upgrade-additional-rename.bbclass

diff --git a/meta/classes-recipe/recipe-upgrade-additional-rename.bbclass 
b/meta/classes-recipe/recipe-upgrade-additional-rename.bbclass
new file mode 100644
index 00000000000..b173b3d3571
--- /dev/null
+++ b/meta/classes-recipe/recipe-upgrade-additional-rename.bbclass
@@ -0,0 +1,22 @@
+# This class can be used to add file renames in devtool version upgrades
+# operations when there are supplemental recipes that need to be updated
+# in lockstep with the main one by renaming the files. This is common,
+# e.g. glib, cmake, mesa, libva, etc have this issue.
+#
+# Example (from glib which has glib-initial to handle):
+#
+# inherit recipe-upgrade-additional-rename
+# RECIPE_UPGRADE_ADDITIONAL_RENAME = "glib-2.0-initial_{pv}.bb"
+#
+RECIPE_UPGRADE_FINISH_EXTRA_TASKS += "do_recipe_upgrade_additional_rename"
+addtask do_recipe_upgrade_additional_rename
+
+python do_recipe_upgrade_additional_rename() {
+    import glob
+    origpath = d.getVar("THISDIR")
+    newpv = d.getVar("PV")
+
+    for f_pattern in d.getVar("RECIPE_UPGRADE_ADDITIONAL_RENAME").split():
+        for f_disk in glob.glob(os.path.join(origpath, 
f_pattern.format(pv="*"))):
+            os.rename(f_disk, os.path.join(origpath, 
f_pattern.format(pv=newpv)))
+}
-- 
2.39.2

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#201008): 
https://lists.openembedded.org/g/openembedded-core/message/201008
Mute This Topic: https://lists.openembedded.org/mt/106796298/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to