]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
package.bbclass: check packages name conflict in do_package
authorFawzi KHABER <fawzi.khaber@smile.fr>
Wed, 29 Mar 2023 08:57:56 +0000 (10:57 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 30 Mar 2023 11:32:22 +0000 (12:32 +0100)
It is possible to rename packages with the macro PKG:${PN} and result in
a package name conflict if the target name exists already.

Add a fatal check to prevent this issue to go unnoticed.

Fix [Yocto #12060]

Reviewed-by: Yoann CONGAL <yoann.congal@smile.fr>
Signed-off-by: Fawzi KHABER <fawzi.khaber@smile.fr>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes-global/package.bbclass

index 8f01bc432385e34bd1e19fa6bff6508117260ce5..e8055a9cdc5fc2dc1261c1ca845474ef16e53646 100644 (file)
@@ -496,6 +496,15 @@ python do_package () {
 
     bb.build.exec_func("package_convert_pr_autoinc", d)
 
+    # Check for conflict between renamed packages and existing ones
+    # for each package in PACKAGES, check if it will be renamed to an existing one
+    for p in packages:
+        localdata = bb.data.createCopy(d)
+        localdata.setVar('OVERRIDES', p)
+        rename = localdata.getVar('PKG')
+        if (rename != None) and rename in packages:
+            bb.fatal('package "%s" is renamed to "%s" using PKG:%s, but package name already exists'%(p,rename,p))
+
     ###########################################################################
     # Optimisations
     ###########################################################################