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:

  1. the name of a Debian binary package, and then it selects that package's Debian source package πŸ‘‘
  2. the name of a Debian source package, and it just selects it, periodt πŸ’…
  3. 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\n format 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 πŸ‘€


πŸ‘‘ 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