common/tools/bitops.pl
author Dario Sestito <darios@symbian.org>
Mon, 12 Jul 2010 12:00:07 +0100
changeset 1162 1127dea6b78b
parent 1158 739036c00f80
child 1175 b1b8e71b0c52
permissions -rw-r--r--
Fix: DBD-mysql is missing
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;
1162
1127dea6b78b Fix: DBD-mysql is missing
Dario Sestito <darios@symbian.org>
parents: 1158
diff changeset
     2
1127dea6b78b Fix: DBD-mysql is missing
Dario Sestito <darios@symbian.org>
parents: 1158
diff changeset
     3
use FindBin;
1127dea6b78b Fix: DBD-mysql is missing
Dario Sestito <darios@symbian.org>
parents: 1158
diff changeset
     4
use lib "$FindBin::Bin/lib";
1127dea6b78b Fix: DBD-mysql is missing
Dario Sestito <darios@symbian.org>
parents: 1158
diff changeset
     5
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     6
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
     7
use DBI;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     8
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     9
use Getopt::Long;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    10
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    11
my $help = 0;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    12
my $create = 0;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    13
my $id = '';
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    14
my $file = '';
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    15
my $verbose = 0;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    16
GetOptions((
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    17
	'create!' => \$create,
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    18
	'file=s' => \$file,
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    19
	'id=s' => \$id,
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    20
	'help!' => \$help,
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    21
	'verbose!' => \$verbose
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    22
));
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    23
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    24
if ($help||!$file)
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
  print <<_EOH;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    27
bitops
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    28
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
    29
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    30
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
    31
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    32
Options:
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    33
  -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
    34
  -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
    35
                        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
    36
                        the newly created build.
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    37
  -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
    38
                        provided in FILE.
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    39
  -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
    40
                        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
    41
  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    42
File format:
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    43
  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
    44
  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
    45
  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
    46
  - build_id_string
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    47
  - package (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    48
  - platform (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    49
  - started (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    50
  - finished (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    51
  - creator (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    52
  - machine (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    53
  - build_brag (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    54
  - test_brag (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    55
  - baseline_short (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    56
  - sources_short (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    57
  - envinfo (TOOL,VERSION)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    58
  - failure (CATEGORY,COUNT)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    59
  - report (NAME,URL,TYPE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    60
  - content (NAME,URL,REVISION)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    61
  - label (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    62
_EOH
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    63
	exit(0);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    64
}
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    65
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    66
my $db = undef;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    67
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    68
my $builds_entry = {};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    69
my $envinfo = [];
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    70
my $failures = [];
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    71
my $reports = [];
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    72
my $content = [];
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    73
my $labels = [];
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    74
my $testing_entry = {};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    75
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    76
sub ConnectToDB()
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
	$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
    79
		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
    80
}
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
sub DisconnectFromDB()
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    83
{
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    84
	$db->disconnect();
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    85
}
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
sub parse_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
  my ($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
  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
    92
  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    93
  while (<FILE>)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    94
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    95
    my $line = $_;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    96
    chomp $line;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    97
    $line =~ s/^\s//g;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    98
    $line =~ s/\s$//g;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    99
    next if ($line !~ /[^\s]/);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   100
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   101
    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
   102
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   103
      my $attr = $1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   104
      my $value = $2;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   105
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   106
      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
   107
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   108
        $attr = lc($attr);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   109
        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
   110
        $builds_entry->{$attr}=$value;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   111
      }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   112
      elsif ($attr =~ /^(envinfo)$/i)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   113
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   114
        $attr = lc($attr);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   115
        if ($value =~ /([^,]*),([^,]*)/)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   116
        {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   117
          my $tool = $1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   118
          my $version = $2;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   119
          
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   120
          if (!$tool || !$version)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   121
          {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   122
            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
   123
            return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   124
          }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   125
          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
   126
          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
   127
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   128
        else
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
          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
   131
          return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   132
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   133
      }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   134
      elsif ($attr =~ /^(failure)$/i)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   135
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   136
        $attr = lc($attr);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   137
        if ($value =~ /([^,]*),([^,]*)/)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   138
        {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   139
          my $category = $1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   140
          my $count = $2;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   141
          
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   142
          if (!$category || !$count)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   143
          {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   144
            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
   145
            return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   146
          }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   147
          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
   148
          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
   149
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   150
        else
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
          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
   153
          return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   154
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   155
      }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   156
      elsif ($attr =~ /^(report)$/i)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   157
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   158
        $attr = lc($attr);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   159
        if ($value =~ /([^,]*),([^,]*),([^,]*)/)
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
          my $name = $1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   162
          my $url = $2;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   163
          my $type = $3;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   164
          
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   165
          if (!$name || !$url || !$type)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   166
          {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   167
            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
   168
            return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   169
          }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   170
          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
   171
          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
   172
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   173
        else
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
          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
   176
          return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   177
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   178
      }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   179
      elsif ($attr =~ /^(content)$/i)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   180
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   181
        $attr = lc($attr);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   182
        if ($value =~ /([^,]*),([^,]*),([^,]*)/)
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
          my $name = $1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   185
          my $url = $2;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   186
          my $revision = $3;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   187
          
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   188
          if (!$name || !$url || !$revision)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   189
          {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   190
            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
   191
            return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   192
          }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   193
          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
   194
          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
   195
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   196
        else
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
          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
   199
          return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   200
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   201
      }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   202
      elsif ($attr =~ /^(label)$/i)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   203
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   204
        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
   205
        push(@{$labels}, {label=>$value});
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   206
      }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   207
      else
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
        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
   210
        return 1;
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
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   213
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   214
    else
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
      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
   217
      return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   218
    }
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
  close(FILE);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   222
  return 0;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   223
}
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   224
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   225
# MAIN PROGRAM
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   226
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   227
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
   228
if ($r)
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
  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
   231
  exit(1);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   232
}
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
ConnectToDB();
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   235
my $newbuildid = -1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   236
if ($create)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   237
{
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   238
  if (keys %{$builds_entry})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   239
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   240
    my $field_list = '';
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   241
    my $qm_list = '';
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   242
    my @fields = ();
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   243
    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
   244
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   245
      $field_list .= "$field,";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   246
      $qm_list .= "?,";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   247
      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
   248
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   249
    $field_list =~ s/,$//;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   250
    $qm_list =~ s/,$//;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   251
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   252
    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
   253
      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
   254
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   255
    $query->execute(@fields)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   256
		  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
   257
		  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   258
		$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
   259
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   260
  if (@{$envinfo})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   261
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   262
    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
   263
      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
   264
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   265
    for my $entry (@{$envinfo})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   266
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   267
      my $tool = $entry->{tool};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   268
      my $version = $entry->{version};
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
      $query->execute($tool, $version)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   271
		    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
   272
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   273
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   274
  if (@{$failures})
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
    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
   277
    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
   278
      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
   279
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   280
    for my $entry (@{$failures})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   281
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   282
      my $category = $entry->{category};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   283
      my $count = $entry->{count};
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
      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
   286
      $query->execute($category, $count)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   287
		    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
   288
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   289
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   290
  if (@{$reports})
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
    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
   293
    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
   294
      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
   295
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   296
    for my $entry (@{$reports})
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
      my $name = $entry->{name};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   299
      my $url = $entry->{url};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   300
      my $type = $entry->{type};
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
      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
   303
      $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
   304
		    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
   305
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   306
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   307
  if (@{$content})
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
    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
   310
    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
   311
      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
   312
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   313
    for my $entry (@{$content})
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
      my $name = $entry->{name};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   316
      my $url = $entry->{url};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   317
      my $revision = $entry->{revision};
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
      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
   320
      $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
   321
		    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
   322
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   323
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   324
  if (@{$labels})
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
    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
   327
    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
   328
      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
   329
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   330
    for my $entry (@{$labels})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   331
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   332
      my $label = $entry->{label};
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
      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
   335
      $query->execute($label)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   336
		    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
   337
    }
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 "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
   340
}
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   341
else
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
  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
   344
  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   345
  if (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
    my $field_list = '';
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   348
    my @fields = ();
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   349
    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
   350
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   351
      $field_list .= "$field=?,";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   352
      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
   353
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   354
    $field_list =~ s/,$//;
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 " 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
   357
    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
   358
      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
   359
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   360
    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
   361
    $query->execute(@fields)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   362
		  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
   363
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   364
  if (@{$envinfo})
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 " 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
   367
    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
   368
      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
   369
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   370
    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
   371
    $delete_query->execute()
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   372
		    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
   373
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   374
    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
   375
    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
   376
      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
   377
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   378
    for my $entry (@{$envinfo})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   379
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   380
      my $tool = $entry->{tool};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   381
      my $version = $entry->{version};
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
      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
   384
      $query->execute($tool, $version)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   385
		    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
   386
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   387
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   388
  if (@{$failures})
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 " 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
   391
    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
   392
      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
   393
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   394
    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
   395
    $delete_query->execute()
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   396
		    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
   397
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   398
    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
   399
    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
   400
      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
   401
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   402
    for my $entry (@{$failures})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   403
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   404
      my $category = $entry->{category};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   405
      my $count = $entry->{count};
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
      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
   408
      $query->execute($category, $count)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   409
		    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
   410
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   411
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   412
  if (@{$reports})
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 " 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
   415
    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
   416
      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
   417
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   418
    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
   419
    $delete_query->execute()
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   420
		    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
   421
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   422
    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
   423
    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
   424
      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
   425
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   426
    for my $entry (@{$reports})
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
      my $name = $entry->{name};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   429
      my $url = $entry->{url};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   430
      my $type = $entry->{type};
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
      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
   433
      $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
   434
		    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
   435
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   436
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   437
  if (@{$content})
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 " 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
   440
    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
   441
      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
   442
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   443
    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
   444
    $delete_query->execute()
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   445
		    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
   446
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   447
    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
   448
    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
   449
      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
   450
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   451
    for my $entry (@{$content})
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
      my $name = $entry->{name};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   454
      my $url = $entry->{url};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   455
      my $revision = $entry->{revision};
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
      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
   458
      $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
   459
		    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
   460
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   461
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   462
  if (@{$labels})
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 " 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
   465
    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
   466
      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
   467
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   468
    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
   469
    $delete_query->execute()
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   470
		    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
   471
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   472
    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
   473
    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
   474
      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
   475
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   476
    for my $entry (@{$labels})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   477
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   478
      my $label = $entry->{label};
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
      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
   481
      $query->execute($label)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   482
		    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
   483
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   484
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   485
}
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   486
DisconnectFromDB();
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   487
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   488