Bug 14992

Summary: layerindex: update.py fails to determine layer dependencies when collections contains "core <...>"
Product: [Yocto Project Subprojects] Layer Index Reporter: Tim Orling <tim.orling>
Component: Layer IndexAssignee: Tim Orling <tim.orling>
Status: RESOLVED FIXED QA Contact: apoorv sangal <apoorvsangal>
Severity: normal    
Priority: Medium+ CC: liezhi.yang, randy.macleod, tgamblin
Version: 4.2   
Target Milestone: 4.3 M4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know
Attachments:
Description Flags
fixup_collections.py none

Description Tim Orling 2022-12-21 02:40:19 UTC
Many/Most layers set BBFILES_COLLECTIONS += "<layernick>". This results in the "collections" variable in LayerBranch being set to "core <layernick>". This results in a failure to determine LAYERDEPENDS [1] (or LAYERRECOMMENDS... etc), for example [2]:

ERROR: Issues found on branch master:
    meta-sourcery: Failed to add since LAYERDEPENDS is not satisfied
    meta-aarch64: Failed to add since LAYERDEPENDS is not satisfied
    meta-openstack: Failed to add since LAYERDEPENDS is not satisfied
    meta-openstack-compute-deploy: Failed to add since LAYERDEPENDS is not satisfied
    meta-openstack-controller-deploy: Failed to add since LAYERDEPENDS is not satisfied
    meta-openstack-qemu: Failed to add since LAYERDEPENDS is not satisfied
    meta-sdr: Failed to add since LAYERDEPENDS is not satisfied
    meta-cgl: Failed to add since LAYERDEPENDS is not satisfied
<snip>

This could probably be "fixed" with a proper manage.py shell script, but that is a bandage and not a robust fix.

[1] https://git.yoctoproject.org/layerindex-web/tree/layerindex/update.py#n519
[2] https://layers.openembedded.org/layerindex/updates/35825/
Comment 1 Tim Orling 2022-12-21 02:50:52 UTC
As a concrete example, 'meta-games' added 'meta-qt5' as a layer dependency. Since 'meta-qt5' had "core qt5-layer" in LayerBranch.collections, this caused a failure [1]:

WARNING: meta-games: LAYERDEPENDS: OrderedDict([('qt5-layer', [])]) LAYERRECOMMENDS: OrderedDict()
WARNING: Known collections on branch master: {('core meta-amateurradio', None), ('aspnet', None), ('rubygems', '1'), ('raspberrypi', None), ('phytec', '2'), ('ivibsp', None), ('rslsync-layer', None), ('minnow', None), ('core scanners-layer', None), ('intel-iot-mw', None), ('core efi-secure-boot', None), ('yoctobsp', '4'), ('core meta-arago-distro', None), ('core updatehub-ti', None), ('core meta-96boards', None) <snip>
ERROR: Issues found on branch master:
    meta-games: Failed to add since LAYERDEPENDS is not satisfied

Once the "Layer Collection" value of 'meta-qt5: master" LayerBranch was manually edited in the admin interface to be only 'qt5-layer' ("core " removed), the update could proceed [2].

[1] https://layers.openembedded.org/layerindex/updates/35826/
[2] https://layers.openembedded.org/layerindex/updates/35827/
Comment 2 Robert Yang 2022-12-21 03:27:56 UTC
Hi Tim,

I think that it has been fixed by:

====
commit edb574ae7e076cb2f6b239ac7fc67073256bf23c
Author: Robert Yang <liezhi.yang@windriver.com>
Date:   Fri Dec 16 08:42:51 2022 -0800

    utils.py: Use get_layer_var() to get BBFILE_COLLECTIONS
====

You've already merged the patch, but the database was wrong, there should be only one BBFLIE_COLLECTIONS for each layerbranch, if you can find multiple ones in the admin UI, then I think that you can try to fix the issue by:

$ ./update.py -b master --fullreload
Comment 3 Randy MacLeod 2022-12-22 15:41:09 UTC
The YP layerindex DB still needs to be cleaned up. Robert, we need someone to take time to maintain the DB, hopefully we can get someone signed up early in the new year.
Comment 4 Randy MacLeod 2023-07-26 21:22:02 UTC
Bulk move of 64 bugs to 4.3 M3 after a quick review.
If a bug is actually fixed, please add a commit link and resolve it.
-- Randy for YP bug team.
Comment 5 Trevor Gamblin 2023-09-14 16:53:30 UTC
Moved to M4.
Comment 6 Tim Orling 2023-10-07 17:52:18 UTC
Created attachment 4979 [details]
fixup_collections.py

Doing a fullreload on all layers is a valid option, but a bit of a heavy hammer. Instead we can use a script to update the database.

New layers added after:
https://git.yoctoproject.org/layerindex-web/commit/layerindex?id=d8ab1beebeb5b49693b522d8618393620495bd74
did not have this problem.

The attached fixup_collections.py script is based on https://git.yoctoproject.org/layerindex-web/tree/layerindex/tools/fixup_duplicates.py
Comment 7 Tim Orling 2023-10-07 17:56:10 UTC
Fixed by running the fixup_collections.py script on the layers.openembedded.org instance on Sept 30, 2023. The script was copied into and run from a container used for this purpose.