Difference between revisions of "Handbook:Parts/Portage/CustomTree"

From Gentoo Wiki
Jump to:navigation Jump to:search
(Marked this version for translation)
(Implement suggested changes from Flexibeast (grammar, improved wording, move eselect repository above manual creation))
 
Line 8: Line 8:
  
 
<!--T:5-->
 
<!--T:5-->
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 {{c|emerge --sync}} step.
+
It is possible to selectively update certain categories/packages and ignore other categories/packages. This can be achieved by having rsync exclude categories/packages during the {{c|emerge --sync}} step.
  
 
<!--T:44-->
 
<!--T:44-->
{{Warning|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 <code>rsync-verify</code> USE flag on the {{Package|sys-apps/portage}} package or set <code>sync-rsync-verify-metamanifest{{=}}no</code> (see {{c|man 5 portage}}) in the {{Path|repos.conf}} entry of the Gentoo ebuild repository.}}
+
{{Warning|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 <code>rsync-verify</code> USE flag on the {{Package|sys-apps/portage}} package or set <code>sync-rsync-verify-metamanifest{{=}}no</code> (cf. the portage(5) man page) in the {{Path|/etc/portage/repos.conf/gentoo.conf}} file, which configures the Gentoo ebuild repository.}}
  
 
<!--T:6-->
 
<!--T:6-->
Line 27: Line 27:
  
 
<!--T:9-->
 
<!--T:9-->
{{Warning|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.}}
+
{{Warning|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 unsupported; proceed with this risk in mind.}}
  
 
== {{Anchor|Adding unofficial ebuilds}} Adding unofficial ebuilds == <!--T:10-->
 
== {{Anchor|Adding unofficial ebuilds}} Adding unofficial ebuilds == <!--T:10-->
Line 33: Line 33:
 
=== {{Anchor|Defining a custom ebuild repository}} {{Anchor|Creating a custom ebuild repository}} Creating a custom ebuild repository === <!--T:11-->
 
=== {{Anchor|Defining a custom ebuild repository}} {{Anchor|Creating a custom ebuild repository}} Creating a custom ebuild repository === <!--T:11-->
  
==== {{Anchor|Manual creation}} Manual creation ==== <!--T:46-->
+
==== {{Anchor|Creating a repo using eselect repository}} Creating a repo using eselect repository ==== <!--T:47-->
 +
 
 +
<!--T:48-->
 +
Alternatively, a custom ebuild repository can be quickly created using the eselect repository module (from {{Package|app-eselect/eselect-repository}}). In the following example, substitute <code>localrepo</code> with a name of choice:
 +
 
 +
<!--T:49-->
 +
{{RootCmd|eselect repository create localrepo|output=<pre>
 +
Adding localrepo to /etc/portage/repos.conf/eselect-repo.conf ...
 +
Repository <ebuild_repository_name> created and added
 +
</pre>}}
 +
 
 +
<!--T:50-->
 +
A bare repository named "localrepo" will be made available at {{Path|/var/db/repos/localrepo}}.
 +
 
 +
==== {{Anchor|Alternative: Manual creation}} Alternative: Manual creation ==== <!--T:46-->
  
 
<!--T:12-->
 
<!--T:12-->
Line 73: Line 87:
 
location = /var/db/repos/localrepo
 
location = /var/db/repos/localrepo
 
}}
 
}}
 
==== {{Anchor|Optional: Creating a repo using eselect repository}} Optional: Creating a repo using eselect repository ==== <!--T:47-->
 
 
<!--T:48-->
 
Alternatively, a custom ebuild repository can be quickly created using the eselect repository module (from {{Package|app-eselect/eselect-repository}}). In the following example, substitute <code>localrepo</code> with a name of choice:
 
 
<!--T:49-->
 
{{RootCmd|eselect repository create localrepo|output=<pre>
 
Adding localrepo to /etc/portage/repos.conf/eselect-repo.conf ...
 
Repository <ebuild_repository_name> created and added
 
</pre>}}
 
 
<!--T:50-->
 
A bare repository named "localrepo" will be made available at {{Path|/var/db/repos/localrepo}}.
 
  
 
=== {{Anchor|Working with multiple repositories}} Working with multiple repositories === <!--T:14-->
 
=== {{Anchor|Working with multiple repositories}} Working with multiple repositories === <!--T:14-->
  
 
<!--T:45-->
 
<!--T:45-->
For those desiring to develop several ebuild repos, test packages before they hit the Gentoo repository, or who want to use unofficial ebuilds from various sources, the {{Package|app-eselect/eselect-repository}} package also provides tooling to aid in keeping repositories up to date. See also {{Link|Eselect/Repository|eselect repository article}}.
+
For those wishing to develop several ebuild repos, test packages before they hit the Gentoo repository, or who want to use unofficial ebuilds from various sources, {{Package|app-eselect/eselect-repository}} also provides tooling to aid in keeping repositories up to date. For details, refer to the {{Link|Eselect/Repository}} page.
  
 
==== {{Anchor|Adding a repo using eselect repository}} Adding a repo using eselect repository ==== <!--T:39-->
 
==== {{Anchor|Adding a repo using eselect repository}} Adding a repo using eselect repository ==== <!--T:39-->
Line 102: Line 102:
  
 
<!--T:43-->
 
<!--T:43-->
Updating of repositories added with this methods will occur automatically on each sync: {{Emerge|--sync|params=}}
+
Updating of repositories added with this method will occur automatically on each sync: {{Emerge|--sync|params=}}
  
 
== {{Anchor|Non-Portage maintained software}} Non-Portage maintained software == <!--T:22-->
 
== {{Anchor|Non-Portage maintained software}} Non-Portage maintained software == <!--T:22-->
Line 109: Line 109:
  
 
<!--T:24-->
 
<!--T:24-->
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 packages like 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 {{Path|/etc/portage/profile/package.provided}} file.
+
Sometimes users want to configure, install, and maintain software individually without having Portage automate the process, even though Portage can provide the software. Known cases are packages like 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 {{Path|/etc/portage/profile/package.provided}} file.
  
 
<!--T:25-->
 
<!--T:25-->

Latest revision as of 22:57, 18 October 2024


Warning
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.
Parts Handbook
Installation
About the installation
Choosing the media
Configuring the network
Preparing the disks
The stage file
Installing base system
Configuring the kernel
Configuring the system
Installing tools
Configuring the bootloader
Finalizing
Working with Gentoo
Portage introduction
USE flags
Portage features
Initscript system
Environment variables
Working with Portage
Files and directories
Variables
Mixing software branches
Additional tools
Custom package repository
Advanced features
OpenRC network configuration
Getting started
Advanced configuration
Modular networking
Wireless
Adding functionality
Dynamic management


Using a subset of the Gentoo repository

Excluding packages and categories

It is possible to selectively update certain categories/packages and ignore other categories/packages. This can be achieved by having rsync exclude categories/packages during the emerge --sync step.

Warning
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 (cf. the portage(5) man page) in the /etc/portage/repos.conf/gentoo.conf file, which configures 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:

FILE /etc/portage/make.confDefining the exclude file
PORTAGE_RSYNC_EXTRA_OPTS="--exclude-from=/etc/portage/rsync_excludes"
FILE /etc/portage/rsync_excludesExcluding all games
games-*/*
Warning
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 unsupported; proceed with this risk in mind.

Adding unofficial ebuilds

Creating a custom ebuild repository

Creating a repo using eselect repository

Alternatively, a custom ebuild repository can be quickly created using the eselect repository module (from app-eselect/eselect-repository). In the following example, substitute localrepo with a name of choice:

root #eselect repository create localrepo
Adding localrepo to /etc/portage/repos.conf/eselect-repo.conf ...
Repository <ebuild_repository_name> created and added

A bare repository named "localrepo" will be made available at /var/db/repos/localrepo.

Alternative: Manual creation

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

Then define the EAPI used for the profiles within the repository:

root #echo '8' > /var/db/repos/localrepo/profiles/eapi

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):

FILE /var/db/repos/localrepo/metadata/layout.conf
masters = gentoo
auto-sync = false
thin-manifests = true
sign-manifests = 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:

FILE /etc/portage/repos.conf/localrepo.conf
[localrepo]
location = /var/db/repos/localrepo

Working with multiple repositories

For those wishing to develop several ebuild repos, test packages before they hit the Gentoo repository, or who want to use unofficial ebuilds from various sources, app-eselect/eselect-repository also provides tooling to aid in keeping repositories up to date. For details, refer to the Eselect/Repository page.

Adding a repo using eselect repository

For instance, to enable the GURU repository:

root #eselect repository enable guru

Updating of repositories added with this method will occur automatically on each sync:

root #emerge --sync

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. Known cases are packages like 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:

FILE /etc/portage/profile/package.providedMarking gentoo-sources-6.6.21 as manually installed
sys-kernel/gentoo-sources-6.6.21
Note
This is a file that uses versions without an = operator.