You are not logged in.

#1 2011-12-01 19:06:51

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Difference between 'whoneeds' from pkgtools and 'pactree' from pacman.

Why 'whoneeds zlib' and 'pactree -lru zlib' produce different results? 'pactree' is much faster too:

[karol@black ~]$ time whoneeds zlib | wc -l
103

real	0m10.130s
user	0m5.050s
sys	0m4.136s
[karol@black ~]$ time pactree -lru zlib | wc -l
177

real	0m0.101s
user	0m0.020s
sys	0m0.037s

Offline

#2 2011-12-08 16:09:22

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Difference between 'whoneeds' from pkgtools and 'pactree' from pacman.

Turns out if you peek in the code, good things happen ;P

[karol@black ~]$ head /usr/bin/whoneeds
#!/bin/bash
# whoneeds package : shows explicitly installed packages that require some package

[...]

Hopefully we'll get a '--help' option one day https://bugs.archlinux.org/task/27387 or may we can drop this script entirely.

The performance is not that bad for smaller dep trees:

[karol@black ~]$ time comm -12 <(pactree -lru gcc|sort) <(pacman -Qqe|sort)
gcc
libgphoto2
libtool
mplayer2

real	0m0.123s
user	0m0.027s
sys	0m0.053s
[karol@black ~]$ time whoneeds gcc
Packages that depend on [gcc]
  libgphoto2
  libtool
  mplayer2

real	0m0.329s
user	0m0.160s
sys	0m0.113s

'gcc' was explicitly installed on my system and it was reported in the first query, but not by 'whoneeds'.

I think

comm -12 <(pactree -lru $1|sort) <(pacman -Qqe|sort) | grep -v $1

could do 'whneeds' job. Posted to the ML: http://mailman.archlinux.org/pipermail/ … 02250.html
Posted on pkgtools' bugtracker: https://github.com/Daenyth/pkgtools/issues/40

Last edited by karol (2011-12-08 17:11:53)

Offline

Board footer

Powered by FluxBB