Overlay ebuild style guidelines and quality assurance (QA) for this overlay

June 2, 2026 · View on GitHub

Ebuild coding styles

SubjectAnswer
Distro style supportedY, for ebuilds originally from the distro overlay
oiledmachine-overlay style supportedY

Distro ebuild example

# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

if [[ ${PV} == *9999* ]] ; then
	EGIT_REPO_URI="https://codeberg.org/gentoo/gentoo.git"
	inherit git-r3
fi

DESCRIPTION="An example of Larry the Cow's package"
HOMEPAGE="https://www.gentoo.org"
LICENSE="GPL-2+"
IUSE="cowpen zlib"
RDEPEND="
	sys-libs/glibc
	zlib? ( sys-libs/zlib )
"
DEPEND="${RDEPEND}"
BDEPEND="
	sys-devel/gcc
"
PATCHES=(
	"${FILESDIR}"/${PN}-1.0.0-hardcoded-fixes.patch
)

src_unpack() {
	if [[ ${PV} == *9999* ]]; then
		git-r3_fetch
		git-r3_checkout
	else
		unpack ${A}
	fi
}

src_prepare() {
	default
	if use zlib; then
		# This is a comment.
		eapply "${FILESDIR}"/${PN}-1.0.0-hardcoded-fixes.patch"
	fi
}

pkg_postinst() {
	ewarn "The data center stole Larry the Cow's water!"
	if ! use cowpen; then
		ewarn
		ewarn "Security Notice"
		ewarn
		ewarn "Larry the Cow has escaped!"
		ewarn
	fi
}

oiledmachine-overlay style example

# Copyright 2026 Orson Teodoro <orsonteodoro@hotmail.com>
# Distributed under the terms of the GNU General Public License v2

EAPI=8

if [[ "${PV}" =~ "9999" ]] ; then
	EGIT_REPO_URI="https://github.com/orsonteodoro/oiledmachine-overlay.git"
	FALLBACK_COMMIT="8bc1b6e21ab588a3bc755a8d8dde1dd9c3d08a1b"
	IUSE+=" fallback-commit"
	inherit git-r3
else
	S="${WORKDIR}/${P}"
fi

DESCRIPTION="An example of Larry the Cow's package"
HOMEPAGE="https://www.gentoo.org"
LICENSE="GPL-2+"
IUSE="cowpen zlib"
RDEPEND="
	sys-libs/glibc
	zlib? (
		sys-libs/zlib
	)
"
DEPEND="
	${RDEPEND}
"
BDEPEND="
	sys-devel/gcc
"
PATCHES=(
	"${FILESDIR}/${PN}-1.0.0-hardcoded-fixes.patch"
)

src_unpack() {
	if [[ "${PV}" =~ "9999" ]] ; then
		use fallback-commit && EGIT_COMMIT="${FALLBACK_COMMIT}"
		git-r3_fetch
		git-r3_checkout
	else
		unpack ${A}
	fi
}

src_prepare() {
	default
	if use zlib ; then
	# This is a comment.
		eapply "${FILESDIR}/${PN}-1.0.0-hardcoded-fixes.patch"
	fi
}

pkg_postinst() {
ewarn "The data center stole Larry The Cows water!"
	if ! use cowpen ; then
ewarn
ewarn "Security Notice"
ewarn
ewarn "Larry the Cow has escaped!"
ewarn
	fi
}

C defaults

SubjectAnswer
Default C-std=gnu17
Acceptable LTS C-std=gnu17
Acceptable rolling C-std=gnu20, -std=gnu23
Default C compilerGCC
Default C linkerBFD
Autotools vs CMakeCMake
CMake vs MesonAny
CMake vs BazelCMake
Ninja vs MakeNinja

C++ defaults

SubjectAnswer
Default C++-std=gnu++17
Acceptable rolling C++-std=gnu++20, -std=gnu++23, -std=c++20, -std=c++23
Acceptable LTS C++-std=gnu++17, -std=gnu++11, -std=c++17, -std=c++11
Acceptable LTS linkingLTS app with only LTS libs; LTS lib with LTS lib
Acceptable rolling linkingRolling app with LTS lib or rolling lib; rolling lib with rolling lib
Default C++ compilerGCC
Default C++ linkerBFD
Autotools vs CMakeCMake
CMake vs MesonAny
CMake vs BazelCMake
Ninja vs MakeNinja

Python defaults

SubjectAnswer
Default Pythonpython3_12
Acceptable rolling Python slotspython3_14
Acceptable LTS Python slotspython3_{11..13}
Acceptable multislot Pythonpython3_{11..14}
Acceptable single slot Pythonpython3_{11..14}
Acceptable slot paringThe Python app slot must pair with same Python slot for dependencies down to the leaf packages
Are binary packages allowed?Allowed with restrictions but only if that is the only option or difficult to package
Default Python interpreterCPython
Python slot precedenceApp's setup.py, CI's .github/*.yaml, Dockerfile, lib's setup.py, CI image default Python slot
pypy3_11 supportY if specified in setup.py
Must use slotted CythonY, forcing untested newer versions may result in undefined behavior or miscompilation vulnerabilities
Hacks are allowed? (using Cython over Zig)If the package uses security-critical assumptions or processes untrusted data, it is disallowed.

Rust defaults

SubjectAnswer
Default LTS RustRust 1.91.1
Default rolling RustRust 1.95.0
What is a rolling or LTS Rust package?Determined by most recent Rust slot needed for Cargo.lock.
LTS if <= 1.91.1
Rolling if > 1.91.1
Acceptable LTS Rust for non C++Rust 1.91.1
Acceptable rolling Rust for non C++Rust 1.95.0
Acceptable Rust for LLVM 22 for C++Rust 1.95.0
Acceptable Rust for LLVM 21 for C++Rust 1.94.1
Acceptable Rust for LLVM 20 for C++Rust 1.90.0
Acceptable Rust for LLVM 19 for C++Rust 1.85.1
Acceptable Rust for LLVM 18 for C++Rust 1.81.0
Acceptable Rust for LLVM 17 for C++Rust 1.77.2
Use 1 pinned Rust slotY
A Cargo.lock should be generatedY
Offline installY

JS default

SubjectAnswer
Default slotUse the one that is associated with that release
Fallback slot: .github/*.yamlSee .yaml file for Node version, the tested slot is preferred
Fallback slot: DockerfileUse the same major version for Node
Fallback slot: .nvmrcUse the same major version for Node
Fallback slot: @types/node in lockfileUse the same major version for Node
Fallback slot: Unknown default slotUse the oldest upstream supported LTS (20)
npm vs Yarn vs pnpmUse the one that is the default by the project
Bun vs NodeForce Node but if no hard dependence on Bun. Bun requires SSE4.2 but Node can run on older hardware.
Use 1 pinned Node slotY
Lockfile(s) should be generatedY
Offline installY cached in distfiles

Feature QA

SubjectAnswer
USE defaults for actively patented non-free codecsOFF
USE defaults for security risk featuresHard disable if catastrophic, OFF if harm or loss implied
USE defaults for LTS using rolling dependencyON if security-critical feature (e.g. sandbox) in app package bumped to rolling, OFF for LTS libs linking to rolling libs
USE defaults fallbackShould match upstream with exceptions
Default bloat spectrum if no defaults listedMinimal install with optional USE flags
Wayland or X11Both should be supported if able to run on either
Hard USE appropriatenessOnly use if catastropic or last option, do not abuse it
Custom USE flags or custom config options patches allowed?Y
Forcing defaults is okay or no effort for adding USE flags okay?The quality is frowned upon but is acceptable sometimes for small packages but increases bloat, increases build time, increases the attack surface, or possibly hard codes paths. Users should be able to consent to the attack surface risk but not forced unconsensually to have the risk.

Slotting QA

SubjectAnswer
Compilers and interpreters must be slottedY
Poison pilled versioning must be slottedY
LTS must be slottedY
:<SLOT> needs slot operator := in *DEPENDY
C++ header only packages needs slot operator := in DEPENDY
Any variation of LIBCXXUSEDEPor{LIBCXX_USEDEP} or {LIBSTDCXX_USEDEP} needs slot operator :=Y
Explicit <category>/<name>[static-libs] needs slot operator :=Y

Version QA

SubjectAnswer
Live ebuilds policyAs needed, delete if unused
Snapshots vs liveSnapshots or live ebuild with fallback commit
Tagged vs untaggedTagged
*DEPENDs version sourcing precedenceBuild files, CI files, Dockerfile, CI distro versions
*DEPENDs version writing preference-precedenceSlot-comparison, slot, comparison, none
Latest vs min tiebreaker for writing *DEPENDsIt's situational.
For unslotted if different versions encountered, use latest versions if security-critical packages; otherwise, use the oldest version.
For C/C++ slotted when LTS and rolling are involved, add all slots >= minimum slot for compilers, and either 1 slot or n conditional slots for libraries.
For JS, pin only one slot for compiler and build system, and use the C/C++ rules as fallback.
For Python, slots are based on as needed and/or allowed by setup.py.
All used live dependences timestamps should be verified for recentnessY (WIP, TODO: add new eclass) for security reasons
The distro IDs (e.g. A3.23, D12, D13, G23, N25, U22, U24, F44) should be documented?Y for *DEPENDs requirements, proper LTS or rolling compiler alignment, release pruning

Security QA

SubjectAnswer
Untrusted meaningProcesses untrusted data
Trusted meaningNever trust, always verify
Untrusted packages exampleNetwork packages, codec packages, sound/image processing, parsers, web packages
Critically secure examplesMemory allocators, password managers, web browsers
Low level vulnerabilities monitoredDouble free, deadlock, format string, heap overflow, integer overflow, memory leak, miscompilation, null pointer dereference, ROP gadgets, speculative execution, stack overflow, uninitialized memory, use after free, use after return, type confusion
High level vulnerabilities monitoredContainer/sandbox escapes, inappropriate configuration, inappropriate file permissions, prototype pollution, injection, path traversal, ToCToU, unsanitized input, unclassified/unseen, zero-click, zero-day
Daemons must run as limited user/groupY
Hardened by defaultY
Required Clang CFIFor web browsers only (planned)
SSP-strong requiredY for untrusted data
Default SSP level-fstack-protector-strong
Default _FORTIFY_SOURCE level3
Default linker flagsFull Relro
Ciphersuite defaultPost quantum era first and default ON, followed by legacy
Default asymmetricPost-quantum lattice/hash first (ML-KEM, ML-DSA), followed by legacy elliptical (RSA, ECDH, ECDSA)
Default symmetric blockPost-quantum AES-256, followed by legacy AES-128
Default symmetric streamPost-quantum AES-256 (GCM/CTR); followed by legacy AES-CTR (desktop/server)
Acceptable symmetric streamPost-quantum AES-256 (GCM/CTR), Chacha20 (256-bit); followed by legacy AES-CTR (desktop/server), Chacha20 (256-bit, mobile)
Default hashPost-quantum SHA-256, followed by legacy SHA-256
Default KDFPost-quantum Argon2id, followed by legacy PBKDF2
Default CSRNGPost-quantum PQC (AES-256, SHA-3) or QRNG; followed by legacy DRNG (CPU Jitter, HW ocsillator, AES-CTR, SHA-256)
Q-Day estimated arrivalYear 2029 (3-4 years from now)
www-apps require permissions sanitizationY
Default security-critical optimization level-O2
Appropriate security-critical optimization level-O1 to -O2
Fallback default optimization level-O0 (unset) but can be overwritten by user typically -O2
Untrusted data require {c,rust}flags-hardenedY
Security-critical packages require {c,rust}flags-hardenedY
Keys/passwords require Retpoline with {c,rust}flags-hardenedY
PII require Retpoline with {c,rust}flags-hardenedY (Secrets may flow through the same data paths and packages)
Lockfiles should be security scanned and transparentY
Feature abuse (e.g. an AI agent that can make malware)The feature must be disabled or made optional instead of unconditional opt-in
Container packages allowed?Y
Existing package may be replaced with containerized ebuild?N unless community approves
User inside containerMust be a limited user if daemonized, cannot use pre-existing UID of real users
TelemetryDefault off, default opt-out
Data breach detection support (password check remotely)Default off, default opt-out, patching may be required to optionalize
Binary packagesAllowed with restrictions that only if it is either the only option, source package/maintenance issue, or heavy compilation cost
Ebuild EOL pruningIf the older versions are necessary for bootstrapping, it should not be deleted. Otherwise, you're stuck with a compromised trojanized prebuilt.
Hacks are allowed? (using a degraded compiler, using Cython over Zig)If the package uses security-critical assumptions or processes untrusted data, it is disallowed.
X11 banned?Y for security-critical and because Wayland has greater market share

Userspace mitigation comparison

FlagMitigatedDistro(s)oiledmachine-overlay
-C overflow-checks=on (Rust)Integer overflow/underflow, zero-click attack, productionNY
-C target-feature=+retpoline (Rust)Speculative execution, information disclosureNY
-fno-delete-null-pointer-checksUndefined behavior, information-disclosure, code executionNY
-fstack-protector-strongStack overflowYY
-fstack-clash-protectionStack clash attack, privilege escalation (unpriv to priv)YY
-fstrict-flex-arrays=3Heap overflowNY
-ftrivial-auto-var-init=zeroUninitalized memory, information disclosureNY
-fwrapvUndefined behavior, integer overflow, buffer overflow, out-of-bounds access, privilege escalationNY
-fzero-call-used-regs=allROP gadgets, information disclosure, speculative execution side-channelNY
-mfunction-return=thunk (GCC)Speculative execution (RSB), information disclosureNY
-mharden-sls=allSpeculative execution (SLS), information disclosureNY
-mindirect-branch=thunk (GCC)Speculative execution (BTB), information disclosureNY
-mretpoline (Clang)Speculative execution, information disclosureNY
-Wl,-z,relro,-z,now (Full Relro)Data tampering, code executionYY
_FORTIFY_SOURCE=3Stack overflow (weak), heap overflow (strong), out-of-bounds access (weak)YY

Isolation QA

SubjectAnswer
sys-apps/sandbox use casesPortage only, to protect the live system
Firejail use casesUserland apps
Bubblewrap use casesWeb browsers[1], GNOME desktop
Bubblewrap defaults for WebKitGTKMount namespace, user namespace, PID namespace, network namespace, seccomp filters, drop all capabilities
Docker use casesSelf hosting servers, testing
Firejail vs Docker vs PodmanFirejail [2] but Docker containers are used to reduce build/install complexity
Firejail vs BubblewrapFirejail for profile support
Firejail required?N
Firejail default ON?N
Firejail profile security baselineRun with least privileges, allow only necessary privileges or libs/bins, use the maximum possible sandbox restrictions, must run without annoyance for typical use
Which needs Firejail profiles?Executables that use the network or processes untrusted data
Which package is responsible to install the Firejail profile?Either the preferred sys-apps/firejail package or the package itself
Should there be a Firejail profile?Y
Firejail with X11 or Wayland?Wayland

[1] Bubblewrap defaults for WebKitGTK

  • Mount namespace - See only empty filesystem
  • User namespace - See only current user
  • PID namespace - See only PID tree of isolated process
  • Network namespace - Block seeing or snooping on host network interfaces
  • Seccomp filters - Block syscalls that lead to privilege escalation, sandbox escape, information disclosure
  • Drop all capabilities - 38 capabilities dropped

[2] Why Firejail on this overlay?

  • Easier control of access/visibility of credentials, secrets, password databases
  • Blast radius reduction
  • Loyalty to the distro
  • Platforms are used to shill away from this distro and to divide and conquer into co-opted platforms
  • Loyalty to source built than possibly trojanized prebuilts
  • Loyalty to modding and customization over defaults only
  • Reduced attack surface over prebuilt defaults

Firejail

SubjectUpstreamDistrooiledmachine-overlay
Default profile security policyPermissivePermissiveRestrictive
Default profile goalCompatibility, basic protectionCompatibility, basic protectionNeutralizing threat classes, least privileges, verification
Living off the Land mitigation by defaultNNY
Social engineering mitigation by defaultNNY
Configuration vulnerability for disable-devel.inc evaluated under distro contextInappropriateInappropriateMore appropriate
Configuration vulnerability for disable-common.inc evaluated under distro contextInappropriateInappropriateMore appropriate
Threat vectors for defaultsInformation disclosure, lateral movementInformation disclosure, lateral movement-
Additional profiles-NY
Multislot private-lib supportNNY
${PATH}/<cmd> bypass mitigation [1]NNY (Some/WIP)
Flooding the zone mitigation [2]NNY
  • [1] For LOTL attack, /opt installations and absolute path invocations are reachable and useable.
  • [2] Bypassing or adding too many (language or implementation) alternatives to bypass the sandbox blacklists which can be weaponized in LOTL attacks.

Robustness QA

SubjectAnswer
The package must work after being mergedY
If ebuilds do not work, how about KEYWORDS?Commented out
Minimum uptime (kernel, during testing)60 days
Minimum uptime (kernel, during production)30 days
Number of expected/actual crashes in 30 days0
Unfinished features?Disable USE flag, disable configuration, or disable code
Hard coded paths?Allowed if no compatibility, no multilib, no slot issue
Proactive REQUIRED_USE vs reactive configure/compile time build errorsREQUIRED_USE must be used for long compile times or long unpack times to resolve issues ahead of time
USE flag changes reponsibility ebuild, developer, or user? [1]The responsibility is the ebuild and developer mostly to avoid pathological circular error or to reduce the vulnerability window or lag time for waiting for an answer from the forum or bug tracker
Proactive fatal error vs reactive fatal errorProducing a proactive fatal error in the ebuild is preferred because compile time or unpack cost can be very expensive. The user resolves it ahead of time, but lazy programmers or developers that prioritize minimal ebuild size are okay with reactive.
# [1]

# A lazy developer's solution:
# The package manager will flip-flop between +vulkan and -vulkan USE changes
# recommendations.
# The user uses USE="-*" in /etc/make.conf
RDEPEND="
	dev-qt/qtbase:6=[vulkan?]
	dev-qt/qtdeclarative:6=
"

# The conscientious developer's solution:
# The correct solution is the below to resolve the issue.
RDEPEND="
	dev-qt/qtbase:6=[vulkan?]
	dev-qt/qtdeclarative:6=[vulkan?]
"

Performance QA

SubjectAnswer
Minimum FPS25 FPS (Motion picture FPS)
Minimum uptime (kernel, during testing)60 days
Minimum uptime (kernel, during production)30 days
Maximum ebuild completion time36 hours
Runtime thrashingDisallowed
Build time severe thrashingOnly allowed for web browser or AI/ML packages
Maximum install + merge time allowed1 hour

LICENCE variable QA

SubjectAnswer
AI models require licenses and acceptable use AI ethics disclosureY
Telemetry usage require privacy policy and data retention disclosureY
Services require terms of use disclosureY
Patent licenses must be disclosedY
The custom placeholder is allowedY
Copyright notices must be saved (with lcnr or full source install)Y
Actively patented non-free codecs require patent_status_nonfree USE flag and free alternative(s) if possibleY
Full disclosureY if possible
License identifier precedenceDistro, SPDX, license name, package name, link, custom

AI disclosure

SubjectAnswer
Your use of AI code generation must be disclosedY
Your use of AI synthetic data must be disclosedY
Your use of AI inference must be disclosedY
Your use of AI in patches or assets must be disclosedY
The oiledmachine-overlay accepts AI submissionsY
The distro overlay stance of AI submissions on their serversBanned