/[CCFs]/bin/findlatest
ViewVC logotype

Contents of /bin/findlatest

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Wed Nov 26 13:54:34 2003 UTC (21 years ago) by ccflib
Branch: MAIN
Changes since 1.1: +2 -0 lines
Nochanges

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

  ViewVC Help
Powered by ViewVC 1.1.27