forked from datacharmer/mysql-sandbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
repo_list.pl
53 lines (45 loc) · 1010 Bytes
/
repo_list.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/perl
use strict;
use warnings;
use File::Basename;
my $sandbox_binary = $ENV{SANDBOX_BINARY} || "$ENV{HOME}/opt/mysql";
unless ( -d $sandbox_binary)
{
die "# Directory $sandbox_binary not found\n";
}
my @dirs = map { basename $_ } grep {-d $_} glob ("$sandbox_binary/*/") ;
sub dir_split
{
my ($dir) = @_;
if ($dir =~ /([^.]+)\.(\d+)\.(\d+)/)
{
return ($1, $2, $3);
}
return ;
}
my %test_dirs=();
for my $dir (@dirs)
{
my ($major, $minor, $rev) = dir_split($dir);
next unless $major;
#next if ($major =~ /^full_/);
#unless ($major =~ /^[1-9]/)
unless ($major =~ /^(?:ps|ma)/ or $major =~ /^[1-9]/)
{
next;
}
if ($test_dirs{"$major.$minor"})
{
if ($test_dirs{"$major.$minor"} > $rev)
{
next
}
}
$test_dirs{"$major.$minor"} = $rev;
# print "<$major $minor $rev>\n";
}
#print "\n";
for my $dir (sort keys %test_dirs)
{
print "$dir.$test_dirs{$dir}\n"
}