pkgcraft

From Gentoo Wiki
Jump to:navigation Jump to:search
This article is a stub. Please help out by expanding it - how to get started.

Resources

pkgcraft is a highly experimental tooling ecosystem for Gentoo written in Rust. To achieve a measurable performance improvement with forked bash wrapped by scallop library and metadata cache at metadata/md5-cache directory the the repo root.

Warning
pkgcraft is highly experimental and may result in breakage.

Installation

USE flags

USE flags for sys-apps/pkgcraft-tools pkgcraft-based tools for Gentoo

debug Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces
test Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)

Emerge

root #emerge --ask sys-apps/pkgcraft-tools

Usage

pkgcraft-tools consists of a single binary - /usr/bin/pk with shell-completions for bash, fish and zsh.


Category/package/version (cpv) utils

Compare cpv with <, <=, ==, !=, >=, and > operators, returns 0 if true:

user $pk cpv compare "cat/pkg-1.2.3-r1 <= cat/pkg-1.2.3-r2" && echo Yes
Yes

Determine if a cpv intersects another value:

user $pk cpv intersect cat/pkg-1.2.3-r1 =cat/pkg-1* && echo Yes
Yes

Parse cpv and optionally print formatted output:

user $pk cpv parse -f "{CATEGORY}/{P}" cat/pkg-1.0-r1
cat/pkg-1.0

Collapse cpvs into a set:

user $pk cpv set a/b-1 a/b-2 a/b-1
a/b-1
a/b-2

Sort cvps:

user $pk cpv sort $(equery list '*')

Dependency commands

Compare/intersect/parse/set/sort dependencies:

user $pk dep compare "cat/pkg == cat/pkg" && echo Yes
user $pk dep intersect ">=cat/pkg-1" "cat/pkg-9999" && echo Yes
user $pk dep parse -f "{P}" cat/pkg
user $pk dep set cat/a cat/b cat/a
user $pk dep sort $(cat /var/lib/portage/world)

Package commands

Output ebuild environment, e. g. SRC_URI for each package in gentoo repository, ignoring invalid packages:

user $pk pkg env -f SRC_URI -r gentoo -i

Fetch distfiles. Note: at this moment pkgcraft can not fetch from ftp servers. Example: pretend to fetch all versions of fastfetch.

user $pk pkg fetch --verbose -pretend --repo gentoo app-misc/fastfetch

Manifest manipulation. Example: force redownload and recalculate hashes in the manifest file:

user $pk pkg manifest --force --concurrent 3 app-misc/fastfetch

pk pkg metadata - manipulate cached package metadata (regenerate/remove).

Run the pkg_pretend phase: pk pkg pretend <target>...

Show reverse dependencies of package: pk pkg revdeps --repo gentoo dev-cpp/gtest

Output package keywords: pk pkg showkw dev-cpp/gtest

Benchmark ebuild sourcing: pk pkg source /var/db/repos/gentoo --sort

Repository commands

Output statistics for eapi, eclass, license, mirrors:

user $pk repo eapi gentoo
user $pk repo eclass gentoo
user $pk repo license gentoo
user $pk repo mirror gentoo

pk pkg metadata - manipulate repository metadata (clean/regen/remove).