Portage/ja
emerge — configuration — ebuild repository — dispatch-conf
world file — USE flags — ebuilds — profiles
upgrades — using testing packages — binary packages
tools — gentoolkit — eselect
Portage FAQ — cheat sheet — FAQ
all articles
Portage はとても高度なパッケージマネージャであり、ユーザの望みを最大限尊重して取り扱います。見方によってはユーザに過大な信頼を置いているとも言えますが、この記事よりも Portage Help を見たほうがいいかもしれません。
Portage は Gentoo のための公式の パッケージマネージャ であり、 ディストリビューションシステム です。依存関係の解決、ソースまたは バイナリパッケージ からの柔軟なビルドとインストール、およびディストリビューションの核となる多くの機能を提供し、Gentoo ベースのオペレーティングシステムの心臓部として機能します。
Portage はソフトウェアを Gentoo ebuild リポジトリ 、 追加の ebuild リポジトリ 、またはバイナリホスト (binhost) から支給します。Portage にはリポジトリとパッケージの管理のための多くの コマンド が含まれており、中でも最もよく使われるのが emerge コマンドです。
portage と emerge コマンドについてのよくある質問は、 FAQ と Portage FAQ で回答されています。
完全なユーザドキュメントについては man portage を参照してください。Portage を使ったパッケージのインストール・保守についての情報は、 emerge の記事を参照してください。
この記事では、Portage についてユーザとしての観点から記述します。Portage 開発への貢献を考えている方は、 Portage プロジェクトページ を確認すべきです。
インストール
すべての Gentoo システムには Portage が付属しているので、 インストールする必要はありません!
稀ではありますが Portage が破損しているか存在しない場合は、 Portage が破損しているか、存在しない の節を参照してください。
Portage を更新する
Gentoo を最新の状態に保つためには、Portage を最新の状態に保つ必要があります。一般的には、通常の定期的な Gentoo の更新 によって、Portage も問題なく自動的に更新されるでしょう。
Portage への更新は時として、システムの他の部分より先に Portage を更新するのが望ましい状況を発生させることがあります。 Portage を同期 した後、このことを要求するメッセージが表示されるかもしれません:
* An update to portage is available. It is _highly_ recommended * that you update portage now, before any other packages are updated. * To update portage, run 'emerge --oneshot sys-apps/portage' now.
(訳:
* portage への更新が利用可能です。他のパッケージが更新される前に、今、 * portage を更新することが_強く_推奨されます。 * portage を更新するには、今すぐ 'emerge --oneshot sys-apps/portage' を実行してください。
)
言われた通りに、Portage を emerge してください (メッセージがこの例と異なる場合は、コマンドはそれに合わせてください)。
sys-apps/portage
が
world ファイル
に追加されるのを避けるためには、
--oneshot
オプションが重要です
:
root
#
emerge --ask --oneshot sys-apps/portage
Portage の更新に問題がある場合は、 User:Sam/Portage_help/Upgrading_Portage が助けになるかもしれません。
設定
ファイル
メインの Portage の設定は make.conf にありますが、Portage を設定するのに使われるファイルは、主に /etc/portage ディレクトリ内に多数存在します。
完全なドキュメント、特にこのファイル内で設定できる変数の一覧については、 man make.conf を参照してください。
/usr/share/portage/config/make.globals ファイルは、Portage によって読み込まれるデフォルトの設定値を多く含んでいます。これらの値は /etc/portage/make.conf 内で同じ変数名を指定することで上書きできます。
環境変数
環境変数を利用することで、Portage の設定を広範囲に渡って変更することができます。
利用可能な環境変数の情報については、 man make.conf を参照してください。Gentoo の 環境変数を操作するハンドブックセクション も参照してください。
現在設定されているすべての環境変数を確認するには、次を実行してください:
user
$
emerge --info --verbose
/etc/portage/package.env のエントリを利用すると、環境変数をパッケージ単位で設定することもできます。
ebuild リポジトリ
Portage がパッケージを取得するときのデフォルトの取得元である Gentoo ebuild リポジトリ に加えて、例えば以下のような追加の ebuild リポジトリ も利用可能です:
- repos.gentoo.org - コミュニティ、一部は Gentoo の開発者によって貢献されている、リポジトリのリスト
- GURU - Gentoo 開発者からの多少のサポートを受けて、Gentoo ユーザによって共同で保守されている、公式の ebuild リポジトリ
- gpo.zugaina.org - ebuild リポジトリのサードパーティのリスト
ebuild リポジトリの記事には、Portage から利用するために ebuild リポジトリを設定する 方法についての節があります。
利用可能な ebuild をコマンドライン上で検索するには、 emerge --search または eix を使用してください。
Gentoo ebuild リポジトリ の内容は Gentoo 開発者によって書かれたものか、Gentoo 開発者による レビュー を受けたものである一方で、 GURU リポジトリは開発者の見落としを含んでいます。他の ebuild リポジトリも必ずしもそうとは限りません。ebuild リポジトリによっては、脆弱なソフトウェアやひどく壊れたソフトウェアを含んでいたり、理論上は、悪意のあるソフトウェアを含んでいるかもしれません。
バイナリホスト
バイナリホストは /etc/portage/binrepos.conf で設定されます。バイナリホストを設定すると、インストールまたは更新の対象となるパッケージに関して、要求する USE フラグ に対応するパッケージが利用可能である限り、バイナリパッケージの高速なインストールが可能になります。
amd64 および arm64 アーキテクチャのための多数のバイナリパッケージを含む、 公式 Gentoo バイナリホスト があります - セットアップと使用方法についての詳しい情報は、リンク先のガイドを参照してください。
それ以外のバイナリホストを設定するためには、および Portage でのバイナリパッケージの使用に関するさらなる情報については、 バイナリパッケージガイド 。
使い方
Portage にはシステム管理と保守を手助けするさまざまなツールとユーティリティが含まれています。以下の節ではこれらをアルファベット順に列挙します。
archive-conf
archive-conf の用途は、dispatch-conf アーカイブディレクトリ内の設定ファイルを保存することです。多くのユーザーは、このコマンドを実行する必要は 決して ありません。
root
#
archive-conf
Usage: archive-conf /CONFIG/FILE [/CONFIG/FILE...]
dispatch-conf
dispatch-conf ユーティリティは設定ファイルの更新を管理するために利用されます。 dispatch-conf の記事を参照してください。
ebuild
ユーザとして、 パッケージをインストールするために ebuild コマンドを使用しないでください 。 ebuild コマンドは主にパッケージ開発のために提供されているものです。パッケージをインストールするためには emerge コマンドを使用してください。
ebuild はさまざまな ebuild 関数 を実行するための Portage のコマンドです。
使い方とコマンドラインオプションについての概要を見るには:
root
#
ebuild --help
usage: Usage: ebuild <ebuild file> <command> [command] ...
See the ebuild(1) man page for more info
options:
-h, --help show this help message and exit
--force When used together with the digest or manifest command, this option forces regeneration of digests for all distfiles associated
with the current ebuild. Any distfiles that do not already exist in ${DISTDIR} will be automatically fetched.
--color {y,n} enable or disable color output
--debug show debug output
--version show version and exit
--ignore-default-opts
do not use the EBUILD_DEFAULT_OPTS environment variable
--skip-manifest skip all manifest checks
ebuild コマンドに関するさらなる情報については、man ページを確認してください:
user
$
man 1 ebuild
egencache
egencache ツールは、ebuild リポジトリのメタデータ情報のキャッシュを再構築します。さらなる情報については egencache の記事を参照してください。
emaint
パッケージ管理に関連するシステムヘルスチェックとメンテナンスを行います。
リポジトリを同期するために emaint を使う方法については、 リポジトリの同期 を参照してください。詳しい情報は man 1 emaint を参照してください。
user
$
emaint --help
usage: usage: emaint [options] COMMAND
The emaint program provides an interface to system health checks
and maintenance. See the emaint(1) man page for additional
information about the following commands:
Commands:
all Perform all supported commands
binhost Scan and generate metadata indexes for binary packages.
cleanconfmem Check and clean the config tracker list for uninstalled packages.
cleanresume Discard emerge --resume merge lists
logs Check and clean old logs in the PORTAGE_LOGDIR.
merges Scan for failed merges and fix them.
movebin Perform package move updates for binary packages
moveinst Perform package move updates for installed and binary packages.
sync Check repos.conf settings and sync repositories.
world Check and fix problems in the world file.
optional arguments:
-h, --help show this help message and exit
-c, --check Check for problems (a default option for most modules)
-f, --fix Attempt to fix problems (a default option for most modules)
--version show program's version number and exit
-C, --clean Cleans out logs more than 7 days old (cleanlogs only) module-options: -t, -p
-t NUM, --time NUM (cleanlogs only): -t, --time Delete logs older than NUM of days
-p, --pretend (cleanlogs only): -p, --pretend Output logs that would be deleted
-P, --purge Removes the list of previously failed merges. WARNING: Only use this option if you plan on manually fixing them or do not want them re-installed.
-y, --yes (merges submodule only): Do not prompt for emerge invocations
-r REPO, --repo REPO (sync module only): -r, --repo Sync the specified repo
-A, --allrepos (sync module only): -A, --allrepos Sync all repos that have a sync-url defined
-a, --auto (sync module only): -a, --auto Sync auto-sync enabled repos only
--sync-submodule {glsa,news,profiles}
(sync module only): Restrict sync to the specified submodule(s)
emerge
emerge は Portage に対するコマンドラインインターフェースであり、ほとんどのユーザが Portage とやりとりするために使う方法です。
wiki 上のさらなる情報については emerge の記事を参照してください。
emerge-webrsync
Gentoo ebuild リポジトリのスナップショットを web からインストールします。 ハンドブック を参照してください。
root #
emerge-webrsync -h
Usage: /usr/bin/emerge-webrsync [options] Options: --revert=yyyymmdd Revert to snapshot -k, --keep Keep snapshots in DISTDIR (don't delete) -q, --quiet Only output errors -v, --verbose Enable verbose output -x, --debug Enable debug output -h, --help This help screen (duh!)
/etc/portage/repos.conf
内で
sync-type
が
webrsync
に設定されていると、
eix-sync
によって
emerge-webrsync
が内部的に呼び出されます。
emirrordist
パッケージの distfile をミラーするためのツール。
root #
emirrordist -h
usage: emirrordist [options] <action>
emirrordist - a fetch tool for mirroring of package distfiles
optional arguments:
-h, --help show this help message and exit
Actions:
--version display portage version and exit
--mirror mirror distfiles for the selected repository
Common options:
--dry-run perform a trial run with no changes made (usually
combined with --verbose)
--verbose, -v display extra information on stderr (multiple
occurences increase verbosity)
--ignore-default-opts
do not use the EMIRRORDIST_DEFAULT_OPTS environment
variable
--distfiles DIR distfiles directory to use (required)
--jobs JOBS, -j JOBS number of concurrent jobs to run
--load-average LOAD, -l LOAD
load average limit for spawning of new concurrent jobs
--tries TRIES maximum number of tries per file, 0 means unlimited
(default is 10)
--repo REPO name of repo to operate on
--config-root DIR location of portage config files
--repositories-configuration REPOSITORIES_CONFIGURATION
override configuration of repositories (in format of
repos.conf)
--strict-manifests <y|n>
manually override "strict" FEATURES setting
--failure-log FILE log file for fetch failures, with tab-delimited
output, for reporting purposes
--success-log FILE log file for fetch successes, with tab-delimited
output, for reporting purposes
--scheduled-deletion-log FILE
log file for scheduled deletions, with tab-delimited
output, for reporting purposes
--delete enable deletion of unused distfiles
--deletion-db FILE database file used to track lifetime of files
scheduled for delayed deletion
--deletion-delay SECONDS
delay time for deletion, measured in seconds
--temp-dir DIR temporary directory for downloads
--mirror-overrides FILE
file holding a list of mirror overrides
--mirror-skip MIRROR_SKIP
comma delimited list of mirror targets to skip when
fetching
--restrict-mirror-exemptions RESTRICT_MIRROR_EXEMPTIONS
comma delimited list of mirror targets for which to
ignore RESTRICT="mirror"
--verify-existing-digest
use digest as a verification of whether existing
distfiles are valid
--distfiles-local DIR
distfiles-local directory to use
--distfiles-db FILE database file used to track which ebuilds a distfile
belongs to
--recycle-dir DIR directory for extended retention of files that are
removed from distdir with the --delete option
--recycle-db FILE database file used to track lifetime of files in
recycle dir
--recycle-deletion-delay SECONDS
delay time for deletion of unused files from recycle
dir, measured in seconds (defaults to the equivalent
of 60 days)
--fetch-log-dir DIR directory for individual fetch logs
--whitelist-from FILE
specifies a file containing a list of files to
whitelist, one per line, # prefixed lines ignored
man emirrordist も参照してください。
env-update
環境設定を自動的に更新します。
root #
env-update -h
Usage: env-update [--no-ldconfig] See the env-update(1) man page for more info
man env-update も参照してください。Gentoo で環境がどのように設定されるかについての情報は ログイン の記事を参照してください。
etc-update
etc-update の記事を参照してください。
fixpackages
パッケージの move アップデートをすべてのパッケージに対して実行します。
root #
fixpackages -h
usage: fixpackages [-h] The fixpackages program performs package move updates on configuration files, installed packages, and binary packages. optional arguments: -h, --help show this help message and exit
man fixpackages も参照してください。
glsa-check
Gentoo Linux Security Announcements 、略して GLSA は、Gentoo Linux に広く関連する、または ::gentoo ebuild リポジトリに含まれる特定のパッケージに関連する、セキュリティ脆弱性を伝えるためにコミュニティに向けて送信される通知です。
glsa-check はさまざまな GLSA の記録を追うためのツールです。GLSA を確認するために使用できる他、より重要な目的としては、システムが既知の GLSA について脆弱であるか確認するために使用できます。
さらなる情報については man glsa-check および glsa-check --help を参照してください:
user
$
glsa-check --help
usage: glsa-check <option> [glsa-id | all | new | affected] optional arguments: -h, --help show this help message and exit -V, --version Show information about glsa-check -q, --quiet Be less verbose and do not send empty mail -v, --verbose Print more messages -n, --nocolor Removes color from output -e, --emergelike Upgrade to latest version (not least-change) -c, --cve Show CVE IDs in listing mode -r, --reverse List GLSAs in reverse order Modes: -l, --list List a summary for the given GLSA(s) or set and whether they affect the system -d, --dump Show all information about the GLSA(s) or set --print Alias for --dump -t, --test Test if this system is affected by the GLSA(s) or set and output the GLSA ID(s) -p, --pretend Show the necessary steps to remediate the system -f, --fix (experimental) Attempt to remediate the system based on the instructions given in the GLSA(s) or set. This will only upgrade (when an upgrade path exists) or remove packages -i, --inject Inject the given GLSA(s) into the glsa_injected file -m, --mail Send a mail with the given GLSAs to the administrator glsa-list can contain an arbitrary number of GLSA ids, filenames containing GLSAs or the special identifiers 'all' and 'affected'
gpkg-sign
Todo:
- This section needs an explanation on the use of this command.
user
$
gpkg-sign --help
usage: gpkg-sign [options] <gpkg package file>
options:
-h, --help show this help message and exit
--keep-current-signature
Keep existing signature when updating signature (default: false)
--allow-unsigned Allow signing from unsigned packages when binpkg-request-signature is enabled (default: false)
--skip-signed Skip signing if a package is already signed (default: false)
portageq
詳細は portageq を参照してください。
quickpkg
このコマンドは システム上に現存するファイルの状態を使用します が、これはバイナリパッケージを作成するときに望ましいものではないことが多いです。さらなる情報については バイナリパッケージガイドの quickpkg の節 を参照してください。
システム上に現存するファイルの状態を使用して バイナリパッケージを作成します。さらなる情報については バイナリパッケージガイドの quickpkg の節 を参照してください。
user
$
quickpkg --help
usage: quickpkg [options] <list of package atoms or package sets>
optional arguments:
-h, --help show this help message and exit
--umask UMASK umask used during package creation (default is 0077)
--ignore-default-opts
do not use the QUICKPKG_DEFAULT_OPTS environment variable
--include-config <y|n>
include all files protected by CONFIG_PROTECT (as a security precaution, default is 'n')
--include-unmodified-config <y|n>
include files protected by CONFIG_PROTECT that have not been modified since installation (as a
security precaution, default is 'n')
man quickpkg も参照してください。
regenworld
regenworld の記事を参照してください。
repoman
repoman は ebuild をテストするために使用される開発ツールです。バージョン 2.3.0 より Portage から分離して app-portage/repoman としてパッケージ化されています。さらなる情報については repoman の記事を参照してください。
現在は dev-util/pkgcheck によって提供されるツールと dev-util/pkgdev パッケージの登場により 非推奨 となっています。
ヒント
Common portage issues and resolutions
Gentoo has many more configuration options than most distributions allow. This leads to some confusing at first terminology, such as blockers , Circular dependencies , REQUIRED_USE and some others.
The articles linked below, will help a user understand how they come about and how to resolve them.
メイン (Gentoo) ebuild リポジトリの同期時刻
Gentoo ebuild リポジトリが前回更新された (同期された) 時刻を確認するには、次のコマンドを実行してください:
user
$
cat /var/db/repos/gentoo/metadata/timestamp.chk
パッケージ集合を一覧表示する
どのパッケージがどの集合に含まれるか確認する必要がありますか? Package sets を確認してください。
トラブルシューティング
Portage が破損しているか、存在しない
非常にまれなことではあるはずですが、データによれば、Portage が破損したりアンインストールされてしまう可能性が存在するようで、これはシステム全体の機能にとって 非常に 良くないこととなるでしょう。万が一これが起こったとしても Portage を回復できる方法は あります が、システムの中心である Portage を再インストールするというのは事実上、機能するパッケージマネージャに頼らずにパッケージマネージャをインストールするという、手動での介入を必要とするかなり込み入った操作です。
バイナリパッケージを利用した緊急インストールについての詳細は、 Fix my Gentoo を参照してください。 Fixing broken Portage も参照してください。
デフォルトの Gentoo ebuild リポジトリの場所の変更
2019-04-29 [1] にリリースされた portage v2.3.66 [2] において、 portdir 、 distdir 、 repo_name 、 repo_basedir ディレクトリのデフォルトの場所が変わりました。
さらなる情報についてはバグ bug #662982 を参照してください。
以前の場所
repo_basedir="/usr"
repo_name="portage"
distdir="/usr/portage/distfiles"
portdir="/usr/portage"
target_distdir="/usr/portage/distfiles"
target_pkgdir="/usr/portage/packages"
新しい場所
repo_basedir="/var/db/repos"
repo_name="gentoo"
distdir="/var/cache/distfiles"
portdir="/var/db/repos/gentoo"
target_distdir="/var/cache/distfiles"
target_pkgdir="/var/cache/binpkgs"
関連項目
- /etc/portage — the primary configuration directory for Portage , Gentoo's package manager.
- /etc/portage/make.conf — Portage の環境を全ユーザーに対してカスタマイズするために使用される、メインの設定ファイルです。, Portage がバイナリパッケージを保存する場所です。
- /etc/portage/color.map — a file containing variables that define color classes used by Portage.
- prefix — enables the power of Gentoo and Portage on other distributions and/or operating systems (Microsoft Windows via Cygwin, Android via Termux, etc.).
Portage 関連
- Upgrading Gentoo — Gentoo を アップグレード (更新) する方法とともに、よく保守されたシステムを目指すための方法について説明します。
- Catalyst — a tool to build stage files and live-images for Gentoo
- Creating an ebuild repository — basics of creating an ebuild repository and maintaining ebuilds in it.
- GCC optimization — 安全で分別のある CFLAGS と CXXFLAGS を使って、コンパイルされるコードを最適化する手法を紹介します。
- Portage tips — the main command-line interface to Portage
- Repository format — A quick reference to Gentoo ebuild repository (overlay) format.
- Package Manager Specification — a standardization effort to ensure that the ebuild file format, the ebuild repository format (of which the Gentoo ebuild repository is the main incarnation), as well as behavior of the package managers interacting with these ebuilds is properly agreed upon and documented.
- Ebuild repository — Gentoo システムへのインストールのためにパッケージを提供できるファイル構造です。
- Category:Portage
- Gentoolkit — Gentoo システムと、特に Portage の管理を容易にするためのツールセットです。
- Portage Multi Stage Dockerfile — The emerge --quickpkg-direct and related emerge --quickpkg-direct-root options are useful inside Dockerfiles
- Portage Security — aims to answer the question "How can I dispel doubts regarding the security of the Gentoo ebuild repository on a system?"
- Portage TMPDIR on tmpfs — It is unlikely that tmpfs will provide any performance gain for modern systems
Gentoo AMD64 ハンドブック内の Portage
- Portage について
- USE フラグ
- Portage の機能
- ファイルとディレクトリ
- 変数による構成設定
- ソフトウェアのブランチを併用する
- 追加の Portage ツール
- カスタム Portage ツリー
- 高度な Portage の機能
Portage ツール
- Useful Portage tools — ebuild リポジトリ から入手できる Gentoo 固有の、特に Portage のための、システム管理ツールのリストを提供します。
- Cfg-update — a utility used on Gentoo to manage configuration file updates.
代替のパッケージマネージャと GUI
- Pkgcore — an alternative package manager for Gentoo that aims for high performance, extensibility, and a clean design.
- app-portage/kuroo - KF5/Qt5 ベースのグラフィカルな Portage フロントエンド。
- App Swipe - ローカルの Portage リポジトリを閲覧するための Qt GUI
ebuild またはパッケージ関連
- Package sets — describes package sets in high detail and includes a list of all typically available sets on a Gentoo system.
外部資料
- Official Portage documentation - Portage 開発者 Zac Medico (zmedico) によりビルドされています。
- packages.gentoo.org - オンラインで検索可能な、Gentoo パッケージリポジトリのパッケージのデータベース。
Portage man ページ
man ページは Portage についての完全な技術的文書を含んでいます。ローカルの man ページを読むためには、Gentoo システム上のシェルで man <主題> と入力してください。man ページにはさらなる情報のために see also セクションがあることに注意してください。
- emerge - command-line interface to the Portage system - emerge man ページ。
- Portage configuration files - Portage man ページ。