- Working with ebuild
- Manual installation
- Source code and checksums
- Extract sources
- Compile from source
- Move files to temporary location
- Move files to actual filesystem
- Clean temporary files
- Go even further with ebuild
- All installation commands
- Configuration
- RPM compilation
- creating a binary package, compatible with Portage:
- creating an RPM package:
- Getting more info
- 5. Установка и удаление программ¶
- Поиск программ¶
- Установка и удаление¶
- Размаскировка программ¶
- 1. Проверим доступные версии¶
- 2. Размаскируем устанавливаемые пакеты с зависимостями¶
- Files and directories
- Profile-specific configuration
- User-specific configuration
- Editing Portage files and modifying locations
- File storage
- Portage tree
- Binary packages
- Source code
- RPM files
- Portage database
- Portage cache
- Software compilation
- Portage temporary files
- Compilation directory
- Locating the live filesystem
- Logging
- Ebuild log
Working with ebuild
The ebuild program is a low-level interface of Portage. With it you can perform certain actions on ebuilds. For instance, you can perform some installation steps manually.
ebuild is a tool intended mainly for developers. More detailed information can be found in [the developer’s handbook] (http://www.gentoo.org/proj/en/devrel/handbook/handbook.xml). However, we will explain which ebuild instances are called by Portage at different stages of installation and how to do post-configuration actions, supported by some packages.
Manual installation
Source code and checksums
Whenever you call the ebuild command for an ebuild file, the checksums of all the relevant files is checked to see if they match the checksums of the files specified in or the file. The check is performed after downloading the sources.
To fetch source code with ebuild , run:
ebuild path/to/file-ebuild fetch
If the md5 checksum does not match the one specified in the file, or one of the uploaded files does not match the description in +, you will get an error message similar to this one:
. File is corrupt or incomplete. (Digests do not match) >>> our recorded digest: db20421ce35e8e54346e3ef19e60e4ee >>> your file's digest: f10392b7c0b2bbc463ad09642606a7d6
The next line highlights the defective file.
If you are absolutely sure that the downloaded source code and the ebuild file itself are exactly what you need, you can rebuild the and files with the digest function of ebuild . Here is how Manifest and digest are created:
ebuild path/to/file-ebuild digestra
Extract sources
To unpack the source code to @/var/tmp/portage@ (or any other directory specified in make_conf), use the unpack function of . Here is how to extract source code:
ebuild path/to/file-ebuild unpack>
This command will execute the src_unpack() function of ebuild (which by default simply unpacks a file if the src_unpack() function has not been defined). That is when all necessary patches are applied, too.
Compile from source
The next step is compilation. To compile, the src_compile() function of your ebuild will be used. Setup will be done too, if necessary. Here is how to compile:
ebuild path/to/file-ebuild compile
If you want to modify compilation instructions, we recommend that you edit the src_compile() function. But you can also trick Portage into believing that ebuild has already completed the compilation process. Run the required commands manually and create an empty file in the operating directory:
Move files to temporary location
At the next step, you must put collect all necessary files in a temporary directory. It will contain all files to be integrated in the operating filesystem. You can accomplish this step by running the > installation function, which calls the src_install() function of the ebuild:
ebuild path/to/file-ebuild install
Move files to actual filesystem
The last step is to move all files to the operating file system and to register them with Portage. In ebuild , this step is called . It includes the following actions:
- if applies, the pkg_preinst() function is called
- all files are copied to the operating filesystem
- and registered in Portage
- if applies, the pkg_postinst() function is called
Run the qmerge function of ebuild to complete this step:
ebuild path/to/file-ebuild qmerge
Clean temporary files
You can remove temporary data with the function of ebuild :
ebuild path/to/file-ebuild clean
Go even further with ebuild
All installation commands
The merge function of ebuild allows you to extract, unpack, compile, install and locate at once:
ebuild path/to/file-ebuild merge
Configuration
Some applications provide instructions on how to further configure the installed package. Applying these instructions may require the user to be involved and, therefore, not be automatic. To initiate the configuration process, as specified in the optional config() function of the ebuild, use the ‘config’ command of ebuild . Here is an example of configuration:
ebuild path/to/file-ebuild config
RPM compilation
You can ask Portage to create a binary package or even an RPM from your ebuild, using the and commands respectively. These two commands are somewhat different.
- the command is similar to ‘merge’ in many ways, performing all the necessary steps (extraction, unpacking, compilation, installation) before actually creating a package
- the command builds an RPM package from the files created after the ebuild function has completed
creating a binary package, compatible with Portage:
ebuild path/to/file-ebuild package
creating an RPM package:
ebuild path/to/file-ebuild rpm
However, the resulting RPM will not contain any information on dependencies that are found in the ebuild file.
Getting more info
For more details about Portage, the ebuild tool and ebuild scripts, please browse the following man pages:
- man portage — (Portage itself)
- man emerge — (the emerge command)
- man ebuild — (the ebuild command)
- man 5 ebuild — (ebuild file syntax)
5. Установка и удаление программ¶
Перед установкой программ обновите локальный репозиторий пакетов. Обновлять репозиторий следует не чаще 1 раза в день.
Для обновления достаточно выполнить с правами пользователя root команду:
Программа обновит дерево портежей, оверлей Calculate, а затем синхронизирует свой локальный кэш, используемый при поиске программ.
Поиск программ¶
В программу emerge включен инструмент поиска программ, однако вы можете воспользоваться более быстрым инструментом — программой eix .
В первом случае поиск производится по названию пакета, во втором — по описанию.
Установка и удаление¶
Установка и удаление программ производится при помощи программы emerge. При установке новой программы сначала определяется необходимость в установке дополнительных пакетов (зависимостей), а затем скачиваются и компилируются исходные тексты. Помните, что для установки программ вам потребуется наличие интернета и некоторое время для компиляции. Программы, требующие значительного времени для компиляции (например, LibreOffice), распространяются в виде готовых к установке бинарных пакетов; их можно опознать по суффиксу «-bin».
Пример установки игры «Цивилизация» и бинарного LibreOffice:
emerge -bk games-strategy/freeciv emerge libreoffice-bin
Параметры -bk создают локальный архив скомпилированного пакета, а при его наличии программа устанавливается из этого архива, минуя стадию компиляции. Инструкцию по работе с программой emerge можно прочесть здесь.
Пример удаления игры «Цивилизация»:
emerge -cv games-strategy/freeciv
Переменные DISTDIR и PKGDIR указывают путь к локальным папкам, в которых сохраняются исходные тексты программ и откомпилированные пакеты. Посмотреть значения этих (и многих других) переменных, используемых emerge , можно с помощью команды
Размаскировка программ¶
Как правило, портежи содержат несколько версий программы, часть из которых отмечены как нестабильные. Нестабильная версия вовсе не означает, что она нестабильно работает — просто на данный момент эта версия не прошла достаточного тестирования. Вы можете установить как стабильную, так и нестабильную версию программы.
Для установки нестабильных программ их нужно предварительно размаскировать. Для примера установим нестабильный на данный момент Firefox 22.0.
1. Проверим доступные версии¶
eix firefox www-client/firefox Available versions: *10.0.11 17.0.5 17.0.6 17.0.7 ~21.0 ~22.0 .
2. Размаскируем устанавливаемые пакеты с зависимостями¶
Удостоверьтесь, что директория /etc/portage/package.keywords/ не пустая, иначе выполните:
touch /etc/portage/package./custom
emerge --autounmask-write =www-client/firefox-22.0
Нажмите «u» для подтверждения внесенных изменений.
Files and directories
By default, Portage settings are stored in . If you open this file, you will see that all of them are variables. Each variable will be explained later.
As many directives are architecture-specific, Portage comes with default settings included in your profile. The symlink points to your profile. Portage can be configured via the files of your profile and those of all parent profiles. We will talk more about profiles and /etc/portage/make.profile later on.
You will also find the file, where cl-update stores the settings of the binary package repo, as well as , where the descriptions of the overlays enabled with layman are imported to.
Portage variables can also be used as environment variables, but we do not recommend it.
Profile-specific configuration
Do you remember the directory? In fact, this is not a directory, but a symbolic link to a profile, by default the one contained in . However, you can create your own profiles anywhere, provided you specify the links to them. The profile the link points to is your system’s profile.
A profile contains architecture-specific information for Portage, such as the list of packages in the system, the list of broken (or masked) packages, etc.
User-specific configuration
If you need to change Portage’s behavior regarding software installation, you will need to edit files in . We strongly recommend editing files from to reconfigure Portage. Please do not attempt doing it using environment variables.
The subdirectories available in are:
- stores files listing packages that Portage should never install;
- stores files listing the packages you want to be able to install, even if the Gentoo developers do not recommend it;
- , that stores the files listing packages available for installation, even though they are not recommended for your system or architecture (yet);
- , that stores the files listing package-specific USE values, instead of global ones.
For more information about the directory, as well as the files you can create there, see the Portage man page man portage .
Editing Portage files and modifying locations
The above-mentioned configuration files may not be stored anywhere else, as Portage always searches for its configuration files where they belong. Yet Portage also uses quite a few other directories for various purposes: compilation, source code storage, Portage tree storage, etc.
There are default directories that can be modified to your liking by editing . The rest of this chapter is about the dedicated locations Portage uses for its purposes, and how to modify them.
Note that this manual does not reproduce the official documentation. If you need full info, please refer to Portage and man pages ( man portage and man make.conf respectively).
File storage
Portage tree
By default, the Portage tree is stored in . This is defined by the value. If you store the Portage tree somewhere else (by editing this variable), remember to modify the symlink, accordingly.
If you edit , you may also need to edit the following variables: , , since they do not register any + modifications. It has to do with how Portage handles them.
Binary packages
Though Portage does not use precompiled packages by default, they are well supported. If you tell Portage to work with precompiled packages, it will look for them in . This location is defined by the variable.
Source code
By default, all source code is saved in . This location is defined by the variable.
RPM files
Even though Portage cannot use RPM files, it can still create them via the command (see Working with ebuild). By default, Portage stores RPM files in the directory, as defined by .
Portage database
Portage keeps track of the state of your system (packages installed, files relating to specific packages, etc.) in . Do not edit those files manually! It could disorient Portage completely.
Portage cache
The Portage cache (including last modification time, virtual packages, dependency data, etc.) is stored in . This location is indeed a cache: you can clear it at any time when Portage-related utilities are not running.
Software compilation
Portage temporary files
By default, Portage stores temporary files in . This behaviour is defined by the variable.
If you edit the value, you may have to modify accordingly, since it does not see modifications. This is due to how it is processed by Portage.
Compilation directory
Portage creates package-specific build directories in . It is defined by the value.
Locating the live filesystem
By default, Portage installs all files in the current file system (/), but this can be modified by editing the environment variable. It can be useful when creating a customized ISO.
Logging
Ebuild log
Portage can create ebuild-specific log files, but only if provides a location where Portage (user ‘portage’) is allowed to write to. This variable is not set by default.