Subversion Repositories camp_sysinfo_client_3

Rev

Rev 203 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

#! /usr/bin/env perl

# Reads files, looking for string 'our' followed by the variable $VERSION', then parses it out
# and sends the version number to STDOUT. The syntax in the file should
# be
# $VERSION = 'x.x'; with the 'our' in front
# where x.x is the version number recorded.

# Output is a tab separated list.
#   Column 1 - file's relative name
#   Column 2 - Version string (may be quote encapsulated)
#   Column 3 - Checksum as calculated by md5sum

# Version 0.2 20191106 RWR
# modified to also get the checksum of the file in the third column

use warnings;
use strict;

our $VERSION = '0.2';

my @out;
my @list = qx( grep -r 'our \$VERSION' * | grep -v '.svn' | grep -v 'old/' | grep -v '~' ); 
my $filename;
chomp @list;
foreach my $item ( @list ) {
   $item =~ s/:/\t/;
   $item =~ s/[;']//g;
   if ( $item =~ m/version->declare/ ) {
      $filename = (split( "\t", $item ) )[0];
      $item = `./$filename --version`;
      chomp $item;      
   } else {
      $item =~ s/our \$VERSION = //;
      $filename = (split( "\t", $item ))[0];
   }
   my $checksum = `md5sum $filename`;
   $checksum = ( split( /[\t\s]/, $checksum ))[0];
   push @out, $item . "\t" . $checksum;
}

print join( "\n", sort @out ) . "\n"


Generated by GNU Enscript 1.6.5.90.