-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhuman.persistence.pl
More file actions
executable file
·100 lines (78 loc) · 2 KB
/
human.persistence.pl
File metadata and controls
executable file
·100 lines (78 loc) · 2 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/usr/bin/perl -I ./thirds -w
# author: lilong'en(lilongen@163.com)
# date: 08/24/2011
#
use strict;
use CcvUtil;
use YAML qw(DumpFile);
use Data::Dumper;
use Storable;
use File::Iterator;
use Definition;
sub help();
sub main();
sub yamlFiles($);
sub listNeed2YamlFiles();
my $DEF = new Definition();
main();
sub main() {
if (($#ARGV + 1) < 2) {
help();
return;
}
my $files = listNeed2YamlFiles();
yamlFiles($files);
}
sub listNeed2YamlFiles() {
my $d = $ARGV[0];
my $t = $ARGV[1];
my $files = [
"operate/$d/$t/$DEF->{MID_DATA_FILE_NAME}->{ALL_MODULES_SUM_INFO}",
"operate/$d/$t/$DEF->{MID_DATA_FILE_NAME}->{PMS}",
"operate/$d/$t/$DEF->{MID_DATA_FILE_NAME}->{TASK_QUEUE}"
];
if (($#ARGV + 1) == 2) { #not yaml data files in mid subdirectory
return $files;
}
my $it = new File::Iterator(DIR => "operate/$d/$t", RECURSE => 0, RETURNDIRS => 1);
my $revsPath = undef;
while (my $f = $it->next()) {
if (-d $f) {
$revsPath = $f;
last;
}
}
if (defined($revsPath)) {
$it = undef;
$it = new File::Iterator(DIR => $revsPath, RECURSE => 0, RETURNDIRS => 1);
while (my $midPath = $it->next()) {
if (-d $midPath) {
push(@{$files}, "$midPath/head/$DEF->{MID_DATA_FILE_NAME}->{CVS_GD_DATA_USER_INFO}");
push(@{$files}, "$midPath/head/$DEF->{MID_DATA_FILE_NAME}->{CVS_GD_DATA}");
push(@{$files}, "$midPath/$DEF->{MID_DATA_FILE_NAME}->{LOG_PARSED_INFO}");
push(@{$files}, "$midPath/$DEF->{MID_DATA_FILE_NAME}->{LOG_PARSED_INFO}.o");
}
}
}
return $files;
}
sub yamlFiles($) {
my $files = $_[0];
for (my $i = 0; $i <= $#{$files}; $i++) {
my $f = "$files->[$i]";
if (-e $f) {
my $tmp = retrieve($f);
DumpFile("$f.yaml", $tmp);
print "done: $f.yaml\n";
} else {
print "$f not exist\n";
}
}
print "\n";
}
sub help() {
print <<"S_Usage";
Usage:
perl $0 %date %time %yamlFilesInMidDirectory
S_Usage
}