2011-03-07 12:53:30 +01:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
|
|
|
sub cd ($);
|
|
|
|
|
|
|
|
my $ver = `bash util/ver`;
|
|
|
|
chomp $ver;
|
|
|
|
|
|
|
|
cd "ngx_openresty-$ver/bundle";
|
|
|
|
|
|
|
|
opendir(my $dh, '.') or
|
|
|
|
die "cannot opendir .: $!";
|
|
|
|
|
|
|
|
my @dirs = grep { /\d+\.\d+/ && -d "$_" } readdir($dh);
|
|
|
|
|
|
|
|
closedir $dh;
|
|
|
|
|
|
|
|
cd '../../t';
|
|
|
|
|
|
|
|
opendir($dh, '.') or
|
|
|
|
die "cannot opendir .: $!";
|
|
|
|
|
|
|
|
my @t_files = grep { /\.t$/ } readdir($dh);
|
|
|
|
|
|
|
|
closedir $dh;
|
|
|
|
|
|
|
|
for my $t_file (@t_files) {
|
|
|
|
open my $in, $t_file or
|
|
|
|
die "Cannot open $t_file for reading: $!\n";
|
|
|
|
|
|
|
|
my $outfile = $t_file . '_';
|
|
|
|
open my $out, ">$outfile" or
|
|
|
|
die "Cannot open $outfile for writing: $!\n";
|
|
|
|
|
|
|
|
my $changed;
|
|
|
|
while (<$in>) {
|
|
|
|
for my $dir (@dirs) {
|
2012-05-14 07:35:04 +02:00
|
|
|
(my $pat = $dir) =~ s/-(\d+\..*)/-/;
|
2011-03-07 12:53:30 +01:00
|
|
|
my $orig = $_;
|
|
|
|
if (s{\.\./$pat\S+}{../$dir}g && $orig ne $_) {
|
|
|
|
$changed++;
|
|
|
|
|
2011-05-13 09:37:45 +02:00
|
|
|
warn "\n- $orig";
|
|
|
|
warn "+ $_";
|
2011-08-04 14:34:15 +02:00
|
|
|
|
|
|
|
} elsif (s{ngx_openresty-\d+\.\d+\.\d+\.\d+(?:rc\d+)?}{ngx_openresty-$ver} && $orig ne $_) {
|
|
|
|
$changed++;
|
|
|
|
|
|
|
|
warn "\n- $orig";
|
|
|
|
warn "+ $_";
|
|
|
|
|
2011-08-11 04:04:00 +02:00
|
|
|
} elsif (s{OPENRESTY_BUILD_DIR/$pat[^/ \t\n\w]*\d[^/ \t\n]*}{OPENRESTY_BUILD_DIR/$dir}g && $orig ne $_) {
|
2011-05-13 09:37:45 +02:00
|
|
|
$changed++;
|
|
|
|
|
|
|
|
warn "\n- $orig";
|
|
|
|
warn "+ $_";
|
2011-07-23 05:55:35 +02:00
|
|
|
} elsif (s{^cd $pat[^/ \t\n]+}{cd $dir}g && $orig ne $_) {
|
2011-05-13 09:37:45 +02:00
|
|
|
$changed++;
|
|
|
|
|
2011-03-07 12:53:30 +01:00
|
|
|
warn "\n- $orig";
|
|
|
|
warn "+ $_";
|
|
|
|
}
|
2011-05-13 09:37:45 +02:00
|
|
|
|
2011-03-07 12:53:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
print $out $_;
|
|
|
|
}
|
|
|
|
|
|
|
|
close $out;
|
|
|
|
|
|
|
|
warn "Wrote t/$outfile\n";
|
|
|
|
|
|
|
|
close $in;
|
|
|
|
}
|
|
|
|
|
2011-07-01 06:25:35 +02:00
|
|
|
print join("\n", map { /^LuaJIT/ ? "* ~$_" : "* $_" } sort @dirs), "\n";
|
2011-03-07 12:53:30 +01:00
|
|
|
|
|
|
|
sub cd ($) {
|
|
|
|
my $dir = shift;
|
|
|
|
print("cd $dir\n");
|
|
|
|
chdir $dir or die "failed to cd $dir: $!\n";
|
|
|
|
}
|
|
|
|
|