]> git.donarmstrong.com Git - lilypond.git/blob - bin/show-latest.pl
release: 0.1.63
[lilypond.git] / bin / show-latest.pl
1 #!@PERL@
2 # -*-Perl-*-
3
4 $LILYPOND_SOURCEDIR="$ENV{LILYPOND_SOURCEDIR}";
5 $LILYPOND_ROOTDIR=`cd $LILYPOND_SOURCEDIR/..; pwd`;
6 chop ($LILYPOND_ROOTDIR);
7 $reldir="$LILYPOND_ROOTDIR/releases";
8
9 use FileHandle;
10 use Getopt::Long;
11
12 sub cmpver 
13 {       
14     my(@a)= split( /\./, $a);
15     my(@b)= split( /\./, $b);
16     
17     for $i (0,1,2) {
18         return $a[$i] <=> $b[$i] if ($a[$i] != $b[$i]);
19     }
20     return $a cmp $b;
21 }
22
23 my @versions;
24 open LS, "ls -1 $reldir|";
25
26 GetOptions( 'print', 'news', 'latest');
27
28
29 while (<LS>) {
30     $_ =~ /lilypond-([^.]+\.[^.]+\.[^.]+).tar.gz/;
31     push @versions, $1;
32 }
33
34
35 @versions = sort cmpver @versions;
36 my $last= (pop @versions);
37
38
39 if (  $opt_print ) {
40     print $last . "\n";
41 }
42
43 if ( $opt_latest) {
44     system "rm $reldir/zZ*";
45     system  "> $reldir/zZ_LATEST_IS_$last";
46 }
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;
53
54     print $desc;
55 }