[Popcon-commits] cvs commit to popularity-contest by pere

popcon-commits@lists.alioth.debian.org popcon-commits@lists.alioth.debian.org
Thu, 22 Jan 2004 23:56:34 +0100


Update of /cvsroot/popcon/popularity-contest
In directory quantz:/tmp/cvs-serv22991

Modified Files:
	popcon-largest-unused 
Log Message:
Report error in popcon-largest-unused if /var/log/popularity-contest
is missing.


Index: popcon-largest-unused
===================================================================
RCS file: /cvsroot/popcon/popularity-contest/popcon-largest-unused,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- popcon-largest-unused	19 Oct 2003 09:23:51 -0000	1.1
+++ popcon-largest-unused	22 Jan 2004 22:56:32 -0000	1.2
@@ -3,8 +3,15 @@
 # Author: Yann Dirson <dirson@debian.org>
 # License: GPL
 
-grep '<OLD>' /var/log/popularity-contest |
-  cut -d' ' -f3 |
+datafile=/var/log/popularity-contest
+
+if [ ! -e $datafile ] ; then
+    echo "warning: Missing required file $datafile."
+    echo "info:    Run 'popularity-contest > $datafile' to generate it."
+    exit 1
+fi
+
+grep '<OLD>' $datafile | cut -d' ' -f3 |
   xargs apt-cache -o 'APT::Cache::AllVersions=0' show |
   grep -E '^(Package|Installed-Size): ' |
   perl -ne 'if (/^Package: (.*)/) { $p = $1 };  if (/^Installed-Size: (.*)/) { print "$1 $p\n"; $p = 'BUG' }' |