~ubuntu-branches/ubuntu/feisty/apache2/feisty

« back to all changes in this revision

Viewing changes to srclib/apr/build/fixwin32mak.pl

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Barth
  • Date: 2006-12-09 21:05:45 UTC
  • mfrom: (0.6.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061209210545-h70s0xaqc2v8vqr2
Tags: 2.2.3-3.2
* Non-maintainer upload.
* 043_ajp_connection_reuse: Patch from upstream Bugzilla, fixing a critical
  issue with regard to connection reuse in mod_proxy_ajp.
  Closes: #396265

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# fixwin32mak.pl ::: Apache/Win32 maintanace program
 
3
#
 
4
# This program, launched from the build/ directory, replaces all nasty absoulute paths
 
5
# in the win32 .mak files with the appropriate relative root.
 
6
#
 
7
# Run this program prior to committing or packaging any newly exported make files.
 
8
 
 
9
use Cwd;
 
10
use IO::File;
 
11
use File::Find;
 
12
 
 
13
$root = cwd;
 
14
# ignore our own direcory (allowing us to move into any parallel tree)
 
15
$root =~ s|^.:(.*)?$|cd "$1|;
 
16
$root =~ s|/|\\\\|g;
 
17
print "Testing " . $root . "\n";
 
18
find(\&fixcwd, '.');
 
19
 
 
20
sub fixcwd { 
 
21
    if (m|.mak$|) {
 
22
        $thisroot = $File::Find::dir;
 
23
        $thisroot =~ s|^./(.*)$|$1|;
 
24
        $thisroot =~ s|/|\\\\|g;
 
25
        $thisroot = $root . "\\\\" . $thisroot;
 
26
        $oname = $_;
 
27
        $tname = '.#' . $_;
 
28
        $verchg = 0;
 
29
#print "Processing " . $thisroot . " of " . $_ . "\n";
 
30
        $srcfl = new IO::File $_, "r" || die;
 
31
        $dstfl = new IO::File $tname, "w" || die;
 
32
        while ($src = <$srcfl>) {
 
33
            if ($src =~ m|^\s*($root[^\"]*)\".*$|) {
 
34
#print "Found " . $1 . "\"\n";
 
35
                $orig = $thisroot;
 
36
                $repl = "cd \".";
 
37
                while (!($src =~ s|$orig|$repl|)) {
 
38
#print "Tried replacing " . $orig . " with " . $repl . "\n";
 
39
                   if (!($orig =~ s|^(.*)\\\\[^\\]+$|$1|)) {
 
40
                       break;
 
41
                   }
 
42
                   $repl .= "\\..";
 
43
                }
 
44
#print "Replaced " . $orig . " with " . $repl . "\n";
 
45
                $verchg = -1;
 
46
            }
 
47
            print $dstfl $src; 
 
48
        }
 
49
        undef $srcfl;
 
50
        undef $dstfl;
 
51
        if ($verchg) {
 
52
            unlink $oname || die;
 
53
            rename $tname, $oname || die;
 
54
            print "Corrected absolute paths within " . $oname . " in " . $File::Find::dir . "\n"; 
 
55
        }
 
56
        else {
 
57
            unlink $tname;
 
58
        }
 
59
        $dname = $oname;
 
60
        $dname =~ s/.mak$/.dsp/;
 
61
        @dstat = stat($dname);
 
62
        @ostat = stat($oname);    
 
63
        if ($ostat[9] && $dstat[9] && ($ostat[9] != $dstat[9])) {
 
64
            @onames = ($oname);
 
65
            utime $dstat[9], $dstat[9], @onames;
 
66
            print "Touched datestamp for " . $oname . " in " . $File::Find::dir . "\n"; 
 
67
        }
 
68
        $oname =~ s/.mak$/.dep/;
 
69
        @ostat = stat($oname);    
 
70
        if ($ostat[9] && $dstat[9] && ($ostat[9] != $dstat[9])) {
 
71
            @onames = ($oname);
 
72
            utime $dstat[9], $dstat[9], @onames;
 
73
            print "Touched datestamp for " . $oname . " in " . $File::Find::dir . "\n"; 
 
74
        }
 
75
    }
 
76
}