You are not logged in.

#1 2007-06-01 14:55:28

Davigetto
Member
From: In your mind
Registered: 2007-05-10
Posts: 266

How Can I know what packages has been installed as a dependency?

I will post this with an example:

I have installed package X with "pacman -S X". X have 2 dependencies: Y and Z, so pacman has installed X, Y, Z.

I have installed another package called A with "pacman -S A", A have one dependencies, B, so pacman installed A and B.

If I run "pacman -Q", it outputs:

A
B
X
Y
Z

And I want to know, if I run a command, outputs this:

A
X

the packages that has been installed with my pacman commands, not de dependencies packages. Is there any way to do this?

Greetings


Only deaths can see the end of battles.

Blog: http://djmartinez.co.cc -> The life of a Computer Engineer

Offline

#2 2007-06-01 18:10:15

mitsoko
Banned
From: In the Coal Chamber
Registered: 2007-05-08
Posts: 143

Re: How Can I know what packages has been installed as a dependency?

pacman -Qi curl | grep 'Install Reason'
might work ... it's hard to tell though

Offline

#3 2007-06-01 18:59:54

ataraxia
Member
From: Pittsburgh
Registered: 2007-05-06
Posts: 1,553

Re: How Can I know what packages has been installed as a dependency?

pacman -Qe

It only now does this with pacman 3, though. ('e' is for 'explicit')

Offline

#4 2007-06-01 19:02:39

samlt
Member
Registered: 2007-05-20
Posts: 18

Re: How Can I know what packages has been installed as a dependency?

@ataraxia:
Pacman v3.0.4

-e, --orphans        list all packages installed as dependencies but no longer
                       required by any package

:?:

Last edited by samlt (2007-06-01 19:03:16)

Offline

#5 2007-06-01 21:42:46

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: How Can I know what packages has been installed as a dependency?

Argh, I already forgot what pacman 2 did (I was looking at this option recently).
In any cases, the -e option in pacman 3 now correctly lists orphans, and that's what this option was supposed to do.
It's supposed to tell you which packages are totally useless / unused on your machines so you can remove them if you want.
There might be a need for listing explictly installed packages, but that's not implemented. Though, you can do it easily with little scripts :
http://bbs.archlinux.org/viewtopic.php? … 08#p251008

Edit :
So, for the record :
pacman2 -Qe listed all explicitly installed packages not required by any others
pacman3 -Qe lists all packages installed as deps not required by any others (real orphans in my opinion)
And maybe a new option will appear in pacman 3 ( http://bugs.archlinux.org/task/7208 ) :
pacman3 -Qee which lists any packages (installed explicitly or as dep) not required by any others.

The pacman2 option doesn't mean anything for me, I don't see what it represents, and how it could be useful.
But there could be an option for listing all explicitly installed packages (some people might want this list for reinstalling), which can in the meantime be replaced by scripts, like the ones above.
I didn't see this feature request (maybe I missed it though), so check again, and request it if you want : http://bugs.archlinux.org

Last edited by shining (2007-06-01 21:58:28)


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#6 2007-06-01 22:13:27

ataraxia
Member
From: Pittsburgh
Registered: 2007-05-06
Posts: 1,553

Re: How Can I know what packages has been installed as a dependency?

You're right. I got confused and gave the wrong answer.

Offline

#7 2007-06-01 22:47:41

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: How Can I know what packages has been installed as a dependency?

ataraxia wrote:

You're right. I got confused and gave the wrong answer.

I've to admit it's easy to get confused tongue


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#8 2007-06-01 23:39:09

ataraxia
Member
From: Pittsburgh
Registered: 2007-05-06
Posts: 1,553

Re: How Can I know what packages has been installed as a dependency?

pacman eats my brains sometimes.

(Must be zombie-pacman! "pac-pac-pac-braaaiiins... pac-pac-pac-braaaiiins..." lol)

Offline

#9 2007-06-01 23:42:24

wain
Member
From: France
Registered: 2005-05-01
Posts: 289
Website

Re: How Can I know what packages has been installed as a dependency?

just use: yaourt -Qd    :-)

Offline

#10 2007-06-02 07:56:01

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: How Can I know what packages has been installed as a dependency?

Oh, indeed, it seems like yaout supports that.
Though, it looks to me there is an error in the description :

 (-Q, --query) -e,              list all packages explicitly installed
 (-Q, --query) -d,              list all packages installed as a dependency for another package
                                and are not required by any other packages
 (-Q, --query) -t             * search for missed installed orphans

If I read correctly, it should be :

 (-Q, --query) -e,              list all packages explicitly installed
 (-Q, --query) -d,              list all packages installed as a dependency for another package
 (-Q, --query) -t             * search for missed installed orphans
                               (packages installed as a dependency for another package 
                                and are not required by any other packages)

Having e for explicit, d for dependency, and so another letter for orphans, that's not stupid imo.
I wonder if I wouldn't prefer to have pacman working that way too smile

By the way, yaourt -Qd and -Qe options are similar to the script I wrote, and are very slow.
Any idea why the find way is much much faster? Is it possible to get the same performance without find in sh ?

Though implementing these options directly in pacman would probably solve that problem smile


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#11 2007-06-02 10:15:48

wain
Member
From: France
Registered: 2005-05-01
Posts: 289
Website

Re: How Can I know what packages has been installed as a dependency?

shining wrote:

Oh, indeed, it seems like yaout supports that.
Though, it looks to me there is an error in the description :

 (-Q, --query) -e,              list all packages explicitly installed
 (-Q, --query) -d,              list all packages installed as a dependency for another package
                                and are not required by any other packages
 (-Q, --query) -t             * search for missed installed orphans

If I read correctly, it should be :

 (-Q, --query) -e,              list all packages explicitly installed
 (-Q, --query) -d,              list all packages installed as a dependency for another package
 (-Q, --query) -t             * search for missed installed orphans
                               (packages installed as a dependency for another package 
                                and are not required by any other packages)

Having e for explicit, d for dependency, and so another letter for orphans, that's not stupid imo.
I wonder if I wouldn't prefer to have pacman working that way too smile

By the way, yaourt -Qd and -Qe options are similar to the script I wrote, and are very slow.
Any idea why the find way is much much faster? Is it possible to get the same performance without find in sh ?

Though implementing these options directly in pacman would probably solve that problem smile

You are right, "(-Q, --query) -d,              list all packages installed as a dependency for another package" ! that's an error in help :-D
Fixed in next release.

Your code is much better for searching package !
Yaourt do something like that:

for pkg in `ls "/var/lib/pacman/local/"`; do
      if echo $(cat "$PACMANROOT/local/$pkg/desc" 2>/dev/null) | grep -q "%REASON% 1"; then
          pkgreason=1
      else
          pkgreason=0
      fi
      if [ $pkgreason -eq $reason ]; then echo "$pkg"; fi
done

It just work without any optimisation in mind, because that take only 5 sec with pacman-cage or pacman-drive big_smile

Oh and -Qe for explicitly installed package is more natural. Like in pacman 2.9 wink

Offline

Board footer

Powered by FluxBB