[pacman-dev] wanted: script to list uninstalled optdepends and packages that need them

Ray Rashif schivmeister at gmail.com
Mon Jun 15 23:17:01 EDT 2009


Is there already something that can list optdepends from the local db
regardless of their install status?

Example:

query local db (either with pacman -Qi or search lib)
pick out optdepends
filter packages that have optdepends
match
filter output eg.:

$optdepend1 = $pkg1, $pkg2, $pkg3
$optdepend2 (installed) = $pkg1, $pkg4

I tried this before with bash, but after it got too frustrating I gave up. I
had stuff like:

... pacman -Qi | grep -v "Optional Deps : None" | sed
'/^Version/,/^Depends/d' | sed '/^Required/,/^$/d' | sed 's:Name:\nName:'
...

and then I got desperate:

...
...
for i in $DB/*; do
 if grep "%OPTDEPENDS%" $i/depends > /dev/null; then
  echo -n " .. "

  PKG=$(
  sed -n '/%NAME%/,/^$/p' $i/desc | sed \
  -e '/%NAME%/d' \
  -e '/^$/d'
  )

  PKG_OPTDEPS=($(
  sed -n '/%OPTDEPENDS%/,/^$/p' $i/depends | sed \
  -e '/%OPTDEPENDS%/d' \
  -e 's/:.*//' \
  -e '/^$/d'
  ))
...
...

which is just plain stupid and slow. The fact that optdepends specification
is not standardised added just more room for faults, so I stopped trying
entirely.

Xyne, please do something about this with perl =p I'd really like some power
to optdepends, at least until pacman treats it nicely.


More information about the pacman-dev mailing list