[commit: ghc] wip/rip-out-perl: Drop utils/count_lines (a69ab41)

git at git.haskell.org git at git.haskell.org
Sat Mar 9 07:09:06 UTC 2019


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/rip-out-perl
Link       : http://ghc.haskell.org/trac/ghc/changeset/a69ab41963a634c187a4f3705af91af550aa2bf9/ghc

>---------------------------------------------------------------

commit a69ab41963a634c187a4f3705af91af550aa2bf9
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Fri Mar 8 10:29:42 2019 -0500

    Drop utils/count_lines
    
    This doesn't appear to be used anywhere in the build system and it
    relies on perl. Drop it.


>---------------------------------------------------------------

a69ab41963a634c187a4f3705af91af550aa2bf9
 ghc.mk                           |  1 -
 utils/count_lines/count_lines.pl | 69 ----------------------------------------
 utils/count_lines/ghc.mk         |  4 ---
 3 files changed, 74 deletions(-)

diff --git a/ghc.mk b/ghc.mk
index 0eae0fc..fea964b 100644
--- a/ghc.mk
+++ b/ghc.mk
@@ -665,7 +665,6 @@ BUILD_DIRS += utils/hpc
 BUILD_DIRS += utils/runghc
 BUILD_DIRS += ghc
 BUILD_DIRS += docs/users_guide
-BUILD_DIRS += utils/count_lines
 BUILD_DIRS += utils/compare_sizes
 BUILD_DIRS += utils/iserv
 
diff --git a/utils/count_lines/count_lines.pl b/utils/count_lines/count_lines.pl
deleted file mode 100644
index a54f163..0000000
--- a/utils/count_lines/count_lines.pl
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/usr/bin/env perl
-
-use FindBin;
-
-%DirCount = ();
-%ModCount = ();
-%DirComments = ();
-%ModComments = ();
-
-my $binPath = $FindBin::Bin;
-
-foreach $f ( @ARGV ) {
-
-    if ( $f =~ /\.lhs$/ ) {
-        open(INF, "$binPath/../../inplace/lib/unlit $f - |") || die "Couldn't unlit $f!\n";
-    } else {
-        open(INF, "< $f") || die "Couldn't open $f!\n";
-    }
-    $cnt = 0;
-    while (<INF>) {
-        s/--.*//;
-        s/{-.*-}//;
-        s/\/\/.*//;
-        next if /^\s*$/;
-        $cnt++;
-    }
-    close(INF);
-
-    $f_wc = `wc $f`; die "wc failed: $f\n" if $? != 0;
-    if ( $f_wc =~ /\s*(\d+)\s*(\d+)\s*(\d+)/ ) {
-        $comments = $1 - $cnt;
-    } else {
-        die "Can't grok wc format: $f_wc";
-    }
-
-    if ( $f =~ /(.*)\/(.*)/ ) {
-        local($dir) = $1;
-        local($mod) = $2;
-        $DirCount{$dir} += $cnt;
-        $ModCount{$mod} += $cnt;
-        $DirComments{$dir} += $comments;
-        $ModComments{$mod} += $comments;
-    } else {
-        print STDERR "not counted in a directory: $f\n";
-        $ModCount{$f} += $cnt;
-        $ModComments{$f} += $comments;
-    }
-}
-
-# print the info
-$tot = 0;
-$totcmts = 0;
-printf "\n                      Code  Comments\n";
-foreach $d (sort (keys %DirCount)) {
-    printf "%-20s %6d %6d\n", $d, $DirCount{$d}, $DirComments{$d};
-    $tot     += $DirCount{$d};
-    $totcmts += $DirComments{$d};
-}
-printf "\n%-20s %6d %6d\n\n\n", 'TOTAL:', $tot, $totcmts;
-
-$tot = 0;
-$totcmts = 0;
-printf "\n                      Code  Comments\n";
-foreach $m (sort (keys %ModCount)) {
-    printf "%-20s %6d %6d\n", $m, $ModCount{$m}, $ModComments{$m};
-    $tot += $ModCount{$m};
-    $totcmts += $ModComments{$m};
-}
-printf "\n%-20s %6d %6d\n", 'TOTAL:', $tot, $totcmts;
diff --git a/utils/count_lines/ghc.mk b/utils/count_lines/ghc.mk
deleted file mode 100644
index 5fec518..0000000
--- a/utils/count_lines/ghc.mk
+++ /dev/null
@@ -1,4 +0,0 @@
-utils/count_lines_PERL_SRC  = count_lines.pl
-utils/count_lines_dist_PROGNAME = count_lines
-
-$(eval $(call build-perl,utils/count_lines,dist))



More information about the ghc-commits mailing list