Difference between revisions of "Handbook:Parts/Portage/Variables"
m (Convert old link format to new {{Link}} format) |
(Add improvements from Flexibeast (grammar, improved wording)) |
||
Line 6: | Line 6: | ||
<!--T:4--> | <!--T:4--> | ||
− | As noted previously, Portage is configurable through | + | As noted previously, Portage is configurable through variables in {{Path|/etc/portage/make.conf}} or one of the subdirectories of {{Path|/etc/portage/}}. Please refer to the man pages for <code>make.conf</code> and <code>portage</code> for more information: |
<!--T:5--> | <!--T:5--> | ||
Line 22: | Line 22: | ||
; <var>CFLAGS</var> and <var>CXXFLAGS</var>: Define the desired compiler flags for C and C++ compiling. | ; <var>CFLAGS</var> and <var>CXXFLAGS</var>: Define the desired compiler flags for C and C++ compiling. | ||
; <var>CHOST</var>: Defines the build host information for the application's configure script | ; <var>CHOST</var>: Defines the build host information for the application's configure script | ||
− | ; <var>MAKEOPTS</var>: Passed to the make command and | + | ; <var>MAKEOPTS</var>: Passed to the {{c|make}} command and usually set to define the amount of parallelism used during the compilation. Information about options for {{c|make}} can be found in the {{Man|make|1}} man page. |
<!--T:9--> | <!--T:9--> | ||
− | The <var>USE</var> variable is also used during configure and | + | The <var>USE</var> variable is also used during configure and compilation; refer to previous chapters of this Handbook for details. |
=== {{Anchor|Merge options}} Merge options === <!--T:10--> | === {{Anchor|Merge options}} Merge options === <!--T:10--> | ||
Line 33: | Line 33: | ||
<!--T:12--> | <!--T:12--> | ||
− | It is possible to tell emerge to use certain options every time it is run by setting <var>EMERGE_DEFAULT_OPTS</var>. Some useful options | + | It is possible to tell emerge to use certain options every time it is run by setting <var>EMERGE_DEFAULT_OPTS</var>. Some useful options include <code>--ask</code>, <code>--verbose</code>, and <code>--tree</code>. |
== {{Anchor|Configuration file protection}} Configuration file protection == <!--T:13--> | == {{Anchor|Configuration file protection}} Configuration file protection == <!--T:13--> | ||
Line 43: | Line 43: | ||
<!--T:16--> | <!--T:16--> | ||
− | A file that would be written in such a protected location is renamed and the user is warned about the presence of a newer version of the ( | + | A file that would be written in such a protected location is renamed and the user is warned about the presence of a newer version of the (proposed) configuration file. |
<!--T:17--> | <!--T:17--> | ||
Line 52: | Line 52: | ||
<!--T:19--> | <!--T:19--> | ||
− | More information about Portage's configuration file protection is available in the CONFIGURATION FILES section of the emerge | + | More information about Portage's configuration file protection is available in the CONFIGURATION FILES section of the {{c|emerge}} man page: |
<!--T:20--> | <!--T:20--> | ||
Line 60: | Line 60: | ||
<!--T:22--> | <!--T:22--> | ||
− | To 'unprotect' certain subdirectories of protected locations | + | To 'unprotect' certain subdirectories of protected locations, use the <var>CONFIG_PROTECT_MASK</var> variable. |
== {{Anchor|Download options}} Download options == <!--T:23--> | == {{Anchor|Download options}} Download options == <!--T:23--> | ||
Line 81: | Line 81: | ||
<!--T:27--> | <!--T:27--> | ||
− | The <var>GENTOO_MIRRORS</var>, <var>sync-type</var>, and <var>sync-uri</var> variables can be set automatically through the {{c|mirrorselect}} application | + | The <var>GENTOO_MIRRORS</var>, <var>sync-type</var>, and <var>sync-uri</var> variables can be set automatically through the {{c|mirrorselect}} application, provided by the {{Package|app-portage/mirrorselect}} package. For more information, refer to {{c|mirrorselect}}'s online help: |
<!--T:28--> | <!--T:28--> | ||
Line 92: | Line 92: | ||
<!--T:31--> | <!--T:31--> | ||
− | When Portage needs to fetch source code, it uses wget by default. This can be changed through the <var>FETCHCOMMAND</var> variable. | + | When Portage needs to fetch source code, it uses {{Man|wget|1}} by default. This can be changed through the <var>FETCHCOMMAND</var> variable. |
<!--T:32--> | <!--T:32--> | ||
− | Portage is able to resume partially downloaded source code. It uses wget by default, but this can be altered through the <var>RESUMECOMMAND</var> variable. | + | Portage is able to resume partially downloaded source code. It uses {{Man|wget|1}} by default, but this can be altered through the <var>RESUMECOMMAND</var> variable. |
<!--T:33--> | <!--T:33--> | ||
− | Make sure that the <var>FETCHCOMMAND</var> and <var>RESUMECOMMAND</var> store the source code in the correct location. Inside the variables the | + | Make sure that the <var>FETCHCOMMAND</var> and <var>RESUMECOMMAND</var> store the source code in the correct location. Inside the variables the <var>URI</var> and <var>DISTDIR</var> variables can be used to point to the source code location and distfiles location, respectively. |
<!--T:34--> | <!--T:34--> | ||
Line 106: | Line 106: | ||
<!--T:36--> | <!--T:36--> | ||
− | It is not possible to alter the rsync command used by Portage to update the Gentoo repository, but it is possible to set some variables related to the rsync command: | + | It is not possible to alter the rsync command used by Portage to update the Gentoo repository, but it is possible to set some variables related to the {{c|rsync}} command: |
<!--T:37--> | <!--T:37--> | ||
Line 123: | Line 123: | ||
<!--T:40--> | <!--T:40--> | ||
− | For more information on these options and others, please | + | For more information on these options and others, please refer to the {{Man|rsync|1}} man page. |
== {{Anchor|Gentoo configuration}} Gentoo configuration == <!--T:41--> | == {{Anchor|Gentoo configuration}} Gentoo configuration == <!--T:41--> | ||
Line 135: | Line 135: | ||
<!--T:45--> | <!--T:45--> | ||
− | It is possible to activate certain | + | It is possible to activate certain Portage features through the <var>FEATURES</var> variable. The Portage features have been discussed in previous chapters. |
== {{Anchor|Portage behavior}} Portage behavior == <!--T:46--> | == {{Anchor|Portage behavior}} Portage behavior == <!--T:46--> | ||
Line 145: | Line 145: | ||
<!--T:49--> | <!--T:49--> | ||
− | For more information about nice values, | + | For more information about nice values, refer to the {{Link|Portage niceness}} page and the {{Man|nice|1}} man page: |
<!--T:50--> | <!--T:50--> | ||
Line 153: | Line 153: | ||
<!--T:52--> | <!--T:52--> | ||
− | The <var>NOCOLOR</var> variable, which defaults to | + | The <var>NOCOLOR</var> variable, which defaults to false, determines whether Portage should disable the use of colored output. |
<!--T:55--> | <!--T:55--> |
Latest revision as of 17:12, 19 October 2024
Readers should not try to follow instructions directly from the Handbook:Parts namespace (which is THIS page!). The sections displayed below are used as a skeleton for transcluding information into the computer architecture specific handbooks and are therefore lacking critical information.
Please visit the Handbook list to read instructions for a relevant computer architecture.
Portage configuration
As noted previously, Portage is configurable through variables in /etc/portage/make.conf or one of the subdirectories of /etc/portage/. Please refer to the man pages for make.conf
and portage
for more information:
user $
man make.conf
user $
man portage
Build-specific options
Configure and compiler options
When Portage builds applications, it passes the contents of the following variables to the compiler and configure script:
- CFLAGS and CXXFLAGS
- Define the desired compiler flags for C and C++ compiling.
- CHOST
- Defines the build host information for the application's configure script
- MAKEOPTS
- Passed to the make command and usually set to define the amount of parallelism used during the compilation. Information about options for make can be found in the make(1) man page.
The USE variable is also used during configure and compilation; refer to previous chapters of this Handbook for details.
Merge options
When Portage has merged a newer version of a certain software title, it will remove the obsoleted files of the older version from the system. Portage gives the user a 5 second delay before unmerging the older version. These 5 seconds are defined by the CLEAN_DELAY variable.
It is possible to tell emerge to use certain options every time it is run by setting EMERGE_DEFAULT_OPTS. Some useful options include --ask
, --verbose
, and --tree
.
Configuration file protection
Portage protected locations
Portage overwrites files provided by newer versions of a software title if the files aren't stored in a protected location. These protected locations are defined by the CONFIG_PROTECT variable and are generally configuration file locations. The directory listing is space-delimited.
A file that would be written in such a protected location is renamed and the user is warned about the presence of a newer version of the (proposed) configuration file.
To find out about the current CONFIG_PROTECT setting, use the emerge --info output:
user $
emerge --info | grep 'CONFIG_PROTECT='
More information about Portage's configuration file protection is available in the CONFIGURATION FILES section of the emerge man page:
user $
man emerge
Excluding directories
To 'unprotect' certain subdirectories of protected locations, use the CONFIG_PROTECT_MASK variable.
Download options
Server locations
When the requested information or data is not available on the system, Portage will retrieve it from the Internet. The server locations for the various information and data channels are defined by the following variables:
- GENTOO_MIRRORS
- Defines a list of server locations which contain source code (distfiles).
- PORTAGE_BINHOST
- Defines a particular server location containing prebuilt packages for the system.
A third setting involves the location of the rsync server which users use to update their local Gentoo repository. This is defined in the /etc/portage/repos.conf file (or a file inside that directory if it is defined as a directory):
- sync-type
- Defines the type of server and defaults to
rsync
. - sync-uri
- Defines a particular server which Portage uses to fetch the Gentoo repository.
The GENTOO_MIRRORS, sync-type, and sync-uri variables can be set automatically through the mirrorselect application, provided by the app-portage/mirrorselect package. For more information, refer to mirrorselect's online help:
root #
mirrorselect --help
If the environment requires the use of a proxy server, then the http_proxy, ftp_proxy, and RSYNC_PROXY variables can be declared.
Fetch commands
When Portage needs to fetch source code, it uses wget(1) by default. This can be changed through the FETCHCOMMAND variable.
Portage is able to resume partially downloaded source code. It uses wget(1) by default, but this can be altered through the RESUMECOMMAND variable.
Make sure that the FETCHCOMMAND and RESUMECOMMAND store the source code in the correct location. Inside the variables the URI and DISTDIR variables can be used to point to the source code location and distfiles location, respectively.
It is also possible to define protocol-specific handlers with FETCHCOMMAND_HTTP, FETCHCOMMAND_FTP, RESUMECOMMAND_HTTP, RESUMECOMMAND_FTP, and so on.
Rsync settings
It is not possible to alter the rsync command used by Portage to update the Gentoo repository, but it is possible to set some variables related to the rsync command:
- PORTAGE_RSYNC_OPTS
- Sets a number of default variables used during sync, each space-separated. These shouldn't be changed unless you know exactly what you're doing. Note that certain absolutely required options will always be used even if PORTAGE_RSYNC_OPTS is empty.
- PORTAGE_RSYNC_EXTRA_OPTS
- Used to set additional options when syncing. Each option should be space separated:
--timeout=<number>
- This defines the number of seconds an rsync connection can idle before rsync sees the connection as timed-out. This variable defaults to
180
but dialup users or individuals with slow computers might want to set this to300
or higher. --exclude-from=/etc/portage/rsync_excludes
- This points to a file listing the packages and/or categories rsync should ignore during the update process. In this case, it points to /etc/portage/rsync_excludes.
--quiet
- Reduces output to the screen.
--verbose
- Prints a complete filelist.
--progress
- Displays a progress meter for each file.
- PORTAGE_RSYNC_RETRIES
- Defines how many times rsync should try connecting to the mirror pointed to by the SYNC variable before bailing out. This variable defaults to
3
.
For more information on these options and others, please refer to the rsync(1) man page.
Gentoo configuration
Branch selection
It is possible to change the default branch with the ACCEPT_KEYWORDS variable. It defaults to the architecture's stable branch. More information on Gentoo's branches can be found in the next chapter.
Portage features
It is possible to activate certain Portage features through the FEATURES variable. The Portage features have been discussed in previous chapters.
Portage behavior
Resource management
With the PORTAGE_NICENESS variable users can augment or reduce the nice value Portage will use while running. The PORTAGE_NICENESS value is added to the current nice value of Portage.
For more information about nice values, refer to the Portage niceness page and the nice(1) man page:
user $
man nice
Output behavior
The NOCOLOR variable, which defaults to false, determines whether Portage should disable the use of colored output.