Skip to content

Modernize meta-ossystems-base for oelint-adv (wrynose)#119

Merged
otavio merged 6 commits into
masterfrom
oelint-oe-modernization
Jun 13, 2026
Merged

Modernize meta-ossystems-base for oelint-adv (wrynose)#119
otavio merged 6 commits into
masterfrom
oelint-oe-modernization

Conversation

@otavio

@otavio otavio commented Jun 9, 2026

Copy link
Copy Markdown
Member

Summary

Integrate oelint-adv (release wrynose) linting into meta-ossystems-base
and vendor the Go modules of the telegraf recipe. This builds on the
modernization already merged to master; the remaining findings are either
accepted info-level items, documented inline false positives, or false
positives fixed upstream (see Upstream fixes below).

What's included

  • oelint tooling (declarative, no wrapper flags)
    • oelint.constants.json at the layer root — the layer's custom variables,
      the oel distro and the arm override; auto-loaded by oelint-adv, so no
      --constantmods is needed.
    • .oelint.cfg — sets --release wrynose and the single layer-wide
      suppression oelint.var.bbclassextend (the "set BBCLASSEXTEND for
      native/nativesdk" suggestion never applies to a target-only layer).
    • contrib/oelint/run-oelint.sh — enumerates the layer's files (oelint-adv
      does not recurse) and runs it serially, since its parallel workers race
      while loading the constants.
  • classes — resolved findings: indented MIRRORS/PREMIRRORS
    continuations, task[doc] strings on custom tasks, and inline # nooelint:
    for the documented exceptions.
  • recipes — inline # nooelint: only for genuinely non-applicable rules
    (vars.srcuridomains on the cargo crates .inc, var.filesoverride on
    linuxconsole).
  • telegraf — Go module vendoring
    • inherit go-mod go-mod-update-modules + generated telegraf-go-mods.inc
      and telegraf-licenses.inc; modules are fetched and checksummed via the
      gomod:// fetcher at do_fetch, so the build no longer needs network
      access during compilation.
    • files/license-hashes.csv maps the vendored modules' license md5sums to
      real SPDX identifiers (oe-core's license-hashes.csv mechanism), so
      do_populate_lic no longer reports Unknown.
    • GO_EXTLDFLAGS:append:arm = " -Wl,--long-plt" — the vendored binary is
      large enough to overflow the 28-bit short ARM PLT entry (a binutils
      elf32-arm.c assertion); long PLT entries fix the link.

Upstream fixes (linter + linter library)

Getting the layer clean surfaced two genuine bugs in the linter, fixed upstream:

  • Linter — oelint-adv:
    priv-kweihmann/oelint-adv#889
    teaches the SRC_URI rules about the gomod:// fetcher. Until it is
    released, the generated telegraf-go-mods.inc produces 535 false
    oelint.vars.srcurioptions and 1 oelint.vars.srcuridomains findings.
  • Linter library — oelint-parser:
    priv-kweihmann/oelint-parser#383
    drains leftover parse buffers so a python ...() {} event handler that
    follows def helpers parses correctly. Until it is released, the two
    event-handler bbclasses each report a false oelint.task.docstrings finding.

With both fixes in place the layer lints completely clean.

Validation

  • telegraf builds end-to-end on qemuarm/oel from cleansstategomod://
    fetch + offline compile + do_populate_lic + package, all green.
  • run-oelint.sh is deterministic and clean apart from the upstream-pending
    transients listed above.

@otavio otavio force-pushed the oelint-oe-modernization branch from eedff30 to f599d36 Compare June 12, 2026 20:53
otavio added 5 commits June 13, 2026 14:22
Add the oelint-adv setup for linting meta-ossystems-base:

- oelint.constants.json at the layer root declares the layer's custom
  variables and machine/distro overrides; oelint-adv auto-loads it for
  any recipe in this layer, so no --constantmods is needed.
- .oelint.cfg sets the release and the one layer-wide suppression,
  auto-loaded from the working directory.
- contrib/oelint/run-oelint.sh enumerates the layer's files (oelint-adv
  does not recurse into directories) and runs oelint-adv serially, as its
  parallel workers race while loading the constants and emit spurious
  findings.

The only layer-wide suppression is oelint.var.bbclassextend: every recipe
here is target-only, so its "set BBCLASSEXTEND for native/nativesdk"
suggestion never applies and would otherwise need a redundant inline
comment on every recipe. All other exceptions stay inline as
'# nooelint: <rule.id>' comments next to the finding, so new recipes are
always fully linted and each exception is documented in place.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Fix the actionable findings:
- mirrors.bbclass: indent the MIRRORS/PREMIRRORS continuation lines and
  drop the legacy '\n' separators (BitBake splits on whitespace).
- image-license-checker.bbclass and others: add task[doc] strings to
  custom tasks; drop trailing whitespace and consecutive blank lines.
- ossystems-srcrev-handler.bbclass, ossystems-onsite-only-recipe-handler.bbclass:
  add a [doc] flag to the event handlers.

Document the remaining, non-applicable findings inline with
'# nooelint:' comments: dashed bbclass names (no EXPORT_FUNCTIONS),
MIRRORS/PREMIRRORS set on purpose in the mirror class, and the
anonymous python needed to SkipPackage at parse time.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Document findings that do not apply to these recipes with inline
'# nooelint:' comments instead of global suppressions:
- vars.srcuridomains: cargo crates .inc files are multi-domain by design.
- var.filesoverride: linuxconsole intentionally empties the main package.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
telegraf links into a large binary whose PLT-to-GOT displacement exceeds
the 28-bit range of the short ARM PLT entry, tripping a BFD_ASSERT in
binutils (bfd/elf32-arm.c) at the final link:

  ld: BFD ... assertion fail ... elf32-arm.c
  collect2: error: ld returned 1 exit status

Pass --long-plt so the linker emits 16-byte long PLT entries that reach
the full address space. This is independent of how the Go modules are
fetched.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Switch the recipe from the plain go-mod class -- which fetched modules
over the network during do_compile via do_compile[network] = "1" -- to
properly vendored modules.

Inherit go-mod-update-modules and require the generated
telegraf-go-mods.inc and telegraf-licenses.inc. The module zips are now
pulled and checksummed through the gomod:// fetcher at do_fetch time, so
the build no longer needs network access during compilation and the
module set is pinned and reproducible.

Many vendored module LICENSE files carry customised copyright headers
that the generic matcher cannot identify, so add files/license-hashes.csv
mapping their md5sums to the real SPDX identifiers; oe.license_finder
loads it (the same mechanism oe-core itself uses) so update_modules emits
proper licenses instead of "Unknown".

The manifests were produced with 'bitbake -c update_modules'. Drop the
now-unneeded do_compile[network] flag.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
@otavio otavio force-pushed the oelint-oe-modernization branch from f599d36 to 2e01a47 Compare June 13, 2026 17:33
Add a GitHub Actions workflow that runs oelint-adv over the layer on
every pull request (and pushes to master), so recipe-style regressions
are caught before merge.

The linter is loaded from the shared OSSystems/yocto-env.nix flake via
its '#lint' dev shell, so CI and developers use the exact same pinned
oelint-adv. The job is advisory (continue-on-error) until our upstream
linter fixes are released; see the in-file comment for details.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
@otavio otavio merged commit 1826cdc into master Jun 13, 2026
0 of 2 checks passed
@otavio otavio deleted the oelint-oe-modernization branch June 13, 2026 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant