| 1 | #!/usr/bin/perl |
|---|
| 2 | |
|---|
| 3 | ################################# |
|---|
| 4 | # DME: This perl script processes all header files for the |
|---|
| 5 | # latest clearcase check in date/time. It prints the file |
|---|
| 6 | # with the latest date/time. Ideally this should be bsettop.h because |
|---|
| 7 | # any change to the public API requires that BSETTOP_VERSION be incremented. |
|---|
| 8 | ################################# |
|---|
| 9 | |
|---|
| 10 | use POSIX; |
|---|
| 11 | |
|---|
| 12 | $dirname = $ENV{"BSEAV"} . "/api/include"; |
|---|
| 13 | opendir(DIR, $dirname); |
|---|
| 14 | @filelist = grep {/\.h$/} readdir(DIR); |
|---|
| 15 | |
|---|
| 16 | # find the highest clearcase modification time |
|---|
| 17 | $maxtimeval = 0; |
|---|
| 18 | $maxfile="none"; |
|---|
| 19 | |
|---|
| 20 | foreach $file (@filelist) { |
|---|
| 21 | open FILE, "$dirname/$file"; |
|---|
| 22 | read FILE,$_,1024; |
|---|
| 23 | ($filedate, $filetime) = /brcm_Log: \S+ \$\s \* \s \* \S+\s+(\S+) (\S+)/m; |
|---|
| 24 | $_ = "$filedate,$filetime"; |
|---|
| 25 | if (/(.+)\/(.+)\/(.+),(.+):(.+)(\w)/) { |
|---|
| 26 | ($mm,$dd,$yyyy,$hh,$min,$am) = ($1,$2,$3,$4,$5,$6); |
|---|
| 27 | } |
|---|
| 28 | else { |
|---|
| 29 | next; |
|---|
| 30 | } |
|---|
| 31 | |
|---|
| 32 | if ($am eq "p") { |
|---|
| 33 | $hh += 12; |
|---|
| 34 | } |
|---|
| 35 | # print "$mm,$dd,$yyyy,$hh,$min,$am\n"; |
|---|
| 36 | $timeval = mktime(0,$min,$hh,$dd,$mm-1,$yyyy+2000-1900); |
|---|
| 37 | # print "$file = $_ = $timeval\n"; |
|---|
| 38 | |
|---|
| 39 | if (($file eq "bsettop.h" && $timeval == $maxtimeval) || $timeval > $maxtimeval) { |
|---|
| 40 | $maxtimeval = $timeval; |
|---|
| 41 | $maxfile = $file; |
|---|
| 42 | } |
|---|
| 43 | } |
|---|
| 44 | |
|---|
| 45 | # Print the file with the last clearcase modification time |
|---|
| 46 | print "$maxfile\n"; |
|---|