Modernize meta-ossystems-base for oelint-adv (wrynose)#119
Merged
Conversation
eedff30 to
f599d36
Compare
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>
f599d36 to
2e01a47
Compare
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Integrate
oelint-adv(releasewrynose) linting intometa-ossystems-baseand vendor the Go modules of the
telegrafrecipe. This builds on themodernization already merged to
master; the remaining findings are eitheraccepted info-level items, documented inline false positives, or false
positives fixed upstream (see Upstream fixes below).
What's included
oelint.constants.jsonat the layer root — the layer's custom variables,the
oeldistro and thearmoverride; auto-loaded by oelint-adv, so no--constantmodsis needed..oelint.cfg— sets--release wrynoseand the single layer-widesuppression
oelint.var.bbclassextend(the "set BBCLASSEXTEND fornative/nativesdk" suggestion never applies to a target-only layer).
contrib/oelint/run-oelint.sh— enumerates the layer's files (oelint-advdoes not recurse) and runs it serially, since its parallel workers race
while loading the constants.
MIRRORS/PREMIRRORScontinuations,
task[doc]strings on custom tasks, and inline# nooelint:for the documented exceptions.
# nooelint:only for genuinely non-applicable rules(
vars.srcuridomainson the cargo crates.inc,var.filesoverrideonlinuxconsole).
inherit go-mod go-mod-update-modules+ generatedtelegraf-go-mods.incand
telegraf-licenses.inc; modules are fetched and checksummed via thegomod://fetcher atdo_fetch, so the build no longer needs networkaccess during compilation.
files/license-hashes.csvmaps the vendored modules' license md5sums toreal SPDX identifiers (oe-core's
license-hashes.csvmechanism), sodo_populate_licno longer reportsUnknown.GO_EXTLDFLAGS:append:arm = " -Wl,--long-plt"— the vendored binary islarge enough to overflow the 28-bit short ARM PLT entry (a binutils
elf32-arm.cassertion); long PLT entries fix the link.Upstream fixes (linter + linter library)
Getting the layer clean surfaced two genuine bugs in the linter, fixed upstream:
oelint-adv:priv-kweihmann/oelint-adv#889
teaches the
SRC_URIrules about thegomod://fetcher. Until it isreleased, the generated
telegraf-go-mods.incproduces 535 falseoelint.vars.srcurioptionsand 1oelint.vars.srcuridomainsfindings.oelint-parser:priv-kweihmann/oelint-parser#383
drains leftover parse buffers so a
python ...() {}event handler thatfollows
defhelpers parses correctly. Until it is released, the twoevent-handler bbclasses each report a false
oelint.task.docstringsfinding.With both fixes in place the layer lints completely clean.
Validation
telegrafbuilds end-to-end on qemuarm/oel fromcleansstate—gomod://fetch + offline compile +
do_populate_lic+ package, all green.run-oelint.shis deterministic and clean apart from the upstream-pendingtransients listed above.