Skip to content

Commit

Permalink
[kernel] Use better checking for backfilling kernel dependencies
Browse files Browse the repository at this point in the history
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'.
  • Loading branch information
mochel-timesys committed Sep 24, 2020
1 parent 0545e89 commit a2aca9e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
25 changes: 21 additions & 4 deletions classes/vigiles.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
"

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)} "


Expand Down Expand Up @@ -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"


Expand Down
1 change: 1 addition & 0 deletions conf/vigiles.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit a2aca9e

Please sign in to comment.