#!/usr/bin/perl # # $Id: capsfix_dir.pl,v 1.1.1.1 2004/08/31 13:33:28 thomasez Exp $ # This piece moves all CAPSed modules to it's own directory in case there are # modules with the same name with and without CAPS. # # It will not handle module paths wit CAPS right now. # (I'm too lazy) # # Thomas Lundquist 2003-09-20 use strict; my $dir = "2.4-std"; # my $dir = "test"; my %files; my %paths; while (<>) { if (/[A-Z]/ && !m/\/caps\//) { my (@mods) = split(/\t/); foreach my $mod (@mods) { my ($path, $module); ($path, $module) = ($1, $2) if ( $mod =~ /(.*)\/([A-Z|a-z|0-9|_|-]+\.o)/ ); if ($module =~ /[A-Z]/) { if (/:/) { $files{$module} = $path; $paths{$path} = 1; } $mod =~ s/(.*)\/([A-Z|a-z|0-9|_|-]+\.o)/$1\/caps\/$2/g; } $mod = "\t$mod" unless ($mod =~ /:/); print $mod; } } else { print; } } # # Only need to make the new path once. # foreach my $p (keys (%paths)) { my ($newpath) = $p . "/caps"; mkdir("$dir/$newpath",0755); } # # Copy files # foreach my $f (keys (%files)) { my ($newpath) = $files{$f} . "/caps"; rename("$dir/$files{$f}/$f", "$dir/$newpath/$f"); }