/[CCFs]/bin/findlatest
ViewVC logotype

Annotation of /bin/findlatest

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations)
Tue Dec 2 14:57:08 2014 UTC (9 years, 11 months ago) by ccflib
Branch: MAIN
Changes since 1.2: +1 -3 lines
Adapted to work in sasbld01

1 ccflib 1.1 #! /usr/local/bin/perl
2     #
3     # Find latest CCf packages.
4 ccflib 1.2 #
5 ccflib 1.3 # $Id$
6 ccflib 1.1 #
7     use strict;
8     use Env qw(HOME);
9    
10    
11     my $pkgdir="$HOME/deliveries/packages";
12    
13     my %pkglist = ();
14    
15     chdir($pkgdir) || die;
16     foreach(glob("*.tgz")){
17     if(/(.*)-(\d+\.\d+)\.tgz/){
18     if(not exists $pkglist{$1}){
19     $pkglist{$1} = [];
20     }
21     push @{$pkglist{$1}}, $2;
22     } else {
23     warn("File $_ does not seem to be a CCF package.\n");
24     }
25     }
26    
27     foreach(keys %pkglist){
28     my @topv = sort versionally @{$pkglist{$_}};
29     my $topv = shift @topv;
30     print "$pkgdir/$_-$topv.tgz\n";
31     }
32    
33     sub versionally
34     {
35     my ($a1,$a2) = split /\./, $a;
36     my ($b1,$b2) = split /\./, $b;
37    
38     my $biga = $a1 * 1000 + $a2;
39     my $bigb = $b1 * 1000 + $b2;
40    
41     return $bigb <=> $biga;
42     }

  ViewVC Help
Powered by ViewVC 1.1.27