AGENTS.md is read on every task, so it keeps routing, the hard stops, the install and keyword gates and the completion report, and drops to 514 words; all rule files together drop from 7546 to 5783 words. Rules state the result to reach, and keep a prohibition only where a mistake is hard to undo or a reviewer has caught it before. Lessons from reviewed PRs: PATCHES carried over a bump, Go -ldflags without -s or -w, RUST_MIN_VER from the highest rust-version, cargo QA_FLAGS_IGNORED, ISA gating through cpu_flags, Python Requires-Dist, draft PRs for eclass provider slots missing from ::gentoo, skel.ebuild variable order, DependencyMissingKeywords, and the Go vendor layout. The PR template asks for the reason, a Tested: line and two checks, and names the merge-base scan range so it is not read as a bare --commits. Signed-off-by: Zakk <zakk@gentoozh.org>
4.0 KiB
4.0 KiB
Ebuild Construction
Read with: AGENTS.md § Ebuild Policy for install, keyword and precedent gates; dependencies.md for atoms and revbumps.
- Prefer the package and its history, a comparable current package, eclass and upstream source, then official Gentoo documentation and gentoo.git. Never substitute memory or superficial similarity for evidence.
- Preserve package-local style and user/toolchain flags. Keep patches and refactors narrow; remove forced optimization, hardening, LTO, stripping, and blanket
-Werror. Go builds leave stripping and debug splitting to Portage:-ldflagscarries no-sor-w, and keeps its-Xflags. - Keep release and live behavior distinct; port applicable dependency, QA, EAPI, and phase fixes to the live ebuild.
- A live version sorts above every release: date-versioned
20240203needs99999999, because9999sorts lower. Verify ordering with Portage'svercmpbefore naming it. - Every
${FILESDIR}reference names a committed file. - With
PATCHESand customsrc_prepare, calldefaultor apply patches explicitly;eapply_userhandles user patches only. - Global scope is metadata-invariant and side-effect-free: deterministic package-manager helpers and pure shell expansion only. External programs, uncaptured output, state changes, system/profile/repository/phase-dependent work, pipes, process substitution, heredocs, and herestrings belong in phases. Bash can back heredocs and herestrings with files forbidden by the metadata sandbox.
- Declare external build/test inputs through
SRC_URI/Manifestor an eclass vendor mechanism. Operation stays offline with cold caches. - Each USE state controls its options, dependencies, sources, and install cleanup consistently; disable automagic. Update
metadata.xmldescriptions when adding, removing, or renaming local USE flags. - Prune only paths the selected USE state would install through
src_install; remove unreachable cleanup. ${ED}includes the Prefix offset;${D}excludes it. Use bare${EPREFIX}only in installed runtime content whose consumer runs under Prefix.- Verify package and bundled-component licenses, Gentoo license names, and redistribution terms. Set
RESTRICT=mirror/bindistfrom those terms;LICENSEincludes every component compiled or statically linked into installed files. - For licenses absent from
::gentoo, add full text underlicenses/and apply their distribution terms. A redistribution ban requires bothmirrorfor distfiles andbindistfor built output. Add fitting licenses toprofiles/license_groups; leave others ungrouped. - Backports record the upstream commit, PR, or bug URL and applicable/tested versions.
- Security fixes cover every still-keyworded vulnerable branch and relevant sibling or fork; apply
dependencies.mdfor revbumps. - Package moves update
profiles/updatesand all affected references atomically.
Code Style
- Prefer concise code, clear names, established helpers, direct control flow, and simple structure. Keep logic near its use; functions justify their cost by reducing complexity or duplication.
- Keep useful, accurate comments explaining non-obvious intent, constraints, trade-offs, or workarounds a maintainer must preserve. Code and eclass documentation carry ordinary assignments, configuration, declarations, options, calls, commands, and standard settings. Record QA-suppression rationale in review text, outside code comments.
- Cargo ebuilds installing ELF binaries set
QA_FLAGS_IGNOREDfor those binaries; recheck when a bump adds one. Go ebuilds use go-module.eclass's existingQA_FLAGS_IGNORED='.*'. - Gate ISA-dependent binaries with
REQUIRED_USE="amd64? ( cpu_flags_x86_* )"following::gentooprecedent. Retain the gate when baseline CI cannot satisfy it; CI gives the target package the runner's CPU flags. - Follow
skel.ebuildvariable order:DESCRIPTION,HOMEPAGE,SRC_URI,S,LICENSE,SLOT,KEYWORDS,IUSE,REQUIRED_USE,RESTRICT, then dependencies. Reordering alone needs no revbump.