common/tools/bitops.pl
author Dario Sestito <darios@symbian.org>
Tue, 13 Jul 2010 18:20:49 +0100
changeset 1176 5fcaa694186a
parent 1175 b1b8e71b0c52
child 1182 f15fa527df95
permissions -rw-r--r--
Enable new attribute 'baseline' for new 'baselines' table
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;
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
    16
my $dryrun = 0;
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    17
GetOptions((
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    18
	'create!' => \$create,
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    19
	'file=s' => \$file,
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    20
	'id=s' => \$id,
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    21
	'help!' => \$help,
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
    22
	'verbose!' => \$verbose,
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
    23
	'dryrun!' => \$dryrun,
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    24
));
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
if ($help||!$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
  print <<_EOH;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    29
bitops
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    30
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
    31
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    32
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
    33
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    34
Options:
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    35
  -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
    36
  -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
    37
                        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
    38
                        the newly created build.
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    39
  -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
    40
                        provided in FILE.
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    41
  -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
    42
                        See below for file format.
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
    43
  -v, --verbose         Increase info level
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
    44
  -d, --dryrun          Only show what would happen, do not actually interact
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
    45
                        with the DB
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    46
  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    47
File format:
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    48
  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
    49
  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
    50
  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
    51
  - build_id_string
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    52
  - package (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    53
  - platform (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    54
  - started (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    55
  - finished (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    56
  - creator (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    57
  - machine (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    58
  - build_brag (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    59
  - test_brag (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    60
  - baseline_short (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    61
  - sources_short (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    62
  - envinfo (TOOL,VERSION)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    63
  - failure (CATEGORY,COUNT)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    64
  - report (NAME,URL,TYPE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    65
  - content (NAME,URL,REVISION)
1176
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
    66
  - baseline (TYPE,PATH)
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    67
  - label (VALUE)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    68
_EOH
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    69
	exit(0);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    70
}
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
my $db = undef;
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
my $builds_entry = {};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    75
my $envinfo = [];
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    76
my $failures = [];
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    77
my $reports = [];
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    78
my $content = [];
1176
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
    79
my $baselines = [];
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    80
my $labels = [];
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    81
my $testing_entry = {};
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 ConnectToDB()
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
	$db = DBI->connect('DBI:mysql:bit:v800016:3306','fbf','mysql')
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
    86
		or die("Couldn't connect to database: " . DBI->errstr()) if (!$dryrun);
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    87
}
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
sub DisconnectFromDB()
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    90
{
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
    91
	$db->disconnect() if (!$dryrun);
1158
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
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    94
sub parse_file
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    95
{
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    96
  my ($file) = @_;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    97
  
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
    98
  print "Reading $file...\n" if ($verbose);
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
    99
  
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   100
  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
   101
  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   102
  while (<FILE>)
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
    my $line = $_;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   105
    chomp $line;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   106
    $line =~ s/^\s//g;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   107
    $line =~ s/\s$//g;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   108
    next if ($line !~ /[^\s]/);
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
    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
   111
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   112
      my $attr = $1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   113
      my $value = $2;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   114
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   115
      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
   116
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   117
        $attr = lc($attr);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   118
        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
   119
        $builds_entry->{$attr}=$value;
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
      elsif ($attr =~ /^(envinfo)$/i)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   122
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   123
        $attr = lc($attr);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   124
        if ($value =~ /([^,]*),([^,]*)/)
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
          my $tool = $1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   127
          my $version = $2;
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
          if (!$tool || !$version)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   130
          {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   131
            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
   132
            return 1;
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
          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
   135
          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
   136
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   137
        else
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
          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
   140
          return 1;
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
      }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   143
      elsif ($attr =~ /^(failure)$/i)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   144
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   145
        $attr = lc($attr);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   146
        if ($value =~ /([^,]*),([^,]*)/)
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
          my $category = $1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   149
          my $count = $2;
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
          if (!$category || !$count)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   152
          {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   153
            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
   154
            return 1;
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
          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
   157
          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
   158
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   159
        else
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
          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
   162
          return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   163
        }
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
      elsif ($attr =~ /^(report)$/i)
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
        $attr = lc($attr);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   168
        if ($value =~ /([^,]*),([^,]*),([^,]*)/)
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
          my $name = $1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   171
          my $url = $2;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   172
          my $type = $3;
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
          if (!$name || !$url || !$type)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   175
          {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   176
            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
   177
            return 1;
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
          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
   180
          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
   181
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   182
        else
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
          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
   185
          return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   186
        }
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
      elsif ($attr =~ /^(content)$/i)
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
        $attr = lc($attr);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   191
        if ($value =~ /([^,]*),([^,]*),([^,]*)/)
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
          my $name = $1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   194
          my $url = $2;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   195
          my $revision = $3;
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
          if (!$name || !$url || !$revision)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   198
          {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   199
            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
   200
            return 1;
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
          print " found ($name,$url,$revision) for table 'content'\n" if ($verbose);
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   203
          push(@{$content}, {name=>$name, url=>$url, revision=>$revision});
1158
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
        else
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
          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
   208
          return 1;
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
      }
1176
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   211
      elsif ($attr =~ /^(baseline)$/i)
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   212
      {
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   213
        $attr = lc($attr);
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   214
        if ($value =~ /([^,]*),([^,]*)/)
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   215
        {
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   216
          my $type = $1;
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   217
          my $path = $2;
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   218
          
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   219
          if (!$type || !$path)
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   220
          {
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   221
            print "ERROR: Type or path empty: \"$value\"\n";
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   222
            return 1;
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   223
          }
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   224
          print " found ($type,$path) for table 'baselines'\n" if ($verbose);
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   225
          push(@{$baselines}, {type=>$type, path=>$path});
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   226
        }
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   227
        else
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   228
        {
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   229
          print "ERROR: Could not understand value of baseline: \"$value\"\n";
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   230
          return 1;
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   231
        }
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   232
      }
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   233
      elsif ($attr =~ /^(label)$/i)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   234
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   235
        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
   236
        push(@{$labels}, {label=>$value});
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
      else
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
        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
   241
        return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   242
      }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   243
      
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
    else
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   246
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   247
      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
   248
      return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   249
    }
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
  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   252
  close(FILE);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   253
  return 0;
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
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   256
# MAIN PROGRAM
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 $r=parse_file($file);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   259
if ($r)
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
  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
   262
  exit(1);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   263
}
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   264
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   265
print "Executing SQL commands...\n" if ($verbose);
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   266
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   267
ConnectToDB();
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   268
my $newbuildid = -1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   269
if ($create)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   270
{
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   271
  if (keys %{$builds_entry})
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
    my $field_list = '';
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   274
    my $qm_list = '';
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   275
    my @fields = ();
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   276
    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
   277
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   278
      $field_list .= "$field,";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   279
      $qm_list .= "?,";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   280
      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
   281
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   282
    $field_list =~ s/,$//;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   283
    $qm_list =~ s/,$//;
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
    my $query = $db->prepare("insert into builds ($field_list) values ($qm_list)")
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   286
      or die("Couldn't prepare query insert into builds: " . $db->errstr()) if (!$dryrun);
1158
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
    $query->execute(@fields)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   289
		  or print "WARNING: Couldn't execute insert into builds (@fields): " . $db->errstr() . "\n" if (!$dryrun);
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   290
		  
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   291
		$newbuildid = $db->last_insert_id(undef, undef, undef, undef) if (!$dryrun);
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   292
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   293
  if (@{$envinfo})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   294
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   295
    my $query = $db->prepare_cached("insert into envinfo (build_id,tool,version) values ($newbuildid,?,?)")
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   296
      or die("Couldn't prepare query insert into envinfo: " . $db->errstr()) if (!$dryrun);
1158
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
    for my $entry (@{$envinfo})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   299
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   300
      my $tool = $entry->{tool};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   301
      my $version = $entry->{version};
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
      $query->execute($tool, $version)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   304
		    or print "WARNING: Couldn't execute insert into envinfo ($tool,$version): " . $db->errstr() . "\n" if (!$dryrun);
1158
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 (@{$failures})
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 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
   310
    my $query = $db->prepare_cached("insert into failures (build_id,category,count) values ($newbuildid,?,?)")
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   311
      or die("Couldn't prepare query insert into failures: " . $db->errstr()) if (!$dryrun);
1158
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 (@{$failures})
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 $category = $entry->{category};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   316
      my $count = $entry->{count};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   317
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   318
      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
   319
      $query->execute($category, $count)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   320
		    or print "WARNING: Couldn't execute insert into failures ($category,$count): " . $db->errstr() . "\n" if (!$dryrun);
1158
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
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   323
  if (@{$reports})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   324
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   325
    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
   326
    my $query = $db->prepare_cached("insert into reports (build_id,name,url,type) values ($newbuildid,?,?,?)")
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   327
      or die("Couldn't prepare query insert into reports: " . $db->errstr()) if (!$dryrun);
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   328
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   329
    for my $entry (@{$reports})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   330
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   331
      my $name = $entry->{name};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   332
      my $url = $entry->{url};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   333
      my $type = $entry->{type};
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 " 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
   336
      $query->execute($name, $url, $type)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   337
		    or print "WARNING: Couldn't execute insert into reports ($name,$url,$type): " . $db->errstr() . "\n" if (!$dryrun);
1158
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
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   340
  if (@{$content})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   341
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   342
    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
   343
    my $query = $db->prepare_cached("insert into content (build_id,name,url,revision) values ($newbuildid,?,?,?)")
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   344
      or die("Couldn't prepare query insert into content: " . $db->errstr()) if (!$dryrun);
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   345
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   346
    for my $entry (@{$content})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   347
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   348
      my $name = $entry->{name};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   349
      my $url = $entry->{url};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   350
      my $revision = $entry->{revision};
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 " 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
   353
      $query->execute($name, $url, $revision)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   354
		    or print "WARNING: Couldn't execute insert into content ($name,$url,$revision): " . $db->errstr() . "\n" if (!$dryrun);
1158
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
  }
1176
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   357
  if (@{$baselines})
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   358
  {
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   359
    print " prepare_cached 'insert into baselines (build_id,type,path) values ($newbuildid,?,?)'\n" if ($verbose);
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   360
    my $query = $db->prepare_cached("insert into baselines (build_id,type,path) values ($newbuildid,?,?)")
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   361
      or die("Couldn't prepare query insert into baselines: " . $db->errstr()) if (!$dryrun);
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   362
      
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   363
    for my $entry (@{$baselines})
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   364
    {
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   365
      my $type = $entry->{type};
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   366
      my $path = $entry->{path};
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   367
    
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   368
      print " execute '$type, $path'\n" if ($verbose);  
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   369
      $query->execute($type, $path)
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   370
		    or print "WARNING: Couldn't execute insert into baselines ($type,$path): " . $db->errstr() . "\n" if (!$dryrun);
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   371
    }
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   372
  }
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   373
  if (@{$labels})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   374
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   375
    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
   376
    my $query = $db->prepare_cached("insert into labels (build_id,label) values ($newbuildid,?)")
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   377
      or die("Couldn't prepare query insert into labels: " . $db->errstr()) if (!$dryrun);
1158
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
    for my $entry (@{$labels})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   380
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   381
      my $label = $entry->{label};
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 '$label'\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($label)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   385
		    or print "WARNING: Couldn't execute insert into revision ($label): " . $db->errstr() . "\n" if (!$dryrun);
1158
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
  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
   389
}
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   390
else
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   391
{
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   392
  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
   393
  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   394
  if (keys %{$builds_entry})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   395
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   396
    my $field_list = '';
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   397
    my @fields = ();
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   398
    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
   399
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   400
      $field_list .= "$field=?,";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   401
      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
   402
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   403
    $field_list =~ s/,$//;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   404
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   405
    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
   406
    my $query = $db->prepare("update builds set $field_list where id=$id")
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   407
      or die("Couldn't prepare query update builds: " . $db->errstr()) if (!$dryrun);
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   408
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   409
    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
   410
    $query->execute(@fields)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   411
		  or print "WARNING: Couldn't execute update builds (@fields): " . $db->errstr() . "\n" if (!$dryrun);
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   412
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   413
  if (@{$envinfo})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   414
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   415
    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
   416
    my $delete_query = $db->prepare("delete from envinfo where build_id=$id")
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   417
      or die("Couldn't prepare query delete from envinfo: " . $db->errstr()) if (!$dryrun);
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   418
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   419
    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
   420
    $delete_query->execute()
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   421
		    or print "WARNING: Couldn't execute delete from envinfo: " . $db->errstr() . "\n" if (!$dryrun);
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   422
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   423
    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
   424
    my $query = $db->prepare_cached("insert into envinfo (build_id,tool,version) values ($id,?,?)")
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   425
      or die("Couldn't prepare query insert into envinfo: " . $db->errstr()) if (!$dryrun);
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   426
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   427
    for my $entry (@{$envinfo})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   428
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   429
      my $tool = $entry->{tool};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   430
      my $version = $entry->{version};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   431
    
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   432
      print " execute '$tool,$version'\n" if ($verbose);
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   433
      $query->execute($tool, $version)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   434
		    or print "WARNING: Couldn't execute insert into envinfo ($tool,$version): " . $db->errstr() . "\n" if (!$dryrun);
1158
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 (@{$failures})
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 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
   440
    my $delete_query = $db->prepare("delete from failures where build_id=$id")
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   441
      or die("Couldn't prepare query delete from failures: " . $db->errstr()) if (!$dryrun);
1158
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()
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   445
		    or print "WARNING: Couldn't execute delete from failures: " . $db->errstr() . "\n" if (!$dryrun);
1158
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 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
   448
    my $query = $db->prepare_cached("insert into failures (build_id,category,count) values ($id,?,?)")
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   449
      or die("Couldn't prepare query insert into failures: " . $db->errstr()) if (!$dryrun);
1158
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 (@{$failures})
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 $category = $entry->{category};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   454
      my $count = $entry->{count};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   455
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   456
      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
   457
      $query->execute($category, $count)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   458
		    or print "WARNING: Couldn't execute insert into failures ($category,$count): " . $db->errstr() . "\n" if (!$dryrun);
1158
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
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   461
  if (@{$reports})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   462
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   463
    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
   464
    my $delete_query = $db->prepare("delete from reports where build_id=$id")
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   465
      or die("Couldn't prepare query delete from reports: " . $db->errstr()) if (!$dryrun);
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   466
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   467
    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
   468
    $delete_query->execute()
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   469
		    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
   470
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   471
    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
   472
    my $query = $db->prepare_cached("insert into reports (build_id,name,url,type) values ($id,?,?,?)")
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   473
      or die("Couldn't prepare query insert into failures: " . $db->errstr()) if (!$dryrun);
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   474
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   475
    for my $entry (@{$reports})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   476
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   477
      my $name = $entry->{name};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   478
      my $url = $entry->{url};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   479
      my $type = $entry->{type};
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
      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
   482
      $query->execute($name, $url, $type)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   483
		    or print "WARNING: Couldn't execute insert into reports ($name,$url,$type): " . $db->errstr() . "\n" if (!$dryrun);
1158
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
  if (@{$content})
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
    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
   489
    my $delete_query = $db->prepare("delete from content where build_id=$id")
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   490
      or die("Couldn't prepare query delete from content: " . $db->errstr()) if (!$dryrun);
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   491
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   492
    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
   493
    $delete_query->execute()
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   494
		    or print "WARNING: Couldn't execute delete from content: " . $db->errstr() . "\n" if (!$dryrun);
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   495
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   496
    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
   497
    my $query = $db->prepare_cached("insert into content (build_id,name,url,revision) values ($id,?,?,?)")
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   498
      or die("Couldn't prepare query insert into content: " . $db->errstr()) if (!$dryrun);
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   499
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   500
    for my $entry (@{$content})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   501
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   502
      my $name = $entry->{name};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   503
      my $url = $entry->{url};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   504
      my $revision = $entry->{revision};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   505
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   506
      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
   507
      $query->execute($name, $url, $revision)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   508
		    or print "WARNING: Couldn't execute insert into content ($name,$url,$revision): " . $db->errstr() . "\n" if (!$dryrun);
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   509
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   510
  }
1176
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   511
  if (@{$baselines})
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   512
  {
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   513
    print " prepare 'delete from baselines where build_id=$id'\n" if ($verbose);
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   514
    my $delete_query = $db->prepare("delete from baselines where build_id=$id")
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   515
      or die("Couldn't prepare query delete from baselines: " . $db->errstr()) if (!$dryrun);
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   516
    
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   517
    print " execute ''\n" if ($verbose);  
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   518
    $delete_query->execute()
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   519
		    or print "WARNING: Couldn't execute delete from baselines: " . $db->errstr() . "\n" if (!$dryrun);
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   520
    
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   521
    print " prepare 'insert into baselines (build_id,type,path) values ($id,?,?)'\n" if ($verbose);
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   522
    my $query = $db->prepare_cached("insert into baselines (build_id,type,path) values ($id,?,?)")
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   523
      or die("Couldn't prepare query insert into baselines: " . $db->errstr()) if (!$dryrun);
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   524
      
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   525
    for my $entry (@{$baselines})
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   526
    {
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   527
      my $type = $entry->{type};
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   528
      my $path = $entry->{path};
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   529
    
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   530
      print " execute '$type,$path'\n" if ($verbose);  
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   531
      $query->execute($type, $path)
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   532
		    or print "WARNING: Couldn't execute insert into baselines ($type,$path): " . $db->errstr() . "\n" if (!$dryrun);
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   533
    }
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   534
  }
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   535
  if (@{$labels})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   536
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   537
    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
   538
    my $delete_query = $db->prepare("delete from labels where build_id=$id")
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   539
      or die("Couldn't prepare query delete from labels: " . $db->errstr()) if (!$dryrun);
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   540
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   541
    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
   542
    $delete_query->execute()
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   543
		    or print "WARNING: Couldn't execute delete from labels: " . $db->errstr() . "\n" if (!$dryrun);
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   544
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   545
    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
   546
    my $query = $db->prepare_cached("insert into label (build_id,label) values ($id,?)")
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   547
      or die("Couldn't prepare query insert into label: " . $db->errstr()) if (!$dryrun);
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   548
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   549
    for my $entry (@{$labels})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   550
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   551
      my $label = $entry->{label};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   552
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   553
      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
   554
      $query->execute($label)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   555
		    or print "WARNING: Couldn't execute insert into labels ($label): " . $db->errstr() . "\n" if (!$dryrun);
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   556
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   557
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   558
}
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   559
DisconnectFromDB();
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   560
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   561