pk4(1)
π pk4 β like, the source-package-fetching bestie π
okay so first things first, this is a page from the User Manuals section, and the star of the show is pk4 π
β¨ NAME β¨
pk4 β make available the Debian source package producing the specified package π
πΈ SYNOPSIS πΈ
pk4 [options] package...
π¦ DESCRIPTION π¦
so pk4 takes your argument(s) and figures out what they are, bestie. it resolves them as either:
- the name of a Debian binary package, and then it selects that package's Debian source package π
- the name of a Debian source package, and it just selects it, periodt π
- or a file path, and it selects the Debian source package of the package that owns that file π
and the source package version it grabs? it's either the installed version (if there even is one) or the installation candidate, exactly as apt-cache policy says. no cap. π
then β and this is the good part β pk4 downloads the entire selected source package (literally every file referenced by its .dsc file, and the .dsc file itself π) and prints out the output directory path so you know where your new babies live. ποΈβ¨
π OPTIONS π
-allow_unauthenticatedβ whether to allow unauthenticated source packages, i.e. it disables signature checking. π¨ like, be careful with this one fr fr.-binβ restrict the search to binary packages only. π§Έ-completeβ whether to return shell completions. this should usually only ever be set by shell completion functions, not by you, bestie π-dest stringβ the directory to store source packages in (default~/.cache/pk4). π-fileβ interpret the argument as a file name and operate on the package that provides that file. π-resolve_onlyβ resolve the provided arguments to source package and source package version, then print them to stdout in%s\t%s\nformat and exit. no downloading, just vibes πβοΈ-shell stringβ which shell to start in the output directory after downloading the source (default$SHELL). π-srcβ restrict the search to source packages only. π¦-verboseβ whether to print messages to stderr. π£οΈ-version stringβ use the specified source package version (default: installed package version, or latest known if it's not installed). π’
π EXAMPLES π
# Avail the current Linux kernel sources:
pk4 -src linux
# Avail the sources which produced Debian binary package libbz2-1.0
pk4 libbz2-1.0
# Avail the sources of whichever package currently provides vi:
pk4 -file $(which vi)
# Fetch the i3 source, apply a bugfix, rebuild and replace installed packages:
pk4 i3
patch -p1 < /tmp/myfix.patch
pk4-replace
# Avail all debhelper build system implementations:
pk4 -allow_unauthenticated $(grep '^dh-*' /var/cache/pk4/completion.both.txt)
# Grep through their sources:
grep -r option ~/.cache/pk4/dh-*
π CONFIGURATION FILE π
you can configure these attributes in ~/.config/pk4/pk4.deb822:
Disk-Usage-Limit bytes
Example:
Disk-Usage-Limit: 2GiB
πͺ HOOKS πͺ
here are the hooks you can configure, bestie:
after-download
after-download hooks run after the package was successfully downloaded. π Examples:
# Automatically create a git repository for each package:
mkdir -p ~/.config/pk4/hooks-enabled/after-download/
ln -s /usr/share/pk4/hooks-available/after-download/git-init \
~/.config/pk4/hooks-enabled/after-download/
unpack
unpack hooks replace the unpack phase: the moment one or more unpack hooks are found, pk4 runs them instead of running dpkg-source -x. π Examples:
# Unpack source into a new git-buildpackage repository:
apt install git-buildpackage
mkdir -p ~/.config/pk4/hooks-enabled/unpack/
ln -s /usr/share/pk4/hooks-available/unpack/gbp \
~/.config/pk4/hooks-enabled/unpack/
π SEE ALSO π
pk4-generate-index(1)β (Re-)generate index files forpk4ποΈpk4-replace(1)β build sources and replace currently installed packages π
π AUTHOR π
Michael Stapelberg <stapelberg at debian.org> π
and that's the whole page, bestie! this one came from the Linux manual, the OCTOBER 2017 edition, and yeah it's pk4(1) β go fetch yourself some sources, you absolute icon π«ΆπΈπ
π¦ where this page comes from
- debian bookworm: pk4 5+b24 Β· MIT
- debian trixie: pk4 5+nmu1+b8 Β· MIT
- ubuntu jammy: pk4 5build2 Β· MIT
- ubuntu noble: pk4 5build3 Β· MIT
- ubuntu noble: pk4 5ubuntu0.24.04.3 Β· MIT
- ubuntu questing: pk4 5+nmu1
- ubuntu resolute: pk4 5+nmu1build1 Β· MIT
- ubuntu stonking: pk4 5+nmu1build1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms