You are not logged in.

#1 2024-02-01 08:27:02

mountaintrek
Member
Registered: 2024-02-01
Posts: 19

What is the purpose of the pacman REASON field?

Hi,

What is the purpose of the pacman "REASON" field?  Is it more informational than functional?

For example,

1. pkg_a is installed
 
    Reason: "Explicitly installed"

2. pkg_b is installed and depends on pkg_a

     Note: pkg_a's Reason does not change. It is still "Explicitly installed"

If pkg_b were installed first, pkg_a's Reason would be "Installed as a dependency of another package".

If I maintain multiple machines with the same packages regularly updated, it seems possible for the local databases to contain different REASONS (pacman -Qi) for the same package, based on, I think,  how they were installed which includes order they were installed. Package dependencies might change over time, and it seems the Reason field doesn't reflect this. 

To clarify functional above, I mean it impacts the integrity of the local database and the critical functions of future pacman commands. It won't change pacman -R, but will change pacman -Qdt results.

I'd just like to have a better understanding of how the REASON field is used and the impact of --asdep and --asexplicit.

Offline

#2 2024-02-01 08:29:35

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,356

Re: What is the purpose of the pacman REASON field?

If both systems were administered the same way both would have the same reason.

The only way it would defer would be if one system has packages installed from a list of installed packages of the other system... but you should be using -Qe anyway if you want to replicate a system's explicitly installed packages.

And I'm not sure what 'critical functions' you're worried about?


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#3 2024-02-05 01:14:46

mountaintrek
Member
Registered: 2024-02-01
Posts: 19

Re: What is the purpose of the pacman REASON field?

ngoonee wrote:

If both systems were administered the same way both would have the same reason.

I had the opportunity to look at multiple machines that were suppose to have the same packages, and they do, but the Reason field was different on some packages when I compared the output of  pacman -Qi.  I never really paid much attention to the Reason field before, but I guess it is one of those things you learn and appreciate over time smile 

ngoonee wrote:

And I'm not sure what 'critical functions' you're worried about?

The most important critical function is pacman -R, because it changes the system. I think removing is more impactful than installing, and querying is just information. Now the query information can tell me how the pacman remove most likely will  behave, but I don't think the remove cares about the Reason field.

I'm contemplating if there are any benefits  to choosing one machine as the definitive source, capture the package_name and reason and compare that to the other machines and where the reason is different do a pacman -D --asexplicit | --asdeps, so pacman -Qi output would be the same.

Offline

#4 2024-02-05 01:25:27

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,616
Website

Re: What is the purpose of the pacman REASON field?

The behavior of the -R flag itself will not depend on the 'reason' field, but many of the associated flags will, most notably the -s flag which itself should generally be used with -R to keep a clean system.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2024-02-05 01:36:19

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,645

Re: What is the purpose of the pacman REASON field?

Anything you specifically want on the system should be installed as explicit. Everything else should be installed as a dep. That's the only way you have a chance at doing any kind of system cleanup, and you should rarely be using -R alone.

Offline

#6 2024-02-08 19:22:43

mountaintrek
Member
Registered: 2024-02-01
Posts: 19

Re: What is the purpose of the pacman REASON field?

Trilby wrote:

The behavior of the -R flag itself will not depend on the 'reason' field, but many of the associated flags will, most notably the -s flag

For removals, I use -Rsn. I do see in the pacman man page that "-s" checks the Reason field.

Scimmia wrote:

Anything you specifically want on the system should be installed as explicit. Everything else should be installed as a dep. That's the only way you have a chance at doing any kind of system cleanup, and you should rarely be using -R alone.

HHHmmm, I'll have to think about this.

Thank you.

Offline

Board footer

Powered by FluxBB