Difference between revisions of "Handbook:Parts/Portage/CustomTree"
Maffblaster (talk | contribs) (Make warnings more explicit about excluding parts of the Gentoo ebuild repo. Slightly adjust formatting per wiki Guidelines.) |
Maffblaster (talk | contribs) (Add link to the Layman article. Better define the man page.) |
||
Line 86: | Line 86: | ||
==== Layman ==== <!--T:16--> | ==== Layman ==== <!--T:16--> | ||
− | First install and configure {{c|layman}} as shown in the [[Project:Overlays/Overlays_guide|Overlays | + | |
+ | First install and configure {{c|layman}} as shown in the [[Project:Overlays/Overlays_guide|Overlays user guide]], and add the desired repositories with {{c|layman -a}}. | ||
<!--T:17--> | <!--T:17--> | ||
Line 101: | Line 102: | ||
<!--T:21--> | <!--T:21--> | ||
− | For more information on working with overlays, please read {{c|man layman}} and | + | For more information on working with overlays, please read {{c|man 8 layman}}, review the [[Layman|Layman article]], and see previously linked overlay user guide. |
== Non-Portage maintained software == <!--T:22--> | == Non-Portage maintained software == <!--T:22--> |
Revision as of 18:26, 27 October 2021
Using a subset of the Gentoo repository
Excluding packages and categories
It is possible to selectively update certain categories/packages and ignore the other categories/packages. This can be achieved by having rsync exclude categories/packages during the emerge --sync step.
In order for this method to work, manifest verification must be disabled. This will reduce the security of the repo. To disable the verification, either disable the
rsync-verify
USE flag on the sys-apps/portage package or set sync-rsync-verify-metamanifest=no
(see man 5 portage) in the repos.conf entry of the Gentoo ebuild repository.Define the name of the file that contains the exclude patterns in the PORTAGE_RSYNC_EXTRA_OPTS variable in /etc/portage/make.conf:
/etc/portage/make.conf
Defining the exclude filePORTAGE_RSYNC_EXTRA_OPTS="--exclude-from=/etc/portage/rsync_excludes"
/etc/portage/rsync_excludes
Excluding all gamesgames-*/*
Excluding parts of ebuild repositories, especially the Gentoo ebuild repo, may lead to dependency issues! New, allowed packages might depend on new but excluded packages. Exclusions are unsupportable, proceed with this risk in mind.
Adding unofficial ebuilds
Defining a custom ebuild repository
It is possible to instruct Portage to use ebuilds that are not officially available through the Gentoo ebuild repository. In order to do so, create a new directory (for instance /var/db/repos/localrepo) in which to store the 3rd party ebuilds. This new repository will require the same directory structure as the official Gentoo repository.
root #
mkdir -p /var/db/repos/localrepo/{metadata,profiles}
root #
chown -R portage:portage /var/db/repos/localrepo
Next, pick a sensible name for the repository. The next example uses "localrepo" as the name:
root #
echo 'localrepo' > /var/db/repos/localrepo/profiles/repo_name
Tell Portage that the repository master is the main Gentoo ebuild repo, and that the local repository should not be automatically synchronized (as it is not backed by an external source such as an rsync server, git mirror, or other repository type):
/var/db/repos/localrepo/metadata/layout.conf
masters = gentoo
auto-sync = false
Finally, enable the repository on the local system by creating a repository configuration file inside /etc/portage/repos.conf. This will inform Portage of where the custom local repository can be found:
/etc/portage/repos.conf/localrepo.conf
[localrepo]
location = /var/db/repos/localrepo
Working with several overlays
For the power users who develop on several overlays, test packages before they hit the Gentoo repository or just want to use unofficial ebuilds from various sources, the app-portage/layman package brings layman, a tool to help users keep the overlay repositories up to date.
Alternatively, install app-eselect/eselect-repository to utilize the native synchronization in Portage. See also Eselect/Repository
eselect-repository
Adding repositories is simple with the eselect module (available via app-eselect/eselect-repository):
For instance, to enable the hardened-development overlay:
root #
eselect repository enable hardened-development
Updating of overlays added with this methods happens naturally with:
root #
emerge --sync
Layman
First install and configure layman as shown in the Overlays user guide, and add the desired repositories with layman -a.
For instance, to enable the hardened-development overlay:
root #
layman -a hardened-development
Regardless of how many repositories are used through layman, all the repositories can be updated with the following command:
root #
layman -S
For more information on working with overlays, please read man 8 layman, review the Layman article, and see previously linked overlay user guide.
Non-Portage maintained software
Using Portage with self-maintained software
Sometimes users want to configure, install and maintain software individually without having Portage automate the process, even though Portage can provide the software titles. Known cases are kernel sources and Nvidia drivers. It is possible to configure Portage so it knows that a certain package is manually installed on the system (and thus take this information into account when calculating dependencies). This process is called injecting and is supported by Portage through the /etc/portage/profile/package.provided file.
For instance, to inform Portage about gentoo-sources-6.6.21 which has been installed manually, add the following line to /etc/portage/profile/package.provided:
/etc/portage/profile/package.provided
Marking gentoo-sources-6.6.21 as manually installedsys-kernel/gentoo-sources-6.6.21
This is a file that uses versions without an
=
operator.