common/tools/bitops.pl
author Dario Sestito <darios@symbian.org>
Fri, 09 Jul 2010 17:55:07 +0100
changeset 1158 739036c00f80
child 1162 1127dea6b78b
permissions -rw-r--r--
Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     1
use strict;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     2
use Date::Calc qw{Delta_DHMS This_Year};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     3
use DBI;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     4
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     5
use Getopt::Long;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     6
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     7
my $help = 0;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     8
my $create = 0;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     9
my $id = '';
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    10
my $file = '';
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    11
my $verbose = 0;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    12
GetOptions((
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    13
	'create!' => \$create,
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    14
	'file=s' => \$file,
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    15
	'id=s' => \$id,
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    16
	'help!' => \$help,
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    17
	'verbose!' => \$verbose
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    18
));
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    19
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    20
if ($help||!$file)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    21
{
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    22
  print <<_EOH;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    23
bitops
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    24
Executes operations on the BIT db
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    25
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    26
Usage: bitops.pl [-c|-i ID] -f FILE
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    27
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    28
Options:
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    29
  -h, --help            Show this help message and exit
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    30
  -c, --create          Create entry for a new build then set the attributes to
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    31
                        the values provided in FILE. Returns the build id for
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    32
                        the newly created build.
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    33
  -i ID, --id ID        Update entry for build number ID with the values
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    34
                        provided in FILE.
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    35
  -f FILE, --file FILE  Use attributes in FILE to create/update the build info
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    36
                        See below for file format.
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    37
  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    38
File format:
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    39
  File must be a list of attribute-value-pairs. One avp per line, on each line
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    40
  attribute and value are separated by a tab.
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    41
  These are the supported attributes (in brackets the syntax of the value):
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    42
  - build_id_string
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    43
  - package (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    44
  - platform (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    45
  - started (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    46
  - finished (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    47
  - creator (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    48
  - machine (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    49
  - build_brag (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    50
  - test_brag (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    51
  - baseline_short (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    52
  - sources_short (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    53
  - envinfo (TOOL,VERSION)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    54
  - failure (CATEGORY,COUNT)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    55
  - report (NAME,URL,TYPE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    56
  - content (NAME,URL,REVISION)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    57
  - label (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    58
_EOH
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    59
	exit(0);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    60
}
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    61
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    62
my $db = undef;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    63
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    64
my $builds_entry = {};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    65
my $envinfo = [];
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    66
my $failures = [];
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    67
my $reports = [];
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    68
my $content = [];
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    69
my $labels = [];
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    70
my $testing_entry = {};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    71
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    72
sub ConnectToDB()
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    73
{
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    74
	$db = DBI->connect('DBI:mysql:bit:v800016:3306','fbf','mysql')
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    75
		or die("Couldn't connect to database: " . DBI->errstr());
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    76
}
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    77
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    78
sub DisconnectFromDB()
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    79
{
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    80
	$db->disconnect();
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    81
}
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    82
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    83
sub parse_file
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    84
{
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    85
  my ($file) = @_;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    86
  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    87
  open(FILE, $file) or die "Can't open file $file";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    88
  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    89
  while (<FILE>)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    90
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    91
    my $line = $_;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    92
    chomp $line;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    93
    $line =~ s/^\s//g;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    94
    $line =~ s/\s$//g;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    95
    next if ($line !~ /[^\s]/);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    96
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    97
    if ($line =~ /([^\t]+)\t([^\t]+)/)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    98
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    99
      my $attr = $1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   100
      my $value = $2;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   101
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   102
      if ($attr =~ /^(build_id_string|package|platform|started|finished|creator|machine|build_brag|test_brag|baseline_short|sources_short)$/i)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   103
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   104
        $attr = lc($attr);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   105
        print " found ($attr,$value) for table 'build'\n" if ($verbose);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   106
        $builds_entry->{$attr}=$value;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   107
      }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   108
      elsif ($attr =~ /^(envinfo)$/i)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   109
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   110
        $attr = lc($attr);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   111
        if ($value =~ /([^,]*),([^,]*)/)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   112
        {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   113
          my $tool = $1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   114
          my $version = $2;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   115
          
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   116
          if (!$tool || !$version)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   117
          {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   118
            print "ERROR: Tool or version empty: \"$value\"\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   119
            return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   120
          }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   121
          print " found ($tool,$version) for table 'envinfo'\n" if ($verbose);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   122
          push(@{$envinfo}, {tool=>$tool, version=>$version});
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   123
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   124
        else
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   125
        {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   126
          print "ERROR: Could not understand value of envinfo: \"$value\"\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   127
          return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   128
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   129
      }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   130
      elsif ($attr =~ /^(failure)$/i)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   131
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   132
        $attr = lc($attr);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   133
        if ($value =~ /([^,]*),([^,]*)/)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   134
        {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   135
          my $category = $1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   136
          my $count = $2;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   137
          
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   138
          if (!$category || !$count)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   139
          {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   140
            print "ERROR: Category or count empty: \"$value\"\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   141
            return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   142
          }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   143
          print " found ($category,$count) for table 'failures'\n" if ($verbose);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   144
          push(@{$failures}, {category=>$category, count=>$count});
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   145
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   146
        else
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   147
        {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   148
          print "ERROR: Could not understand value of failure: \"$value\"\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   149
          return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   150
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   151
      }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   152
      elsif ($attr =~ /^(report)$/i)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   153
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   154
        $attr = lc($attr);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   155
        if ($value =~ /([^,]*),([^,]*),([^,]*)/)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   156
        {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   157
          my $name = $1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   158
          my $url = $2;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   159
          my $type = $3;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   160
          
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   161
          if (!$name || !$url || !$type)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   162
          {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   163
            print "ERROR: Name, url or type empty: \"$value\"\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   164
            return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   165
          }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   166
          print " found ($name,$url,$type) for table 'reports'\n" if ($verbose);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   167
          push(@{$reports}, {name=>$name, url=>$url, type=>$type});
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   168
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   169
        else
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   170
        {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   171
          print "ERROR: Could not understand value of report: \"$value\"\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   172
          return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   173
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   174
      }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   175
      elsif ($attr =~ /^(content)$/i)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   176
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   177
        $attr = lc($attr);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   178
        if ($value =~ /([^,]*),([^,]*),([^,]*)/)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   179
        {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   180
          my $name = $1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   181
          my $url = $2;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   182
          my $revision = $3;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   183
          
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   184
          if (!$name || !$url || !$revision)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   185
          {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   186
            print "ERROR: Name, url or revision empty: \"$value\"\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   187
            return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   188
          }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   189
          print " found ($name,$url,$revision) for table 'content'\n" if ($verbose);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   190
          push(@{$reports}, {name=>$name, url=>$url, revision=>$revision});
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   191
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   192
        else
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   193
        {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   194
          print "ERROR: Could not understand value of content: \"$value\"\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   195
          return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   196
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   197
      }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   198
      elsif ($attr =~ /^(label)$/i)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   199
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   200
        print " found ($attr,$value) for table 'labels'\n" if ($verbose);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   201
        push(@{$labels}, {label=>$value});
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   202
      }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   203
      else
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   204
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   205
        print "ERROR: Could not understand avp: \"$line\"\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   206
        return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   207
      }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   208
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   209
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   210
    else
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   211
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   212
      print "WARNING: line \"$line\" does not seem a correctly formed attribute-value-pair (tab-separated)\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   213
      return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   214
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   215
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   216
  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   217
  close(FILE);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   218
  return 0;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   219
}
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   220
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   221
# MAIN PROGRAM
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   222
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   223
my $r=parse_file($file);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   224
if ($r)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   225
{
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   226
  print "Error while parsing file $file\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   227
  exit(1);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   228
}
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   229
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   230
ConnectToDB();
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   231
my $newbuildid = -1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   232
if ($create)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   233
{
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   234
  if (keys %{$builds_entry})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   235
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   236
    my $field_list = '';
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   237
    my $qm_list = '';
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   238
    my @fields = ();
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   239
    for my $field (keys %{$builds_entry})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   240
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   241
      $field_list .= "$field,";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   242
      $qm_list .= "?,";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   243
      push(@fields,$builds_entry->{$field});
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   244
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   245
    $field_list =~ s/,$//;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   246
    $qm_list =~ s/,$//;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   247
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   248
    my $query = $db->prepare("insert into builds ($field_list) values ($qm_list)")
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   249
      or die("Couldn't prepare query insert into builds: " . $db->errstr());
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   250
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   251
    $query->execute(@fields)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   252
		  or print "WARNING: Couldn't execute insert into builds (@fields): " . $db->errstr() . "\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   253
		  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   254
		$newbuildid = $db->last_insert_id(undef, undef, undef, undef);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   255
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   256
  if (@{$envinfo})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   257
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   258
    my $query = $db->prepare_cached("insert into envinfo (build_id,tool,version) values ($newbuildid,?,?)")
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   259
      or die("Couldn't prepare query insert into envinfo: " . $db->errstr());
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   260
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   261
    for my $entry (@{$envinfo})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   262
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   263
      my $tool = $entry->{tool};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   264
      my $version = $entry->{version};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   265
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   266
      $query->execute($tool, $version)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   267
		    or print "WARNING: Couldn't execute insert into envinfo ($tool,$version): " . $db->errstr() . "\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   268
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   269
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   270
  if (@{$failures})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   271
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   272
    print " prepare_cached 'insert into failures (build_id,category,count) values ($newbuildid,?,?)'\n" if ($verbose);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   273
    my $query = $db->prepare_cached("insert into failures (build_id,category,count) values ($newbuildid,?,?)")
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   274
      or die("Couldn't prepare query insert into failures: " . $db->errstr());
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   275
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   276
    for my $entry (@{$failures})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   277
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   278
      my $category = $entry->{category};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   279
      my $count = $entry->{count};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   280
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   281
      print " execute '$category, $count'\n" if ($verbose);  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   282
      $query->execute($category, $count)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   283
		    or print "WARNING: Couldn't execute insert into failures ($category,$count): " . $db->errstr() . "\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   284
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   285
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   286
  if (@{$reports})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   287
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   288
    print " prepare_cached 'insert into reports (build_id,name,url,type) values ($newbuildid,?,?,?)'\n" if ($verbose);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   289
    my $query = $db->prepare_cached("insert into reports (build_id,name,url,type) values ($newbuildid,?,?,?)")
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   290
      or die("Couldn't prepare query insert into reports: " . $db->errstr());
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   291
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   292
    for my $entry (@{$reports})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   293
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   294
      my $name = $entry->{name};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   295
      my $url = $entry->{url};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   296
      my $type = $entry->{type};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   297
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   298
      print " execute '$name, $url, $type'\n" if ($verbose);  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   299
      $query->execute($name, $url, $type)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   300
		    or print "WARNING: Couldn't execute insert into reports ($name,$url,$type): " . $db->errstr() . "\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   301
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   302
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   303
  if (@{$content})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   304
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   305
    print " prepare_cached 'insert into content (build_id,name,url,revision) values ($newbuildid,?,?,?)'\n" if ($verbose);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   306
    my $query = $db->prepare_cached("insert into content (build_id,name,url,revision) values ($newbuildid,?,?,?)")
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   307
      or die("Couldn't prepare query insert into content: " . $db->errstr());
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   308
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   309
    for my $entry (@{$content})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   310
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   311
      my $name = $entry->{name};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   312
      my $url = $entry->{url};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   313
      my $revision = $entry->{revision};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   314
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   315
      print " execute '$name, $url, $revision'\n" if ($verbose);  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   316
      $query->execute($name, $url, $revision)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   317
		    or print "WARNING: Couldn't execute insert into content ($name,$url,$revision): " . $db->errstr() . "\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   318
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   319
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   320
  if (@{$labels})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   321
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   322
    print " prepare_cached 'insert into labels (build_id,label) values ($newbuildid,?)'\n" if ($verbose);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   323
    my $query = $db->prepare_cached("insert into labels (build_id,label) values ($newbuildid,?)")
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   324
      or die("Couldn't prepare query insert into labels: " . $db->errstr());
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   325
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   326
    for my $entry (@{$labels})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   327
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   328
      my $label = $entry->{label};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   329
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   330
      print " execute '$label'\n" if ($verbose);  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   331
      $query->execute($label)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   332
		    or print "WARNING: Couldn't execute insert into revision ($label): " . $db->errstr() . "\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   333
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   334
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   335
  print "new build id: $newbuildid\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   336
}
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   337
else
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   338
{
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   339
  print "Updating build $id\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   340
  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   341
  if (keys %{$builds_entry})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   342
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   343
    my $field_list = '';
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   344
    my @fields = ();
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   345
    for my $field (keys %{$builds_entry})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   346
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   347
      $field_list .= "$field=?,";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   348
      push(@fields,$builds_entry->{$field});
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   349
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   350
    $field_list =~ s/,$//;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   351
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   352
    print " prepare 'update builds set $field_list where id=$id'\n" if ($verbose);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   353
    my $query = $db->prepare("update builds set $field_list where id=$id")
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   354
      or die("Couldn't prepare query update builds: " . $db->errstr());
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   355
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   356
    print " execute '@fields'\n" if ($verbose);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   357
    $query->execute(@fields)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   358
		  or print "WARNING: Couldn't execute update builds (@fields): " . $db->errstr() . "\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   359
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   360
  if (@{$envinfo})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   361
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   362
    print " prepare 'delete from envinfo where build_id=$id'\n" if ($verbose);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   363
    my $delete_query = $db->prepare("delete from envinfo where build_id=$id")
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   364
      or die("Couldn't prepare query delete from envinfo: " . $db->errstr());
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   365
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   366
    print " execute ''\n" if ($verbose);  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   367
    $delete_query->execute()
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   368
		    or print "WARNING: Couldn't execute delete from envinfo: " . $db->errstr() . "\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   369
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   370
    print " prepare 'insert into envinfo (build_id,tool,version) values ($id,?,?)'\n" if ($verbose);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   371
    my $query = $db->prepare_cached("insert into envinfo (build_id,tool,version) values ($id,?,?)")
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   372
      or die("Couldn't prepare query insert into envinfo: " . $db->errstr());
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   373
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   374
    for my $entry (@{$envinfo})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   375
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   376
      my $tool = $entry->{tool};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   377
      my $version = $entry->{version};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   378
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   379
      print " execute '$tool,$version'\n" if ($verbose);  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   380
      $query->execute($tool, $version)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   381
		    or print "WARNING: Couldn't execute insert into envinfo ($tool,$version): " . $db->errstr() . "\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   382
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   383
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   384
  if (@{$failures})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   385
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   386
    print " prepare 'delete from failures where build_id=$id'\n" if ($verbose);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   387
    my $delete_query = $db->prepare("delete from failures where build_id=$id")
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   388
      or die("Couldn't prepare query delete from failures: " . $db->errstr());
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   389
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   390
    print " execute ''\n" if ($verbose);  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   391
    $delete_query->execute()
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   392
		    or print "WARNING: Couldn't execute delete from failures: " . $db->errstr() . "\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   393
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   394
    print " prepare 'insert into failures (build_id,category,count) values ($id,?,?)'\n" if ($verbose);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   395
    my $query = $db->prepare_cached("insert into failures (build_id,category,count) values ($id,?,?)")
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   396
      or die("Couldn't prepare query insert into failures: " . $db->errstr());
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   397
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   398
    for my $entry (@{$failures})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   399
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   400
      my $category = $entry->{category};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   401
      my $count = $entry->{count};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   402
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   403
      print " execute '$category,$count'\n" if ($verbose);  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   404
      $query->execute($category, $count)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   405
		    or print "WARNING: Couldn't execute insert into failures ($category,$count): " . $db->errstr() . "\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   406
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   407
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   408
  if (@{$reports})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   409
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   410
    print " prepare 'delete from reports where build_id=$id'\n" if ($verbose);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   411
    my $delete_query = $db->prepare("delete from reports where build_id=$id")
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   412
      or die("Couldn't prepare query delete from reports: " . $db->errstr());
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   413
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   414
    print " execute ''\n" if ($verbose);  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   415
    $delete_query->execute()
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   416
		    or print "WARNING: Couldn't execute delete from reports: " . $db->errstr() . "\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   417
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   418
    print " prepare 'insert into reports (build_id,name,url,type) values ($id,?,?,?)'\n" if ($verbose);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   419
    my $query = $db->prepare_cached("insert into reports (build_id,name,url,type) values ($id,?,?,?)")
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   420
      or die("Couldn't prepare query insert into failures: " . $db->errstr());
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   421
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   422
    for my $entry (@{$reports})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   423
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   424
      my $name = $entry->{name};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   425
      my $url = $entry->{url};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   426
      my $type = $entry->{type};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   427
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   428
      print " execute '$name,$url,$type'\n" if ($verbose);  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   429
      $query->execute($name, $url, $type)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   430
		    or print "WARNING: Couldn't execute insert into reports ($name,$url,$type): " . $db->errstr() . "\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   431
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   432
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   433
  if (@{$content})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   434
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   435
    print " prepare 'delete from content where build_id=$id'\n" if ($verbose);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   436
    my $delete_query = $db->prepare("delete from content where build_id=$id")
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   437
      or die("Couldn't prepare query delete from content: " . $db->errstr());
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   438
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   439
    print " execute ''\n" if ($verbose);  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   440
    $delete_query->execute()
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   441
		    or print "WARNING: Couldn't execute delete from content: " . $db->errstr() . "\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   442
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   443
    print " prepare 'insert into content (build_id,name,url,revision) values ($id,?,?,?)'\n" if ($verbose);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   444
    my $query = $db->prepare_cached("insert into content (build_id,name,url,revision) values ($id,?,?,?)")
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   445
      or die("Couldn't prepare query insert into content: " . $db->errstr());
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   446
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   447
    for my $entry (@{$content})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   448
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   449
      my $name = $entry->{name};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   450
      my $url = $entry->{url};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   451
      my $revision = $entry->{revision};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   452
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   453
      print " execute '$name,$url,$revision'\n" if ($verbose);  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   454
      $query->execute($name, $url, $revision)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   455
		    or print "WARNING: Couldn't execute insert into content ($name,$url,$revision): " . $db->errstr() . "\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   456
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   457
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   458
  if (@{$labels})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   459
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   460
    print " prepare 'delete from labels where build_id=$id'\n" if ($verbose);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   461
    my $delete_query = $db->prepare("delete from labels where build_id=$id")
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   462
      or die("Couldn't prepare query delete from labels: " . $db->errstr());
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   463
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   464
    print " execute ''\n" if ($verbose);  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   465
    $delete_query->execute()
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   466
		    or print "WARNING: Couldn't execute delete from labels: " . $db->errstr() . "\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   467
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   468
    print " prepare 'insert into labels (build_id,label) values ($id,?)'\n" if ($verbose);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   469
    my $query = $db->prepare_cached("insert into label (build_id,label) values ($id,?)")
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   470
      or die("Couldn't prepare query insert into label: " . $db->errstr());
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   471
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   472
    for my $entry (@{$labels})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   473
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   474
      my $label = $entry->{label};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   475
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   476
      print " execute '$label'\n" if ($verbose);  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   477
      $query->execute($label)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   478
		    or print "WARNING: Couldn't execute insert into labels ($label): " . $db->errstr() . "\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   479
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   480
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   481
}
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   482
DisconnectFromDB();
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   483
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   484