diff options
| author | Sergio Ahumada <sergio.ahumada@nokia.com> | 2011-01-19 01:23:25 +0100 |
|---|---|---|
| committer | Sergio Ahumada <sergio.ahumada@nokia.com> | 2011-01-19 01:23:25 +0100 |
| commit | 9dbc3da14f2dca25f24dd346d996ed95fb9101e9 (patch) | |
| tree | ba4915ef7fd30d3aded9645d05d81b18e52c4fa7 /scripts | |
| parent | 7af7ec23e722e315420c36268a85b45a2de63f13 (diff) | |
BM2: Fix reading of XML
There were lots of errors while reading a huge XML to just use
some fields.
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/bm2_result_watcher.pl | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/scripts/bm2_result_watcher.pl b/scripts/bm2_result_watcher.pl index 7471e8e..8d4e0ae 100755 --- a/scripts/bm2_result_watcher.pl +++ b/scripts/bm2_result_watcher.pl @@ -23,9 +23,6 @@ use strict; use warnings; use POSIX; use File::Pid; -use XML::Simple; - -# make "mydaemon.log" file in /var/log/ with "chown root:adm mydaemon" my $daemonName = "bm2resultwatcher"; # @@ -73,17 +70,27 @@ until ($dieNow) { my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time); my $timestamp = mktime($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,-1); + my $hostname; + my $platform; + my $branch; + my $sha1; opendir(D, $workdir) || die logEntry("Can't opedir: $!\n"); while (my $f = readdir(D)) { if ($f =~ /xml/ ) { - my $xml = new XML::Simple; - my $data = $xml->XMLin($workdir . $f); + open(FILE, $workdir . $f); + while (my $fi = <FILE>) { + if ($fi =~ /<HostName>(.*)<\/HostName>/) { $hostname = $1; next; } + if ($fi =~ /<MakeSpec>(.*)<\/MakeSpec>/) { $platform = $1; next; } + if ($fi =~ /<ChangeNumber>(.*)<\/ChangeNumber>/) { $sha1 = $1; next; } + if ($fi =~ /<Branch>(.*)<\/Branch>/) { $branch = $1; last; } + } + close(FILE); my @args = ( "/home/qt/bm2/scripts/uploadresults.py", - $data->{Environment}->{HostName}, - $data->{Environment}->{MakeSpec}, - $data->{Environment}->{Branch}, - $data->{Environment}->{ChangeNumber}, + $hostname, + $platform, + $branch, + $sha1, $timestamp, $workdir . $f, "bm" ); |
