Skip to content

Why Do Packages Sort via Repo

Visually for me this is extremely hard to look at. Is there a specific reason Arch/Pacman displays the repository name before the package name I'm searching for? Seems relivant for sure but maybe formatted cleaner? Can we maybe do some color syntax highlighting on the package matched variable name to pop / stand out? I'm sure this is customizable in some way so I figured I'd ask here. I love Arch, not bashing Pacman or being a troll. Just honestly would like to know if there's a reasoning behind listing 'extra' before the package name and if others find this as awkward as I do:

[root@db101 ~]# pacman -Ss postgresql
extra/libpqxx 4.0.1-2
    C++ client API for PostgreSQL
extra/libreoffice-fresh 4.3.2-1
    LibreOffice branch which contains new features and program enhancements
extra/libreoffice-still-postgresql-connector 4.2.6-4 (libreoffice-still)
    A PostgreSQL connector for the database front-end for LibreOffice maintenance branch
extra/pgbouncer 1.5.4-6
    A lightweight connection pooler for PostgreSQL
extra/php-pgsql 5.6.1-1
    PostgreSQL modules for PHP
extra/postgresql 9.3.5-1
    A sophisticated object-relational DBMS
extra/postgresql-docs 9.3.5-1
    HTML documentation for PostgreSQL
extra/postgresql-libs 9.3.5-1
    Libraries for use with PostgreSQL
extra/postgresql-old-upgrade 9.2.9-1
    PostgreSQL build for migrating between major versions with pg_upgrade
extra/redland-storage-postgresql 1:1.0.17-2
    PostgreSQL storage support for Redland
community/gambas3-gb-db-postgresql 3.5.4-3 (gambas3)
    PostgreSQL database access component
1 points10 comments
Open on Reddit
About this post
Posted
Archived
Score
1 · 100% up
Kind
Text
ID
2ircur

Author

13
posts
11
comments
1
media
View profile

10 comments

As per usual, ask the omniscient Arch wiki for help and you shall be helped.

https://wiki.archlinux.org/index.php/Pacman_tips#Color_output

9 points

I would still like to be educated on why this occurs.

1 points

(uneducated guess) Likely so that you do not, for example, mistakenly install testing/linux when you just wanted to upgrade core/linux. (not sure if that could actually happen)

8 points

Because repositories are organized based on the package role itself - which thus means that your testing packages will be grouped together, away from the rest (and your multilib stuff will also be isolated from the rest)

3 points

Pacman searches packages from the first repo it found in it's configuration, that's also why pacman can work with multiple repositories that have different version of a package (eg [testing] and [core])

1 points

(This is just a guess, but shouldn't be too off the track.) Say, you're using community, community-testing and magic, custom repo, and you're asking for weston. Weston is in all three of these repos, as 1.5 is stable in community, 1.6 is in community-testing, and you need a patched package, which is in your custom repo, and it's weston 1.6.1. When you ask pacman to install a package, it'll go through all of your repos looking for the latest possible package and install that. So if you see a repository name before the package, you'll see which package names overlap, and which versions they have. Overlaps are fairly common when you're using testing repos.

3 points

It searches in the order of repositories specified in pacman.conf. If you tried to move the position of [testing] repo below [core], pacman will pick the package from [core] instead of [testing] regardless of package version

1 points

This is untested since I'm not in front of my arch machine, but maybe this will sort them the way you want?

pacman -Ss "$pkg" | sed -e N -e "s/\n/|/" | sort -t / -k2 | tr "|" "\n"
2 points

This is probable a simple reason: It is because it searches the repos in that order.

When it updates, it grabs the first repo's, then the next, then the next. The devs decided it would be quicker to just show that, then to have to do more stuff to list it all in any order.

2 points

One more thing. If you do something like pacman -Ssq postgresql (notice the q), you'll get only the package names printed out. Note that this brings the danger of not knowing which repo the packages come from.

1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.