sbs_findstr.pl inserts the target attribute into the status, for quick grepping. The sbs_quickstatus.pl does this for all <status> elements
authorWilliam Roberts <williamr@symbian.org>
Wed, 10 Jun 2009 17:17:58 +0100
changeset 7 705136d2022f
parent 6 c34a018f3291
child 8 2184cc44590a
sbs_findstr.pl inserts the target attribute into the status, for quick grepping. The sbs_quickstatus.pl does this for all <status> elements
williamr/sbs_findstr.pl
williamr/sbs_quickstatus.pl
--- a/williamr/sbs_findstr.pl	Wed Jun 10 17:16:09 2009 +0100
+++ b/williamr/sbs_findstr.pl	Wed Jun 10 17:17:58 2009 +0100
@@ -19,6 +19,7 @@
 my $expression = shift @ARGV;
 my $line;
 my $skipping = 1;
+my $current_target = "";
 
 @ARGV = map {glob} @ARGV;
 
@@ -35,11 +36,21 @@
     if ($line =~ /$expression/io)
       {
       $skipping = 0;
+      $current_target = "";
+      if ($line =~ /(target='[^']+') /)
+        {
+        $current_target = $1;
+        }
       }
     else
       {
       $skipping = 1;
       }
     }
-  print $line if ($skipping == 0);  
+  next if ($skipping == 1);  
+  if (substr($line,0,8) eq "<status ")
+    {
+    substr($line,-3) = "$current_target />\n";
+    }
+  print $line;
   }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/williamr/sbs_quickstatus.pl	Wed Jun 10 17:17:58 2009 +0100
@@ -0,0 +1,60 @@
+#! perl
+
+# Copyright (c) 2009 Symbian Foundation Ltd
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Symbian Foundation Ltd - initial contribution.
+# 
+# Contributors:
+#
+# Description:
+# Filter an SBSv2 log to keep only status lines, with added target and recipe names
+
+use strict;
+
+my $line;
+my $current_target = "";
+my $recipe_name = "";
+
+@ARGV = map {glob} @ARGV;
+
+while ($line =<>)
+  {
+  my $prefix = substr($line,0,8);
+  if ($prefix eq "<recipe ")
+    {
+    $current_target = "";
+    if ($line =~ /(name='[^']+').*(target='[^']+')/)
+      {
+      $recipe_name = $1;
+      $current_target = $2;
+      }
+    next;
+    }
+  if ($prefix eq "+ EXTMAK")
+    {
+    if ($line =~ / (EXTMAKEFILENAME=.*)$/)
+      {
+      $current_target = "comment='$1'";  # target for EXTMAKEFILE is not interesting
+      }
+    next;
+    }
+  if ($prefix eq "+ TEMPLA") 
+    {
+    if ($line =~ / (TEMPLATE_EXTENSION_MAKEFILE=.*)$/)
+      {
+      $current_target = "comment='$1'";  # target for templated extensions is not interesting
+      }
+    next;
+    }
+  if ($prefix eq "<status ")
+    {
+    substr($line,-3) = "$recipe_name $current_target />\n";
+    print $line;
+    next;
+    }
+  }
\ No newline at end of file