Where does the extra package description text in Pamac come from?

I noticed that Pamac gives more description about many packages than pacman does. For example, when I run pacman -Si spectacle, I get:

$ pacman -Si spectacle
Repository      : extra
Name            : spectacle
Version         : 22.12.1-1
Description     : KDE screenshot capture utility
Architecture    : x86_64
URL             : https://apps.kde.org/spectacle/
Licenses        : GPL
Groups          : kde-applications  kde-graphics
Provides        : None
Depends On      : xcb-util-cursor  purpose  knewstuff  kwayland  qt5-tools  kimageannotator
Optional Deps   : None
Conflicts With  : None
Replaces        : None
Download Size   : 1404.94 KiB
Installed Size  : 2937.10 KiB
Packager        : Antonio Rojas <arojas@archlinux.org>
Build Date      : Tue 03 Jan 2023 11:05:03 GMT
Validated By    : MD5 Sum  SHA-256 Sum  Signature

The description is only a few words. But when I search for spectacle in Pamac, the GUI shows me a lot more:

Spectacle is a simple application for capturing desktop screenshots. It can capture images of the entire desktop, a single monitor, the currently active window, the window currently under the mouse, or a rectangular region of the screen. The images can then be printed, sent to other applications for manipulation, or quickly be saved as-is.

Features:

  • Capture Entire Desktop
  • Capture Current Monitor
  • Capture Active Window
  • Capture Rectangular Region
  • Keyboard shortcuts for taking screenshots

There’s a whole paragraph of descriptive text, plus a bullet-pointed feature list. I could not find a way to get this longform description using pacman, and it does not appear on the corresponding page https://archlinux.org/packages/extra/x86_64/spectacle/ about the package in the Arch repositories.

Now, in this case, I did find the text and image on the page linked as “upstream URL”, here https://apps.kde.org/spectacle/ , but that doesn’t fully answer my question.

What I really want to know is, how does Pamac find this info in the general case? Does Manjaro maintain lots of different web-scrapers to parse info out of all the different varieties of upstream software sites? Is it copypasted manually? Or are there longer descriptions in the Arch repos all along and I just missed them? I don’t know much about how the sausage gets made.

And is there a way to query this extra info from the command line? I use the Pamac GUI pretty much for this sole feature; I can make a much more informed decision about the software I want to install. If I could get this extra info on the command line I could stop using Pamac entirely (no offense to the people who made it, it’s a lovely program, I just prefer terminal-based workflows).

There is no magic… just appstream.

appstreamcli dump org.kde.spectacle.desktop
1 Like

Oh thank you, I had no idea such a thing existed :slight_smile:

That let me write a script to print the longform description(s) on the terminal. Anyone finding this from Google, feel free to use it:

#!/usr/bin/env bash

set -euo pipefail

function printdesc {
  echo "$1 ($2)"
  appstreamcli dump "$2" | \
    (xq -x '.component.description' 2> /dev/null || echo '<p>No description found</p>') | \
    lynx -stdin -dump
}

searchinfo="$(appstreamcli search "$1")"
{
  while IFS= read -r line; do
    if [[ "$line" == '---' ]]; then
      printdesc "$pkg" "$idn"
      echo
    fi
    [[ "$line" =~ ^Identifier: ]] && idn="$(awk '{ print $2 }' <<< "$line")"
    [[ "$line" =~ ^Package: ]] && pkg="$(awk '{ print $2 }' <<< "$line")"
  done;
  printdesc "$pkg" "$idn"
} <<< "$searchinfo"

Requires yq (for the xq executable) and lynx to be installed, run sudo pacman -S yq lynx to get them.

Save as package-info-longform then run as

./package-info-longform steam
steam (com.valvesoftware.Steam.desktop)
   Steam is a software distribution service with an online store,
   automated installation, automatic updates, achievements, SteamCloud
   synchronized savegame and screenshot functionality, and many social
   features.

steam-native-runtime (steam-native.desktop)
   Native replacement for the Steam runtime using system libraries

gnome-games (org.gnome.Games)
   Games is a GNOME 3 application to browse your video games library and
   to easily pick and play a game from it. It aims to do for games what
   Music already does for your music library.

   You want to install Games if you just want a very simple and
   comfortable way to play your games and you dont need advanced features
   such as speedrunning tools or video game development tools.

   Features:
     * List your installed games, your Steam games, your game ROMs
     * Search in your games collection
     * Play your games
     * Resume your game to where you left it
1 Like