new file mode 100644
@@ -0,0 +1,8 @@
+SUMMARY = "Test case that tries to rename a package to an existing one and fails"
+DESCRIPTION = "This generates a packaging error when a package is renamed to a pre-existing name"
+LICENSE = "MIT"
+
+# Add a new package ${PN}-renametest
+PACKAGES += "${PN}-renametest"
+# ... and try to rename the ${PN}-dev to the new ${PN}-renametest (conflict)
+PKG:${PN}-dev = "${PN}-renametest"
@@ -498,13 +498,12 @@ python do_package () {
# 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 %s using PKG:%s, but package name already exists'%(p,rename,p))
+ bb.fatal('package "%s" is renamed to "%s" using PKG:%s, but package name already exists'%(p,rename,p))
###########################################################################
# Optimisations
@@ -89,6 +89,13 @@ class VersionOrdering(OESelftestTestCase):
self.assertEqual(status - 100, sort, "%s %s (%d) failed" % (ver1, ver2, sort))
class PackageTests(OESelftestTestCase):
+ # Verify that a recipe cannot rename a package into an existing one
+ def test_package_name_conflict(self):
+ res = bitbake("packagenameconflict", ignore_status=True)
+ self.assertNotEqual(res.status, 0)
+ err = "package name already exists"
+ self.assertTrue(err in res.output)
+
# Verify that a recipe which sets up hardlink files has those preserved into split packages
# Also test file sparseness is preserved
def test_preserve_sparse_hardlinks(self):