summaryrefslogtreecommitdiffstats
path: root/meta/classes/rootfs-postcommands.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/rootfs-postcommands.bbclass')
-rw-r--r--meta/classes/rootfs-postcommands.bbclass38
1 files changed, 29 insertions, 9 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}