Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines with new year.
[simgrid.git] / tools / cmake / scripts / update_tesh.pl
1 #!/usr/bin/env perl
2
3 # Copyright (c) 2012-2020. The SimGrid Team.
4 # All rights reserved.
5
6 # This program is free software; you can redistribute it and/or modify it
7 # under the terms of the license (GNU LGPL) which comes with this package.
8
9 use strict;
10 use warnings;
11
12 if($#ARGV!=1) {
13     die "Usage: perl update_tesh.pl <directory> <old.tesh>\n";
14 }
15
16 my($directory)=$ARGV[0];
17 my($old)=$ARGV[1];
18
19 chdir("$directory");
20
21 open SH_LIGNE, $old or die "Unable to open $old. $!\n";
22
23 my($line);
24 my($line_exec);
25 my($l);
26 my($tmp);
27
28 while(defined($line=<SH_LIGNE>))
29 {
30         if($line =~ /^\$(.*)$/)
31         {
32                 $line_exec = $line;
33                 $line =~ s/\$\{srcdir\:\=\.\}/./g;
34                 $line =~ s/\(/\\(/g;
35                 $line =~ s/\)/\\)/g;
36                 $line =~ s/^\$\ */.\//g;
37                 $line =~ s/^.\/lua/lua/g;
38                 $line =~ s/^.\/ruby/ruby/g;
39                 $line =~ s/--log=([^ ]*)/--log="$1"/g;
40                 print "$line_exec";
41                 chomp $line;
42                 open (FILE, "$line 2>&1|");
43                 while(defined($l=<FILE>))
44                 {
45                 chomp $l;
46                 print "\> $l\n";
47                 }
48                 close(FILE);
49         }
50         else
51         {
52                 if($line =~ /^\>(.*)$/)
53                 {
54                 }
55                 else
56                 {
57                 print "$line";
58                 }
59         }       
60 }
61
62 close(SH_LIGNE);