ooo-build r12158 - in trunk: . patches



Author: michael
Date: Mon Apr 14 09:31:42 2008
New Revision: 12158
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12158&view=rev

Log:
2008-04-12  Michael Meeks  <michael meeks novell com>

        * patches/apply.pl.in: add breakdown of patches by lines as well
        as patch count: to improve our historical charting quality.



Modified:
   trunk/ChangeLog
   trunk/autogen.sh
   trunk/patches/apply.pl.in

Modified: trunk/autogen.sh
==============================================================================
--- trunk/autogen.sh	(original)
+++ trunk/autogen.sh	Mon Apr 14 09:31:42 2008
@@ -22,7 +22,7 @@
 # intltoolize --copy --force --automake
 autoconf || exit 1;
 if test "x$NOCONFIGURE" = "x"; then
-    ./configure "$@" "$old_args"
+    ./configure "$@" $old_args
 else
     echo "Skipping configure process."
 fi

Modified: trunk/patches/apply.pl.in
==============================================================================
--- trunk/patches/apply.pl.in	(original)
+++ trunk/patches/apply.pl.in	Mon Apr 14 09:31:42 2008
@@ -799,7 +799,60 @@
     }
 }
 
-sub print_statistic_breakdown ($)
+sub count_patch_lines ($$$$)
+{
+    my ($patch, $plus, $minus, $plines) = @_;
+    my @lines = split (/\n/, slurp (find_patch_file ($patch)));
+
+    foreach $line (@lines) {
+	$line =~ /^\+[^\+]/ && $$plus++;
+	$line =~ /^\-[^\-]/ && $$minus++;
+	$$plines++;
+    }
+}
+
+sub print_patch_statistics ($)
+{
+    my $patches = shift;
+    my (%patches, %lines_plus, %lines_minus, %lines_of_patch);
+    my %data = ( patches => \%patches,
+		 plus => \%lines_plus,
+		 minus => \%lines_minus,
+		 'lines of patch' => \%lines_of_patch );
+    my @sets;
+
+    for my $patch (keys %{$patches}) {
+	my $set = find_patch_file ($patch);
+	$set =~ s|.*/(.*)/.*|$1|;
+#	print "Path '$set'\n";
+	if (!defined $data{patches}->{$set}) {
+	    for my $type (keys %data) {
+		$data{$type}->{$set} = 0;
+	    }
+	    push @sets, $set;
+	}
+	$data{patches}->{$set}++;
+	my ($plus, $minus, $plines) = (0, 0);
+	count_patch_lines ($patch, \$plus, \$minus, \$plines);
+	$data{plus}->{$set} += $plus;
+	$data{minus}->{$set} += $minus;
+	$data{'lines of patch'}->{$set} += $plines;
+    }
+    print "type\t";
+    for my $set (@sets) {
+	print "$set\t";
+    }
+    print "\n";
+    for my $type ('patches', 'plus', 'minus', 'lines of patch') {
+	print "$type\t";
+        for my $set (@sets) {
+	    print "$data{$type}->{$set}\t";
+        }
+        print "\n";
+    }
+}
+
+sub print_line_count ($)
 {
     my $patches = shift;
     my %breakdown;
@@ -809,10 +862,9 @@
 	$set =~ s|.*/(.*)/.*|$1|;
 #	print "Path '$set'\n";
 	if (!defined $breakdown{$set}) {
-	    $breakdown{$set} = 1;
-	} else {
-	    $breakdown{$set}++;
+	    $breakdown{$set} = 0;
 	}
+	$breakdown{$set}++;
     }
     for my $set (sort keys %breakdown) {
 	print "$set\t";
@@ -937,7 +989,8 @@
     "apply <path-to-patchdir> --add-developer\n" .
     "apply <path-to-patchdir> --find-unused\n" .
     "apply <path-to-patchdir> --statistic-no-issue\n" .
-    "apply <path-to-patchdir> --statistic-breakdown\n";
+    "apply <path-to-patchdir> --statistic-breakdown\n" .
+    "apply <path-to-patchdir> --statistic-line-count\n";
 
 %options = ();
 
@@ -988,6 +1041,9 @@
 	} elsif ($a =~ m/--statistic-breakdown/) {
 	    $statistic = 1;
 	    $statistic_breakdown = 1;
+	} elsif ($a =~ m/--statistic-line-count/) {
+	    $statistic = 1;
+	    $statistic_line_count = 1;
 	} elsif ($a =~ m/--statistic-no-issue/) {
 	    $statistic = 1;
 	    $statistic_no_issue = 1;
@@ -1025,8 +1081,8 @@
     } elsif ($statistic) {
 	if ($statistic_no_issue) {
 	    print_statistic_no_issue (\%unfiltered_patch_list);
-	} elsif ($statistic_breakdown) {
-	    print_statistic_breakdown (\%unfiltered_patch_list);
+	} elsif ($statistic_breakdown || $statistic_line_count) {
+	    print_patch_statistics (\%unfiltered_patch_list);
 	}
     } else {
 	printf "Dry-run: exiting before applying patches\n";



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]