Files and directories

Updated 7 November 2026

This page applies to Portage 3.0.82 and Calculate Utilities 3.8.

Portage files

Configuration directives

Portage ships with default settings stored in the /usr/share/portage/config/make.globals file. Portage is configured entirely through variables; the purpose of each variable is described on the Configuring your system with variables page.

Since many directives vary by architecture, part of the default settings is included in the system profile. A symbolic link /etc/portage/make.profile points to the profile, and the values themselves are set in the make.defaults files of that profile and of all its parent profiles.

When you change configuration variables, do not edit make.globals and make.defaults - use /etc/portage/make.conf instead, which takes priority over them. In Calculate Linux this is a directory rather than a file: the binhost file in it is created by a distribution template (do not edit it by hand - a .clt template is needed for a value of your own, see Templates), while user settings go into the custom file, which carries commented-out "handles" for the build and for the compiler. The make.conf directory is covered in detail on the Configuring your system with variables page.

The sample file /usr/share/portage/config/make.conf.example shows what the variables are for: Portage does not read it, it is only an example.

You can also set Portage variables through environment variables, but you should not do so.

Profile-specific configuration

The /etc/portage/make.profile link points to the profile the system follows: Portage finds the profile through this link, while your own profiles can be located anywhere. In Calculate Linux this link belongs to the distribution and leads into the distros repository - to the /var/db/repos/distros/profiles/CLD/amd64/20 profile, which stands above the Gentoo profile: its parents are the Calculate profile and the Gentoo base profile for amd64. You should not change this link (including with eselect): the mirror's binary packages and the world templates depend on the distribution profile; for details, see the Mixing branches page.

The profile holds architecture-specific information: the list of packages belonging to the system of that profile, the list of packages that do not work for the profile or are masked, and similar data.

User-specific configuration

When you need to change Portage behavior, edit the files inside /etc/portage. We strongly recommend that you use the files in /etc/portage itself; overriding Portage behavior with environment variables is not recommended.

Inside /etc/portage you can create:

  • package.mask - the list of packages Portage must never install;
  • package.unmask - packages you may install even when a package is marked as unstable;
  • package.accept_keywords - packages you may install even though they have not yet been accepted as suitable for your system or architecture;
  • package.use - USE flag values for individual packages rather than for the whole system.

These do not have to be files - each path can be a directory, in which case Portage merges the settings from all of its files. In Calculate Linux all four entries are already created as directories; for example, /etc/portage/package.use/custom holds a stub file that is carried over during system installation.

In addition, the distribution ships the savedconfig/, sets/ and profile/ directories in /etc/portage (with a distribution stub of package.provided), plus the postsync.d/ directory with the 50-eix-postsync hook, which updates the eix database after synchronization.

The distribution does not create the package.env file (or directory) - you create it yourself if you need to set environment variables for individual packages; the Environment variables page covers this.

The full list of files and directories that Portage understands is given in its man page:

man portage

Changing file and directory locations

The configuration files listed above cannot be stored elsewhere: Portage always looks for them at strictly defined paths. However, For the remaining tasks - building packages, storing sources, repositories - Portage has its own default directories, and you can change their location by setting the corresponding variables in /etc/portage/make.conf.

This page does not replace the reference: complete information about the variables and paths is in the portage and make.conf man pages.

man make.conf

Path map in Calculate Linux

The main Portage directories in an installed Calculate Linux:

Path Purpose
/etc/portage/make.conf directory of user configuration variables (not a file)
/etc/portage/make.profile symbolic link to the active profile
/usr/share/portage/config/ built-in default settings: make.globals, make.conf.example, binrepos.conf
/var/db/repos/gentoo mirror of the Gentoo ebuild tree
/var/db/repos/calculate Calculate packages, eclasses and templates
/var/db/repos/distros distribution profiles (CLD, CLDX, CDS, etc.)
/var/calculate/repos/container repository of container builds
/var/calculate/repos/custom user repository
/var/calculate/distfiles downloaded sources (the DISTDIR variable)
/var/calculate/packages/x86_64 binary packages (the PKGDIR variable)
/var/calculate/tmp build directory (the PORTAGE_TMPDIR variable)
/var/db/pkg database of installed packages
/var/cache/edb Portage metadata cache
/var/lib/portage/world list of explicitly installed packages

File storage

Ebuild repositories

The default location of the main gentoo repository is /var/db/repos/gentoo (it is marked as main-repo in the emerge --info output). The location parameter in the files of the /etc/portage/repos.conf directory sets the location of each repository.

Calculate Linux has five repositories; their locations are visible in the Repositories block of the emerge --info output:

emerge --info
Repositories:

custom
    location: /var/calculate/repos/custom
    masters: calculate gentoo
    volatile: True

calculate
    location: /var/db/repos/calculate
    sync-type: calculate
    sync-uri: https://github.com/calculatelinux/calculate
    masters: gentoo
    priority: 50
    volatile: False

container
    location: /var/calculate/repos/container
    sync-type: git
    sync-uri: https://github.com/calculatelinux/container
    masters: calculate gentoo
    priority: 50
    volatile: True

distros
    location: /var/db/repos/distros
    sync-type: calculate
    sync-uri: https://github.com/calculatelinux/distros
    masters: calculate gentoo
    priority: 50
    volatile: False

gentoo
    location: /var/db/repos/gentoo
    sync-type: calculate
    sync-uri: https://github.com/calculatelinux/gentoo
    priority: 50
    volatile: False

The purpose of the repositories: gentoo is a mirror of the Gentoo tree (synchronized with the repository of the Calculate project), calculate holds Calculate packages, eclasses and templates, distros holds distribution profiles, container is the repository for container builds, and custom is a user repository with calculate and gentoo as masters.

Не правьте файлы репозиториев дистрибутива

The distribution's repository configuration is carried by the /etc/portage/repos.conf/zz-calculate.conf file (the distros, calculate, gentoo and custom repositories) and by the /etc/portage/repos.conf/custom.conf file (the container repository). The distribution creates them, they do not belong to any package, and you should not edit them by hand. Add your own repository as a new file in /etc/portage/repos.conf - the Stepping aside from the official tree page goes into more detail.

The layman utility is absent from the system: Calculate ships a ready-made user repository custom instead.

When you move a repository elsewhere, also set the PKGDIR and DISTDIR variables in /etc/portage/make.conf: because of how variables are processed, they will not notice the move on their own.

Binary packages

Portage can work with ready-made binary packages. In vanilla Portage they are not used by default and should be looked for in /var/cache/binpkgs; in Calculate Linux, installing from binary packages is the default, and local and downloaded builds are stored in /var/calculate/packages/x86_64 (the PKGDIR variable). The distribution sets the address of the binary package server; the mechanism is described on the Portage features page.

Source code

Portage stores the downloaded source archives in the directory set by the DISTDIR variable; in Calculate Linux this is /var/calculate/distfiles. Downloads come from the mirrors listed in the GENTOO_MIRRORS variable.

Portage database

Portage keeps the system state - which packages are installed and which files belong to them - in /var/db/pkg.

Не изменяйте файлы состояния вручную

Editing the database records by hand can break Portage's view of the system.

Portage cache

The cache (modification times, virtual packages, dependency tree information) is kept in /var/cache/edb. This is a cache in the strict sense: you can clear it as long as no application related to Portage is running at that moment.

World file

Portage keeps the list of explicitly installed packages in the /var/lib/portage/world file. In Calculate its contents are formed not by user settings alone: the list is assembled by the distribution templates 6_ac_update_sync/world/create/*, so the file starts with a service header listing the processed templates. A create template looks like this:

Create-шаблон world

# Calculate name=world format=world

#?in(os_linux_pkglist, calculate)!=#
media-fonts/terminus-font
sys-apps/busybox
sys-apps/calculate-toolkit
#sys-apps/ifplugd
sys-apps/less

The Templates page explains how templates build system files.

Software compilation

For each package being installed, Portage creates a separate build directory inside the temporary directory set by the PORTAGE_TMPDIR variable; in Calculate Linux this is /var/calculate/tmp. The command output shows the actual temporary path values on your system:

emerge --info

By default, Portage installs all files into the current filesystem, but you can change the installation root with the ROOT variable - this is useful when building new system images.

Logging

Portage writes its work logs to the /var/log/portage directory: it holds the summary.log file and the elog/ subdirectory; the PORT_LOGDIR variable is not set by default.

You configure logging with the variables described in the make.conf man page:

  • PORTAGE_ELOG_CLASSES
  • PORTAGE_ELOG_COMMAND
  • PORTAGE_ELOG_MAILFROM
  • PORTAGE_ELOG_MAILSUBJECT
  • PORTAGE_ELOG_MAILURI

See also