Subversion Repositories camp_sysinfo_client_3

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
57 rodolico 1
#! /usr/bin/env perl
26 rodolico 2
 
129 rodolico 3
# Reads files, looking for string 'our' followed by the variable $VERSION', then parses it out
4
# and sends the version number to STDOUT. The syntax in the file should
5
# be
6
# $VERSION = 'x.x'; with the 'our' in front
7
# where x.x is the version number recorded.
8
 
9
# Output is a tab separated list.
10
#   Column 1 - file's relative name
11
#   Column 2 - Version string (may be quote encapsulated)
12
#   Column 3 - Checksum as calculated by md5sum
13
 
14
# Version 0.2 20191106 RWR
15
# modified to also get the checksum of the file in the third column
16
 
57 rodolico 17
use warnings;
18
use strict;
26 rodolico 19
 
129 rodolico 20
our $VERSION = '0.2';
21
 
57 rodolico 22
my @out;
23
my @list = qx( grep -r 'our \$VERSION' * | grep -v '.svn' | grep -v 'old/' | grep -v '~' ); 
154 rodolico 24
my $filename;
57 rodolico 25
chomp @list;
26
foreach my $item ( @list ) {
27
   $item =~ s/:/\t/;
28
   $item =~ s/[;']//g;
154 rodolico 29
   if ( $item =~ m/version->declare/ ) {
30
      $filename = (split( "\t", $item ) )[0];
31
      $item = `./$filename --version`;
32
      chomp $item;      
33
   } else {
34
      $item =~ s/our \$VERSION = //;
35
      $filename = (split( "\t", $item ))[0];
36
   }
129 rodolico 37
   my $checksum = `md5sum $filename`;
38
   $checksum = ( split( /[\t\s]/, $checksum ))[0];
39
   push @out, $item . "\t" . $checksum;
57 rodolico 40
}
41
 
42
print join( "\n", sort @out ) . "\n"
43