nxp-mcuxpresso / spsdk

Secure Provisioning SDK (SPSDK) is unified, reliable and easy to use SW library working across NXP MCU portfolio providing strong foundation from quick customer prototyping up to production deployment.
Other
55 stars 24 forks source link

Errors testing 2.2.0: Invalid validation schema to check config: required must contain unique elements #73

Closed jjakob closed 4 months ago

jjakob commented 4 months ago

I'm building spsdk 2.2.0 on Gentoo with my own ebuild, but am getting test errors (7 failed but they're all the same)

FAILED tests/nxpimage/test_nxpimage_fcb.py::test_nxpimage_fcb_export[rt5xx-flexspi_nor] - AssertionError: Expected code: 0, Actual
code: 1
SPSDK: Invalid validation schema to check config: required must contain unique elements
  File "/usr/lib/python3.12/site-packages/click/testing.py", line 408, in invoke
    return_value = cli.main(args=args or (), prog_name=prog_name, **extra)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/tmp/portage/dev-python/spsdk-2.2.0/work/spsdk-2.2.0/spsdk/apps/nxpimage.py", line 1887, in fcb_export_command
    fcb_export(config, output)
  File "/var/tmp/portage/dev-python/spsdk-2.2.0/work/spsdk-2.2.0/spsdk/apps/nxpimage.py", line 1898, in fcb_export
    check_config(config_data, schemas, search_paths=[os.path.dirname(config)])
  File "/var/tmp/portage/dev-python/spsdk-2.2.0/work/spsdk-2.2.0/spsdk/utils/schema_validator.py", line 235, in check_config
    raise SPSDKError(f"Invalid validation schema to check config: {str(exc)}") from exc

The same error is repeated for rt5xx-flexspi_nor, rt6xx-flexspi_nor, rt105x-flexspi_nor, rt106x-flexspi_nor, rt117x-flexspi_nor, lpc55s3x-flexspi_nor, mcxn9xx-flexspi_nor.

The ebuild I used is here https://github.com/jjakob/gentoo-overlay/blob/py3.12_staging_pynitrokey/dev-python/spsdk/spsdk-2.2.0.ebuild

BohdanMarek commented 4 months ago

Hi @jjakob, This problem is related to fastjsonchschema package we use as a dependency. The version 2.20.0 introduced an additional check on validation schemas where only the unique items are accepted in required keyword. For more information about this, see the changelog.

In terms of SPSDK, the current version 2.2.0 limits the fastjonschema to <2.20.0. See the requirements.txt. In version 2.3.0, the validation schema for FCB will be fixed and the the upper boundary of fastjsonchschema increased. Until then, please use the version lower than 2.20.0

jjakob commented 4 months ago

Thanks, I opted to use your commit to patch the test, becase Gentoo only packages fastjsonschema 2.20.0 so downgrading is not an option.