lilypond-1.0.16
[lilypond.git] / bin / show-latest.pl
blob2b2c994d000666f82e45bd18e5ae3fdd37ceaa68
1 #!@PERL@
2 # -*-Perl-*-
4 $LILYPOND_SOURCEDIR="$ENV{LILYPOND_SOURCEDIR}";
5 $LILYPOND_ROOTDIR=`cd $LILYPOND_SOURCEDIR/..; pwd`;
6 chop ($LILYPOND_ROOTDIR);
7 $reldir="$LILYPOND_ROOTDIR/releases";
9 use FileHandle;
10 use Getopt::Long;
12 sub cmpver
14 my(@a)= split( /\./, $a);
15 my(@b)= split( /\./, $b);
17 for $i (0,1,2) {
18 return $a[$i] <=> $b[$i] if ($a[$i] != $b[$i]);
20 return $a cmp $b;
23 my @versions;
24 open LS, "ls -1 $reldir|";
26 GetOptions( 'print', 'news', 'latest');
29 while (<LS>) {
30 $_ =~ /lilypond-([^.]+\.[^.]+\.[^.]+).tar.gz/;
31 push @versions, $1;
35 @versions = sort cmpver @versions;
36 my $last= (pop @versions);
39 if ( $opt_print ) {
40 print $last . "\n";
43 if ( $opt_latest) {
44 system "rm $reldir/zZ*";
45 system "> $reldir/zZ_LATEST_IS_$last";
47 if ( $opt_news ) {
48 open NEWS, "tar --to-stdout -zxf $reldir/lilypond-$last.tar.gz lilypond-$last/NEWS |";
49 input_record_separator NEWS "****";
50 $desc = <NEWS>;
51 chop ($desc);
52 close NEWS;
54 print $desc;