Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add new entry in Release_Notes.
[simgrid.git] / tools / cmake / scripts / update_tesh.pl
1 #!/usr/bin/env perl
2
3 # Copyright (c) 2012-2023. 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/--log=([^ ]*)/--log="$1"/g;
38                 print "$line_exec";
39                 chomp $line;
40                 open (FILE, "$line 2>&1|");
41                 while(defined($l=<FILE>))
42                 {
43                 chomp $l;
44                 print "\> $l\n";
45                 }
46                 close(FILE);
47         }
48         else
49         {
50                 if($line =~ /^\>(.*)$/)
51                 {
52                 }
53                 else
54                 {
55                 print "$line";
56                 }
57         }
58 }
59
60 close(SH_LIGNE);