summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/rootfs-postcommands.bbclass38
-rw-r--r--meta/lib/oeqa/selftest/cases/overlayfs.py4
2 files changed, 31 insertions, 11 deletions
diff --git a/meta/classes/rootfs-postcommands.bbclass b/meta/classes/rootfs-postcommands.bbclass
index b63a5b90d3..7b92df69c5 100644
--- a/meta/classes/rootfs-postcommands.bbclass
+++ b/meta/classes/rootfs-postcommands.bbclass
@@ -372,25 +372,45 @@ rootfs_reproducible () {
372 fi 372 fi
373} 373}
374 374
375# Perform a dumb check for unit existence, not its validity
375python overlayfs_qa_check() { 376python overlayfs_qa_check() {
376 from oe.overlayfs import mountUnitName 377 from oe.overlayfs import mountUnitName
377 378
378 # this is a dumb check for unit existence, not its validity
379 overlayMountPoints = d.getVarFlags("OVERLAYFS_MOUNT_POINT") or {} 379 overlayMountPoints = d.getVarFlags("OVERLAYFS_MOUNT_POINT") or {}
380 imagepath = d.getVar("IMAGE_ROOTFS") 380 imagepath = d.getVar("IMAGE_ROOTFS")
381 searchpaths = [oe.path.join(imagepath, d.getVar("sysconfdir"), "systemd", "system"), 381 sysconfdir = d.getVar("sysconfdir")
382 searchpaths = [oe.path.join(imagepath, sysconfdir, "systemd", "system"),
382 oe.path.join(imagepath, d.getVar("systemd_system_unitdir"))] 383 oe.path.join(imagepath, d.getVar("systemd_system_unitdir"))]
384 fstabpath = oe.path.join(imagepath, sysconfdir, "fstab")
385
386 if not any(os.path.exists(path) for path in [*searchpaths, fstabpath]):
387 return
388
389 fstabDevices = []
390 if os.path.isfile(fstabpath):
391 with open(fstabpath, 'r') as f:
392 for line in f:
393 if line[0] == '#':
394 continue
395 path = line.split(maxsplit=2)
396 if len(path) > 2:
397 fstabDevices.append(path[1])
383 398
384 allUnitExist = True; 399 allUnitExist = True;
385 for mountPoint in overlayMountPoints: 400 for mountPoint in overlayMountPoints:
386 path = d.getVarFlag('OVERLAYFS_MOUNT_POINT', mountPoint) 401 mountPath = d.getVarFlag('OVERLAYFS_MOUNT_POINT', mountPoint)
387 unit = mountUnitName(path) 402 if mountPath in fstabDevices:
403 continue
404
405 mountUnit = mountUnitName(mountPath)
406 if any(os.path.isfile(oe.path.join(dirpath, mountUnit))
407 for dirpath in searchpaths):
408 continue
388 409
389 if not any(os.path.isfile(oe.path.join(dirpath, unit)) 410 bb.warn('Mount path %s not found in fstat and unit %s not found '
390 for dirpath in searchpaths): 411 'in systemd unit directories' % (mountPath, mountUnit))
391 bb.warn('Unit name %s not found in systemd unit directories' % unit) 412 allUnitExist = False;
392 allUnitExist = False;
393 413
394 if not allUnitExist: 414 if not allUnitExist:
395 bb.fatal('Not all mount units are installed by the BSP') 415 bb.fatal('Not all mount paths and units are installed in the image')
396} 416}
diff --git a/meta/lib/oeqa/selftest/cases/overlayfs.py b/meta/lib/oeqa/selftest/cases/overlayfs.py
index 82007fade7..79d36fa93c 100644
--- a/meta/lib/oeqa/selftest/cases/overlayfs.py
+++ b/meta/lib/oeqa/selftest/cases/overlayfs.py
@@ -61,9 +61,9 @@ DISTRO_FEATURES += "systemd overlayfs"
61 self.add_overlay_conf_to_machine() 61 self.add_overlay_conf_to_machine()
62 62
63 res = bitbake('core-image-minimal', ignore_status=True) 63 res = bitbake('core-image-minimal', ignore_status=True)
64 line = getline(res, "Unit name mnt-overlay.mount not found in systemd unit directories") 64 line = getline(res, " Mount path /mnt/overlay not found in fstat and unit mnt-overlay.mount not found in systemd unit directories")
65 self.assertTrue(line and line.startswith("WARNING:"), msg=res.output) 65 self.assertTrue(line and line.startswith("WARNING:"), msg=res.output)
66 line = getline(res, "Not all mount units are installed by the BSP") 66 line = getline(res, "Not all mount paths and units are installed in the image")
67 self.assertTrue(line and line.startswith("ERROR:"), msg=res.output) 67 self.assertTrue(line and line.startswith("ERROR:"), msg=res.output)
68 68
69 def test_mount_unit_not_set(self): 69 def test_mount_unit_not_set(self):