oelint.var.mandatoryvar

March 25, 2024 ยท View on GitHub

severity: error

Example

In my-recipe_1.0.bb

A = "1"

Why is this bad?

Some variables should be always set to have more information about the purpose, license and origin of the sources that this recipe is using.

Ways to fix it

The following variables should always be set in the recipe

  • SUMMARY
  • DESCRIPTION
  • HOMEPAGE
  • LICENSE
  • SRC_URI
SUMMARY = "My recipe"
DESCRIPTION = "My recipe that does all the magic"
HOMEPAGE = "https://my-homepage.com"
LICENSE = "MIT"
SRC_URI = "https://my-homepage.com/foo_${PV}.zip"

Fine tuning

To fine tuned the behavior on the rule, you can apply the following constants

  • oelint-mandatoryvar/pkggroup-excludes to skip mandatory variables in a packagegroup
  • oelint-mandatoryvar/image-excludes to skip mandatory variables in images
  • oelint-mandatoryvar/{varname}-exclude-classes to skip {varname}, because of a class inherited that defines the variable already

e.g. if your custom class foo.bbclass contains

SRC_URI ?= "http://foo.com/{BPN}.zip"
BUGTRACKER ?= "http://foo.com/{BPN}/issues"

but resides in a different layer than the current, you can run the linter with

oelint-adv --constantmods=+.my-custom-src-uri-classes.json <other options> <file>...

with .my-custom-src-uri-classes.json being

{
    "oelint-mandatoryvar": {
        "SRC_URI-exclude-classes": [
            "foo"
        ],
        "BUGTRACKER-exclude-classes": [
            "foo"
        ]
    }
}

to let the linter know that this is fine in the given context.

See also the Configuration file option to automatically apply that to the layer.