2

Is there a simple way to retrieve the source files that built a given /usr/bin/* command (meaning also those placed there via AUR)? Is there a command I can issue through maybe a pacman wrapper that would retrieve those files for me or is it mandatory that I google my way to a git page or maintainers page?

According to this question, I am looking for something similar to the apt-get source command from debian based distributions. Likewise, according to this question, asp (formerly abs) has the basis of this functionality with asp export for core packages though does not extend to those which have been built from AUR.

I would like to begin contributing to the community and simplifying the process of inspecting AUR source files would go a long way to helping me choose an appropriate package for my skill level and expertise as I will likely be doing this dozens if not hundreds of times before finding a package that both needs my help and that I am interested in / capable of helping.

Vendelisk
  • 21
  • 2

2 Answers2

1

You are looking for the Arch Build System:

The Arch build system is a ports-like system for building and packaging software from source code. While pacman is the specialized Arch tool for binary package management (including packages built with the ABS), ABS is a collection of tools for compiling source into installable .pkg.tar.xz packages.

As you note, this is only for packages in the official repositories. For packages in the AUR, no specific tool is required as the AUR does not host binaries, so you can just acquire the necessary build files (git clone) and then inspect of modify the PKGBUILD before building it with makepkg.

jasonwryan
  • 71,734
  • 34
  • 193
  • 226
0
~ $ pacman -Qi $(pacman -Qoq $(which ssh-add))
Name            : openssh
Version         : 8.9p1-1
Description     : Premier connectivity tool for remote login with the SSH protocol
Architecture    : x86_64
URL             : https://www.openssh.com/portable.html
Licenses        : custom:BSD
Groups          : None
Provides        : None
Depends On      : glibc  krb5  openssl  libedit  ldns  libxcrypt  libcrypt.so=2-64  zlib  pam
Optional Deps   : xorg-xauth: X11 forwarding [installed]
                  x11-ssh-askpass: input passphrase in X [installed]
                  libfido2: FIDO/U2F support
Required By     : gcr  gnome-keyring  openmpi
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 4.18 MiB
Packager        : Giancarlo Razzolini <[email protected]>
Build Date      : Wed 23 Feb 2022 18:48:29 GMT
Install Date    : Sun 27 Feb 2022 18:14:02 GMT
Install Reason  : Explicitly installed
Install Script  : Yes
Validated By    : Signature

From man pacman:

OPERATIONS
[...]
       -Q, --query
           Query the package database. This operation
           allows you to view installed packages and
           their files, as well as meta-information about
           individual packages (dependencies, conflicts,
           install date, build date, size). This can be
           run against the local package database or can
           be used on individual package files. In the
           first case, if no package names are provided
           in the command line, all installed packages
           will be queried. Additionally, various filters
           can be applied on the package list. See Query
           Options below.
[...]
QUERY OPTIONS (APPLY TO -Q)
[...]
       -i, --info
           Display information on a given package. The -p
           option can be used if querying a package file
           instead of the local database. Passing two
           --info or -i flags will also display the list
           of backup files and their modification states.

[...]
       -o, --owns <file>
           Search for packages that own the specified
           file(s). The path can be relative or absolute,
           and one or more files can be specified.
[...]
       -q, --quiet
           Show less information for certain query
           operations. This is useful when pacman’s
           output is processed in a script. Search will
           only show package names and not version,
           group, and description information; owns will
           only show package names instead of "file is
           owned by pkg" messages; group will only show
           package names and omit group names; list will
           only show files and omit package names; check
           will only show pairs of package names and
           missing files; a bare query will only show
           package names rather than names and versions.

Adam Barnes
  • 101
  • 3
  • 1
    Please note that the question starts with "Is there a simple way to retrieve the source files that built a given `/usr/bin/*` command". In its current form, your answer doesn't address this. Please consider revising it to add more explanation. – AdminBee May 10 '22 at 06:47
  • That's different for every single package. In the package info there's a URL, and from there you can go find the repository _usually_. In this example, there's a link halfway down the page that reads "github". For MPV, there's a link at the bottom of the page that reads "source code repository". – Adam Barnes May 11 '22 at 07:14