How gentoo/portage works
Portage is Gentoo’s package-management system for resolving and installing software from ebuild repositories and binary packages. The principal workflow begins with a user invoking the emerge command, which dispatches package actions; dependency resolution selects packages, and build, fetch, merge, and installed-package database components support producing the requested system state. Repository synchronization, binary-package mirroring, and maintenance are separate product capabilities. The graph uses documented or indexed references for evidenced links; unsampled implementation links are omitted or marked unverified.
Main entry points: actions.py Package Actions · main.py Emerge CLI · config.py Repository Config · Package.py Package Model
Components 18
Command and Actions
- Emerge CLI
lib/_emerge/main.py - Package Actions
lib/_emerge/actions.py
Package Resolution
- Package Model
lib/_emerge/Package.py - Dependency Atoms
lib/portage/dep/__init__.py - Version Metadata
lib/portage/versions.py - Package Sets
lib/portage/_sets/base.py - Dependency Graph
lib/_emerge/depgraph.py
Package Operations
- Ebuild Phases
lib/portage/package/ebuild/doebuild.py - Source Fetching
lib/portage/package/ebuild/fetch.py - Package Build
lib/_emerge/EbuildBuild.py - Install and Unmerge
lib/_emerge/PackageMerge.py - Installed Package DB
lib/portage/dbapi/vartree.py - Binary Packages
lib/portage/dbapi/bintree.py
Repositories and Maintenance
- Repository Config
lib/portage/repository/config.py - Repository Sync
lib/portage/sync/controller.py - Binary Mirroring
lib/portage/_emirrordist/main.py - System Maintenance
lib/portage/emaint/main.py
Other components
- User
Connections 18
- User → Emerge CLI: invokes
- Emerge CLI → Package Actions: dispatches
lib/_emerge/main.py - Emerge CLI → Repository Config: configures
lib/_emerge/main.py - Emerge CLI → Repository Sync: dispatches
lib/_emerge/main.py - Package Model → Dependency Atoms: parses
lib/_emerge/Package.py - Package Model → Version Metadata: uses
lib/_emerge/Package.py - Repository Config → Package Sets: uses
lib/portage/repository/config.py - Repository Config → Source Fetching: uses
lib/portage/repository/config.py - Repository Sync → Ebuild Phases: uses
lib/portage/sync/controller.py - Binary Mirroring → Source Fetching: uses
lib/portage/_emirrordist/main.py - Package Actions → Dependency Graph: resolves packages
- Dependency Graph → Package Model: evaluates packages
- Package Actions → Source Fetching: fetches sources
- Package Actions → Package Build: builds packages
- Package Actions → Install and Unmerge: installs packages
- Install and Unmerge → Installed Package DB: updates
- Package Actions → Binary Packages: uses binaries
- User → System Maintenance: runs maintenance