From: mquinson Date: Tue, 18 Dec 2007 10:49:08 +0000 (+0000) Subject: Move the platform updater into the archive (users will need it) X-Git-Tag: v3.3~718 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/5f1f915e754bd2549f850932b7a3d05cf1e8178f?hp=f9f94df227d53ef89d9cb8748d1241b983c2071a;ds=inline Move the platform updater into the archive (users will need it) git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5132 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/tools/surfxml_update.pl b/tools/surfxml_update.pl new file mode 100755 index 0000000000..d0d7277bd3 --- /dev/null +++ b/tools/surfxml_update.pl @@ -0,0 +1,81 @@ +#! /usr/bin/perl + +# This script updates the simgrid XML file passed as argument (modification in place) +# It is built to do the conversion incrementally (even if for now, only 2 versions are defined) + +# Copyright (C) 2006-2007. The SimGrid team. All rights reserved. +# +# This file is part of the SimGrid project. This is free software: +# You can redistribute and/or modify it under the terms of the +# GNU LGPL (v2.1) licence. + +use strict; + +my $fromversion=-1; +my $toversion=2; + +my($output_string); + +$ARGV[0] or die "simgrid_update_xml.pl \n"; +open INPUT, "$ARGV[0]" or die "Cannot open input file $ARGV[0]: $!\n"; + +$output_string .= "\n"; +$output_string .= "\n"; +$output_string .= ""; + +my $line; +while (defined($line = )) { + chomp $line; + # eat the header, whatever form it has + next if ($line =~ s/<\?xml[^>]*>// && ! $line =~ /\S/); # just in case several tags are on the same line + next if ($line =~ s/]*>// && ! $line =~ /\S/); + next if ($line =~ s/// && ! $line =~ /\S/); + + + if ($line =~ s///) { + $fromversion = 0; + } else if ($line =~ s///) { + $fromversion = $1; + if ($fromversion == $toversion) { + warn "Input platform file version is already $fromversion. This should be a no-op.\n"; + } + if ($fromversion > $toversion) { + die "Input platform file version is more recent than this script (file version: $fromversion; script version: $toversion)\n"; + } + } + + if ($fromversion == 0) { + while ($line =~ m|^(.*?) $ARGV[0]"; +print OUTPUT $output_string; +close OUTPUT;