Portage/ja

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page Portage and the translation is 98% complete.

Portage は Gentoo のための公式のパッケージマネージャであり、ディストリビューションシステムです。依存関係の解決、ソースからの柔軟なビルドとインストール、バイナリファイルを生成・管理・配布するためのツール等の機能を提供し、Gentoo ベースのオペレーティングシステムの心臓部として機能します。

Portage はソフトウェアを Gentoo ebuild リポジトリから、そして必要であれば追加のリポジトリから支給します。Portage にはリポジトリとパッケージの管理のための多くのコマンドが含まれており、中でも最もよく使われるのが emerge コマンドです。

portage と emerge コマンドについてのよくある質問は、FAQPortage FAQ で回答されています。

ヒント
日常的には emergeemaint、そして dispatch-conf が最もよく使われる Portage コマンドになるでしょう。それぞれのドキュメントも参照してください。
関連
完全なユーザドキュメントについては 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/portageworld ファイルに追加されるのを避けるためには、--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 リポジトリによっては、脆弱なソフトウェアやひどく壊れたソフトウェアを含んでいたり、理論上は、悪意のあるソフトウェアを含んでいるかもしれません。

使い方

Portage にはシステム管理と保守を手助けするさまざまなツールとユーティリティが含まれています。以下の節ではこれらをアルファベット順に列挙します。

ヒント
日常的に必要になるであろうメインのコマンドは emergeemaint、そして dispatch-conf です。

archive-conf

The purpose of archive-conf is to save off a config file in the dispatch-conf archive directory. Most users should not ever need to run this command:

root #archive-conf
Usage: archive-conf /CONFIG/FILE [/CONFIG/FILE...]

dispatch-conf

dispatch-conf ユーティリティは設定ファイルの更新を管理するために利用されます。dispatch-conf の記事を参照してください。

ebuild

ebuild はさまざまな ebuild 関数を実行するための Portage のコマンドです。

このコマンドは一般的にユーザが実行するものではなく、開発者にとっての利便性のためにあるものです。パッケージをインストールするためにこれを使用しようとしないでください。emerge コマンドを確認して、そちらを使ってください。

このコマンドと ebuild ファイルの違いについては、ebuild の記事を参照してください。

egencache

egencache ツールは、ebuild リポジトリのメタデータ情報のキャッシュを再構築します。さらなる情報については egencache の記事を参照してください。

emaint

パッケージ管理に関連するシステムヘルスチェックとメンテナンスを行います。

リポジトリを同期するために emaint を使う方法については、リポジトリの同期を参照してください。詳しい情報は man 1 emaint を参照してください。

メモ
今は emerge --sync コマンドは 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-typewebrsync に設定されていると、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 で環境がどのように設定されるかについての情報はログインの記事を参照してください。

fixpackages

Perform package move updates for all packages.

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 も参照してください。

regenworld

Portage ログファイルから過去に行われたすべてのアクションをチェックして、world ファイルを再生成します。

警告
このツールを使用する前に、既存の world ファイル (/var/lib/portage/world) のバックアップを取ってください。
root #regenworld -h
This script regenerates the portage world file by checking the portage
logfile for all actions that you've done in the past. It ignores any
arguments except --help. It is recommended that you make a backup of
your existing world file (/var/lib/portage/world) before using this tool.

portageq

詳細は portageq を参照してください。

quickpkg

Portage パッケージを作成します。さらなる情報については バイナリパッケージガイドを参照してください。

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 も参照してください。

repoman

The information in this section has been deprecated. It may or may not be relevant for contemporary usage. Handle with care!

repoman は ebuild をテストするために使用される開発ツールです。バージョン 2.3.0 より Portage から分離して app-portage/repoman としてパッケージ化されています。さらなる情報については repoman の記事を参照してください。

現在は dev-util/pkgcheck によって提供されるツールと dev-util/pkgdev パッケージの登場により非推奨となっています。

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'

ヒント

メイン (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] において、portdirdistdirrepo_namerepo_basedir ディレクトリのデフォルトの場所が変わりました。

さらなる情報についてはバグ bug #662982 を参照してください。

以前の場所

コード 2019-04-29 より前の場所
repo_basedir="/usr"
repo_name="portage"
distdir="/usr/portage/distfiles"
portdir="/usr/portage"
target_distdir="/usr/portage/distfiles"
target_pkgdir="/usr/portage/packages"

新しい場所

コード 2019-04-29 以降の場所
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.confPortage の環境を全ユーザーに対してカスタマイズするために使用される、メインの設定ファイルです。, 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 — 安全で分別のある CFLAGSCXXFLAGS を使って、コンパイルされるコードを最適化する手法を紹介します。
  • Portage tips — the 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 — Building packages in tmpfs both speeds up emerge times and reduces HDD/SSD wear.

Gentoo AMD64 ハンドブック内の Portage

Portage ツール

代替のパッケージマネージャと 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.

外部資料

Portage man ページ

man ページは Portage についての完全な技術的文書を含んでいます。ローカルの man ページを読むためには、Gentoo システム上のシェルで man <主題> と入力してください。man ページにはさらなる情報のために see also セクションがあることに注意してください。