Open-CMSIS-Pack / devtools

Open-CMSIS-Pack development tools - C++
Apache License 2.0
76 stars 58 forks source link

cbuild setup with `--packs` option should install required packs #1819

Open ReinhardKeil opened 1 month ago

ReinhardKeil commented 1 month ago

Describe the bug

When a BSP is loaded that requests a DFP with a certain version, the command cbuild setup with --packs option should install the required pack.

To Reproduce

Install these packs:

Use this project: Simple_Device_project.zip

Execute cbuild setup, it should show the following errors:

cbuild setup Simple.csolution.yml --packs --context-set
error csolution: no component was found with identifier 'Device:Config Tools:Init'
error csolution: processing context 'Simple.Debug+MCXN947VDF' failed

Expected behavior

cbuild downloads the required DFP pack 19.0.0, see: https://github.com/VladimirUmek/NXP_FRDM-MCXN947_BSP/blob/main/NXP.FRDM-MCXN947_BSP.pdsc#L20

Note: cpackget add installs required packs, but I have used the uVision PackInstaller with a click on the pack file.

Environment (please complete the following information):

jkrech commented 1 month ago

Note that cbuild is intentionally calling cpackget --no-dependencies, fully relying on csolution to evaluate dependencies, in order to avoid that unnecessary pack versions get installed. Some packs require other packs only under certain circumstances, however all used pack versions required by a CMSIS solution project are known by csolution.

ReinhardKeil commented 1 month ago

The call with --no-dependencies was implemented as some packs had a long requirement list and forced in this way the installation of many unrelated packs. The requirement list in PDSC is therefore not representing a must have list of packs, but more a recommendation that packs outside the required version range will not work.

This is what we got:

MCXN947_BSP requires DFP 19.0.0 or higher to work. Template project contains no pack versions which avoids that it needs to be constantly updated. But it lists the right packs (so this requirement list is correct, just versions are missing).

Potential solution:

Once the requested packs by the project are loaded, use the requirement list in the PDSC to check if pack versions are matching. At least this could result in an user notification.

Proposed output:

warning: pack NXP.FRDM-MCXN947_BSP requires pack NXP::MCXN947_DFP@19.0.0 or higher
jkrech commented 4 weeks ago

Looks like we were drawing the wrong conclusions in https://github.com/Open-CMSIS-Pack/devtools/issues/1356 where we abandoned the check behind a debug flag but listing all required packs regardless whether they are loaded by the solution or not. The proposal above limits the requirements check between pack versions that are already selected/loaded.