From a2aca9e566ed7303f1ce2b0cd846a1ea4643e289 Mon Sep 17 00:00:00 2001 From: Patrick Mochel Date: Tue, 22 Sep 2020 09:29:43 -0700 Subject: [PATCH] [kernel] Use better checking for backfilling kernel dependencies When there are multiple providers of virtual/kernel, we were adding tasks for each one, which causes problems because of the way PREFERRED_PROVIDER is resolved -- it seems that when that's done, it 'disappears' all other providers of virtual/kernel, causing an error about a missing provider of e.g. 'linux-fslc-imx'. This change fixes that by explicitly checking the PN against the value of PREFERRED_PROVIDER_virtual/kernel (or first: against a new variable 'VIGILES_KERNEL_PN', which can be used to specify the kernel config to use for checking in the event there are 2 kernels built and the desired one is not set to PREFERRED_PROVIDER for some reason). The dependencies are added only in that case, instead of blindly adding them for all providers of 'virtual/kernel'. --- classes/vigiles.bbclass | 25 +++++++++++++++++++++---- conf/vigiles.conf | 1 + 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/classes/vigiles.bbclass b/classes/vigiles.bbclass index ecf49e8..4780389 100644 --- a/classes/vigiles.bbclass +++ b/classes/vigiles.bbclass @@ -183,7 +183,6 @@ def vigiles_write_manifest(d, tdw_tag, dict_out): # their respective do_vigiles_pkg() tasks. ## VIGILES_PREFERRED_BACKFILL = "\ - virtual/kernel \ virtual/libc \ " @@ -332,6 +331,11 @@ def vigiles_image_collect(d): if boot_pn: backfill_list.append(boot_pn) + kernel_pn = d.getVar('VIGILES_KERNEL_PN') or \ + d.getVar('PREFERRED_PROVIDER_virtual/kernel') or '' + if kernel_pn: + backfill_list.append(kernel_pn) + initramfs_image = d.getVar('INITRAMFS_IMAGE', True) if initramfs_image: backfill_list.append(initramfs_image) @@ -393,10 +397,15 @@ def vigiles_image_depends(d): if boot_pn: deps.append('%s:do_vigiles_uboot_config' % boot_pn) + kernel_pn = d.getVar('VIGILES_KERNEL_PN') or \ + d.getVar('PREFERRED_PROVIDER_virtual/kernel') or '' + if kernel_pn: + deps.append('%s:do_vigiles_kconfig' % kernel_pn) + deps.append('%s:do_vigiles_pkg' % kernel_pn) + return ' '.join(deps) -do_vigiles_image[depends] += "virtual/kernel:do_vigiles_kconfig" do_vigiles_image[depends] += " ${@vigiles_image_depends(d)} " @@ -463,9 +472,17 @@ python do_vigiles_kconfig() { } -do_vigiles_kconfig[depends] += "virtual/kernel:do_configure" +python() { + + pn = d.getVar('PN') + kernel_pn = d.getVar('VIGILES_KERNEL_PN') or \ + d.getVar('PREFERRED_PROVIDER_virtual/kernel') or '' + + if pn == kernel_pn: + bb.build.addtask('do_vigiles_kconfig', 'do_savedefconfig', 'do_configure', d) + d.appendVarFlag('do_vigiles_kconfig', 'depends', ' %s:do_configure' % pn) +} -addtask do_vigiles_kconfig after do_configure before do_savedefconfig do_vigiles_kconfig[nostamp] = "1" diff --git a/conf/vigiles.conf b/conf/vigiles.conf index 0944db1..3c86218 100644 --- a/conf/vigiles.conf +++ b/conf/vigiles.conf @@ -32,6 +32,7 @@ VIGILES_KERNEL_CONFIG ??= "auto" VIGILES_UBOOT_CONFIG ??= "auto" VIGILES_UBOOT_PN ??= "${@d.getVar('PREFERRED_PROVIDER_virtual/bootloader') or ''}" +VIGILES_KERNEL_PN ??= "${@d.getVar('PREFERRED_PROVIDER_virtual/kernel') or ''}" # This list can include recipe names (PN) or specific CVE IDs that should *not* # be included in CVE Reports and notifications.