Package: popularity-contest
Severity: normal

Hi,

popularity-contest can have several usage. For example,
   popularity-contest | grep '<OLD>'
will show me a list of packages I have not been used for more than three
months.  Then, "popcon-largest-unused" sorts unused packets by size.    
However, this output isn't totally accurate: some packages appear "old" but
I can't remove them because other (non-old) packages depend on them.  Also, 
some packages recommended or suggested by other are likely to be used in the
future.

Therefore, I propose the following simple shell script (named
"popcon-nodependency"): it filters the output of "popcon-largest-unused" to
display only packets that are not requested/recommended/suggested by other.

Regards.



-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing'), (200, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-2-686 (SMP w/1 CPU core)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages popularity-contest depends on:
ii  debconf [debconf-2.0]         1.5.26     Debian configuration management sy
ii  dpkg                          1.14.26    Debian package management system

Versions of packages popularity-contest recommends:
ii  cron                          3.0pl1-105 management of regular background p
ii  postfix [mail-transport-agent 2.5.5-1.1  High-performance mail transport ag

Versions of packages popularity-contest suggests:
ii  anacron                       2.3-13.1   cron-like program that doesn't go 

-- debconf information:
  popularity-contest/submiturls:
* popularity-contest/participate: true
#!/bin/sh
#
# Author: Christophe Lohr <cl...@users.sourceforge.net>
# License: GPL
# Wed, 06 May 2009 10:14:08 +0200


RECOMMENDS=' ${Recommends}'
SUGGESTS=' ${Suggests}'
for opt; do
  case $opt in 
  '-r') RECOMMENDS='' ;;
  '-s') SUGGESTS='' ;;
  *) echo "Unknown option $opt"
     ERROR=true
  esac
done

if [ "$ERROR" = true ]; then
  cat << EOF >&2
Usage: $0 [-r] [-s]
 -r  Also displays packages that are recommended by other
 -s  Also displays packages that are suggested by other
EOF
  exit 1
fi 

DEPENDS=`tempfile`

dpkg-query -W -f="\${Depends}${RECOMMENDS}${SUGGESTS}\n" \
	| tr ', ' '\012' | sort | uniq > $DEPENDS

while read SIZE PACKAGE ; do
  if ! grep -q "^$PACKAGE\$" $DEPENDS; then
    echo $SIZE $PACKAGE
  fi 
done

rm -f $DEPENDS

Reply via email to