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 '~' ); 
24
chomp @list;
25
foreach my $item ( @list ) {
26
   $item =~ s/:/\t/;
27
   $item =~ s/[;']//g;
28
   $item =~ s/our \$VERSION = //;
129 rodolico 29
   my $filename = (split( "\t", $item ))[0];
30
   my $checksum = `md5sum $filename`;
31
   $checksum = ( split( /[\t\s]/, $checksum ))[0];
32
   push @out, $item . "\t" . $checksum;
57 rodolico 33
}
34
 
35
print join( "\n", sort @out ) . "\n"
36