Add a small script to check whether a perl source tree
James Mastros [Thu, 6 May 2004 14:45:53 +0000 (16:45 +0200)]
(with or without generated files) is friendly with
case-insensitive filesystems.
Adapted from :
Subject: Re: STerm.pl vs Sterm.pl
Message-ID: <20040506124556.2402.qmail@onion.perl.org>

p4raw-id: //depot/perl@22793

MANIFEST
Porting/checkcase.pl [new file with mode: 0644]

index 293b093..eead0b2 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -2572,6 +2572,7 @@ pod/splitman                      Splits perlfunc into multiple man pages
 pod/splitpod                   Splits perlfunc into multiple pod pages
 Policy_sh.SH           Hold site-wide preferences between Configure runs.
 Porting/apply          Apply patches sent by mail
+Porting/checkcase.pl   Check whether we are case-insensitive-fs-friendly
 Porting/check83.pl     Check whether we are 8.3-friendly
 Porting/checkURL.pl    Check whether we have working URLs
 Porting/checkVERSION.pl        Check whether we have $VERSIONs
diff --git a/Porting/checkcase.pl b/Porting/checkcase.pl
new file mode 100644 (file)
index 0000000..66dccd2
--- /dev/null
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+# Finds the files that have the same name, case insensitively,
+# in the current directory and its subdirectories
+
+use warnings;
+use strict;
+use File::Find;
+
+my %files;
+find(sub {
+          my $name = $File::Find::name;
+          # Assumes that the path separator is exactly one character.
+          $name =~ s/^\.\..//;
+          push @{$files{lc $name}}, $name;
+        }, '.');
+
+my $failed;
+
+foreach (values %files) {
+    if (@$_ > 1) {
+       print join(", ", @$_), "\n";
+       $failed++;
+    }
+}
+
+print "no similarly named files found\n" unless $failed;