[Debtags-commits] [svn] r1622 - tagdb

Enrico Zini enrico at costa.debian.org
Thu Mar 2 13:23:59 UTC 2006


Author: enrico
Date: Thu Mar  2 13:23:59 2006
New Revision: 1622

Added:
   tagdb/stats
      - copied, changed from r1621, tagdb/stattags
Removed:
   tagdb/stattags
Modified:
   tagdb/process
Log:
Gave a nicer name to the stats script, and use it to generate general stats


Modified: tagdb/process
==============================================================================
--- tagdb/process	(original)
+++ tagdb/process	Thu Mar  2 13:23:59 2006
@@ -143,7 +143,7 @@
 	BIGPATCH=`mktemp`
 	tagcoll diff $CACHEDIR/$SVN-clean $CACHEDIR/$UNCHECKED-clean > $BIGPATCH
 	STATS=`mktemp`
-	./stattags --facet $BIGPATCH | sort -nr > $STATS
+	./stats --facet $BIGPATCH | sort -nr > $STATS
 
 	EDITPATCH=""
 	ANS=""
@@ -190,7 +190,7 @@
 	BIGPATCH=`mktemp`
 	tagcoll diff $CACHEDIR/$SVN-clean $CACHEDIR/$UNCHECKED-clean > $BIGPATCH
 	STATS=`mktemp`
-	./stattags $BIGPATCH | sort -nr > $STATS
+	./stats $BIGPATCH | sort -nr > $STATS
 
 	EDITPATCH=""
 	ANS=""
@@ -391,8 +391,10 @@
 	echo "Statistics"
 	echo "----------"
 	echo ""
-	echo "`wc -l $MAINPATCH | cut -d' ' -f1` packages patched"
-	echo "`tagcoll reverse $MAINPATCH | wc -l | cut -d' ' -f1` types of changes"
+	BIGPATCH=`mktemp`
+	tagcoll diff $CACHEDIR/$SVN-clean $CACHEDIR/$UNCHECKED-clean > $BIGPATCH
+	./stats --general $BIGPATCH
+	rm $BIGPATCH
 }
 
 # Main menu

Copied: tagdb/stats (from r1621, tagdb/stattags)
==============================================================================
--- tagdb/stattags	(original)
+++ tagdb/stats	Thu Mar  2 13:23:59 2006
@@ -29,6 +29,43 @@
 	}
 
 	close IN;
+} elsif (@ARGV && $ARGV[0] eq '--general') {
+	# Compute and output general numbers about a patch
+
+	shift @ARGV;
+	my $patchfile = (shift @ARGV or 'patch');
+
+	# Number of items patched
+	my %st_items;
+	# Number of different changes
+	my %st_changes;
+	# Number of tags involved
+	my %st_tags;
+	# Number of facets involved
+	my %st_facets;
+
+	open IN, $patchfile or die "Cannot read $patchfile: $!";
+	while (<IN>)
+	{
+		my ($pkg, $tags) = split(': ', $_);
+		$st_items{$pkg} = 1;
+		for my $t ($tags)
+		{
+			$st_changes{$t} = 1;
+			my $tag = substr($t, 1);
+			$st_tags{$tag} = 1;
+			my $facet = $tag;
+			$facet =~ s/::.+//;
+			$st_facets{$facet} = 1;
+		}
+	}
+	close IN;
+
+	printf "%d items patched with %d different changes involving %d tags in %d facets\n",
+		scalar keys %st_items,
+		scalar keys %st_changes,
+		scalar keys %st_tags,
+		scalar keys %st_facets;
 } else {
 	my $patchfile = (shift @ARGV or 'patch');
 



More information about the Debtags-commits mailing list