common/tools/bitops.pl
author Dario Sestito <darios@symbian.org>
Tue, 05 Oct 2010 15:28:21 +0100
changeset 1281 c5308055d94d
parent 1280 61388ab6ba2c
child 1285 05c7556875df
permissions -rw-r--r--
Enable option to check that the build_id_string is unique
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;
1281
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
    13
my $stringcheck = 0;
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    14
my $file = '';
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    15
my $id = '';
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    16
my $append = 0;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    17
my $delete = '';
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    18
my $verbose = 0;
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
    19
my $dryrun = 0;
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    20
GetOptions((
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    21
	'create!' => \$create,
1281
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
    22
	'stringcheck!' => \$stringcheck,
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    23
	'file=s' => \$file,
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    24
	'update=s' => \$id,
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    25
	'append!' => \$append,
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    26
	'remove=s' => \$delete,
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    27
	'help!' => \$help,
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
    28
	'verbose!' => \$verbose,
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
    29
	'dryrun!' => \$dryrun,
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    30
));
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    31
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    32
if ($help||(($create||$id)&&!$file)||(!$create&&!$id&&!$delete))
1158
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
  print <<_EOH;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    35
bitops
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    36
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
    37
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    38
Usage:
1281
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
    39
  bitops.pl -c [-n] -f FILE
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    40
  bitops.pl -u ID [-a] -f FILE
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    41
  bitops.pl -r ID
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    42
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    43
Options:
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    44
  -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
    45
  -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
    46
                        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
    47
                        the newly created build.
1281
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
    48
  -s, --stringcheck     Check that the build_id_string is unique, otherwise do
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
    49
                        not create build.
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    50
  -u ID, --update ID    Update entry for build number ID with the values
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    51
                        provided in FILE. For the update operation only the
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    52
                        entry in the BUILDS table will be actually updated, the
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    53
                        entries in the other tables will be deleted, then the
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    54
                        data supplied will be inserted (this behaviour can be
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    55
                        changed with the -a option)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    56
  -a, --append          Do not delete entries in the tables different than
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    57
                        BUILDS before inserting the data supplied. This option
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    58
                        must be used in conjuntion with -u (see info for -u
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    59
                        option for more information)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    60
  -r, --remove          Remove build ID (entries in all tables) from the db
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    61
  -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
    62
                        See below for file format.
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
    63
  -v, --verbose         Increase info level
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
    64
  -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
    65
                        with the DB
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    66
  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    67
File format:
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    68
  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
    69
  attribute and value are separated by a tab.
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    70
  These are the supported attributes (in brackets the syntax of the value) with
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    71
  the table they belong to:
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    72
  - build_id_string - BUILDS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    73
  - package (VALUE) - BUILDS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    74
  - platform (VALUE) - BUILDS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    75
  - started (VALUE) - BUILDS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    76
  - finished (VALUE) - BUILDS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    77
  - creator (VALUE) - BUILDS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    78
  - machine (VALUE) - BUILDS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    79
  - build_brag (VALUE) - BUILDS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    80
  - test_brag (VALUE) - BUILDS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    81
  - baseline_short (VALUE) - BUILDS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    82
  - sources_short (VALUE) - BUILDS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    83
  - envinfo (TOOL,VERSION) - ENVINFO
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    84
  - failure (CATEGORY,COUNT) - FAILURES
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    85
  - report (NAME,URL,TYPE) - REPORTS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    86
  - content (NAME,URL,REVISION) - CONTENT
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    87
  - baseline (TYPE,PATH) - BASELINES
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    88
  - label (VALUE) - LABELS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    89
  - test (NAME,TYPE,TARGET,STARTED,FINISHED,CASES_TOTAL,CASES_PASSED,
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    90
      CASES_FAILED,CASES_NOT_RUN,CASES_NOT_AVAILABLE,PASS_RATE) - TESTING
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    91
  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    92
Note on the update operation:
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    93
_EOH
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    94
	exit(0);
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
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    97
my $db = undef;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    98
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    99
my $builds_entry = {};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   100
my $envinfo = [];
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   101
my $failures = [];
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   102
my $reports = [];
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   103
my $content = [];
1176
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   104
my $baselines = [];
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   105
my $labels = [];
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   106
my $testing = [];
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   107
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   108
sub ConnectToDB()
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
	$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
   111
		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
   112
}
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   113
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   114
sub DisconnectFromDB()
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   115
{
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   116
	$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
   117
}
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   118
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   119
sub parse_file
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
  my ($file) = @_;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   122
  
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   123
  print "Reading $file...\n" if ($verbose);
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   124
  
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   125
  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
   126
  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   127
  while (<FILE>)
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
    my $line = $_;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   130
    chomp $line;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   131
    $line =~ s/^\s//g;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   132
    $line =~ s/\s$//g;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   133
    next if ($line !~ /[^\s]/);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   134
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   135
    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
   136
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   137
      my $attr = $1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   138
      my $value = $2;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   139
      
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   140
      if ($attr =~ /^(build_id_string|package|platform|started|finished|creator|machine|build_brag|test_brag|baseline_short|sources_short|id)$/i)
1158
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
        $attr = lc($attr);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   143
        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
   144
        $builds_entry->{$attr}=$value;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   145
      }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   146
      elsif ($attr =~ /^(envinfo)$/i)
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
        $attr = lc($attr);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   149
        if ($value =~ /([^,]*),([^,]*)/)
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
          my $tool = $1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   152
          my $version = $2;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   153
          
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   154
          if (!$tool || !$version)
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 "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
   157
            return 1;
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
          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
   160
          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
   161
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   162
        else
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
          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
   165
          return 1;
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
      }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   168
      elsif ($attr =~ /^(failure)$/i)
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
        $attr = lc($attr);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   171
        if ($value =~ /([^,]*),([^,]*)/)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   172
        {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   173
          my $category = $1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   174
          my $count = $2;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   175
          
1182
f15fa527df95 Fix: bitops.pl reports an error if failure count is zero
Dario Sestito <darios@symbian.org>
parents: 1176
diff changeset
   176
          if (!$category || !defined $count || $count eq '')
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   177
          {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   178
            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
   179
            return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   180
          }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   181
          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
   182
          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
   183
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   184
        else
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   185
        {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   186
          print "ERROR: 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
   187
          return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   188
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   189
      }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   190
      elsif ($attr =~ /^(report)$/i)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   191
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   192
        $attr = lc($attr);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   193
        if ($value =~ /([^,]*),([^,]*),([^,]*)/)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   194
        {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   195
          my $name = $1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   196
          my $url = $2;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   197
          my $type = $3;
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
          if (!$name || !$url || !$type)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   200
          {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   201
            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
   202
            return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   203
          }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   204
          print " found ($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
   205
          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
   206
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   207
        else
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   208
        {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   209
          print "ERROR: Could not understand 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
   210
          return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   211
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   212
      }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   213
      elsif ($attr =~ /^(content)$/i)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   214
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   215
        $attr = lc($attr);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   216
        if ($value =~ /([^,]*),([^,]*),([^,]*)/)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   217
        {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   218
          my $name = $1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   219
          my $url = $2;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   220
          my $revision = $3;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   221
          
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   222
          if (!$name || !$url || !$revision)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   223
          {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   224
            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
   225
            return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   226
          }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   227
          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
   228
          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
   229
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   230
        else
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   231
        {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   232
          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
   233
          return 1;
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
      }
1176
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   236
      elsif ($attr =~ /^(baseline)$/i)
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   237
      {
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   238
        $attr = lc($attr);
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   239
        if ($value =~ /([^,]*),([^,]*)/)
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   240
        {
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   241
          my $type = $1;
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   242
          my $path = $2;
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   243
          
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   244
          if (!$type || !$path)
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   245
          {
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   246
            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
   247
            return 1;
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   248
          }
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   249
          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
   250
          push(@{$baselines}, {type=>$type, path=>$path});
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   251
        }
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   252
        else
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   253
        {
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   254
          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
   255
          return 1;
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   256
        }
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   257
      }
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   258
      elsif ($attr =~ /^(label)$/i)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   259
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   260
        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
   261
        push(@{$labels}, {label=>$value});
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   262
      }
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   263
      elsif ($attr =~ /^(test)$/i)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   264
      {
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   265
        $attr = lc($attr);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   266
        if ($value =~ /([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*)/)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   267
        {
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   268
          my $name=$1;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   269
          my $type=$2;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   270
          my $target=$3;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   271
          my $started=$4;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   272
          my $finished=$5;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   273
          my $cases_total=$6;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   274
          $cases_total=0 if (!$cases_total);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   275
          my $cases_passed=$7;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   276
          $cases_passed=0 if (!$cases_passed);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   277
          my $cases_failed=$8;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   278
          $cases_failed=0 if (!$cases_failed);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   279
          my $cases_not_run=$9;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   280
          $cases_not_run=0 if (!$cases_not_run);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   281
          my $cases_not_available=$10;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   282
          $cases_not_available=0 if (!$cases_not_available);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   283
          my $pass_rate=$11;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   284
          $pass_rate="0.0" if (!$pass_rate);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   285
          
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   286
          if (!$name)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   287
          {
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   288
            print "ERROR: Name is empty: \"$value\"\n";
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   289
            return 1;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   290
          }
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   291
          print " found ($name,$type,$target,$started,$finished,$cases_total,$cases_passed,$cases_failed,$cases_not_run,$cases_not_available,$pass_rate) for table 'testing'\n" if ($verbose);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   292
          push(@{$testing}, {name=>$name,type=>$type,target=>$target,started=>$started,finished=>$finished,
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   293
            cases_total=>$cases_total,cases_passed=>$cases_passed,cases_failed=>$cases_failed,cases_not_run=>$cases_not_run,
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   294
            cases_not_available=>$cases_not_available,pass_rate=>$pass_rate});
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   295
        }
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   296
        else
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   297
        {
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   298
          print "ERROR: Could not understand value of envinfo: \"$value\"\n";
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   299
          return 1;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   300
        }
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   301
      }
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   302
      else
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   303
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   304
        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
   305
        return 1;
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
      
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
    else
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   310
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   311
      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
   312
      return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   313
    }
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
  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   316
  close(FILE);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   317
  return 0;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   318
}
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   319
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   320
# MAIN PROGRAM
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   321
my $r=0;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   322
$r=parse_file($file) if ($create||$id);
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   323
if ($r)
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 "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
   326
  exit(1);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   327
}
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   328
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   329
print "Executing SQL commands...\n" if ($verbose);
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   330
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   331
ConnectToDB();
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   332
my $newbuildid = -1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   333
if ($create)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   334
{
1281
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
   335
  if ($stringcheck && defined $builds_entry->{build_id_string} && !$dryrun)
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
   336
  {
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
   337
    print "Check that the build_id_string is unique\n" if ($verbose);
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
   338
    my $query=$db->prepare("select id from builds where build_id_string='$builds_entry->{build_id_string}';");
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
   339
    $query->execute();
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
   340
    my @ids_existing=();
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
   341
    my $id_existing=-1;
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
   342
    $query->bind_columns(\$id_existing);
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
   343
    while($query->fetch())
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
   344
    {
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
   345
      push(@ids_existing, $id_existing);
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
   346
    }
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
   347
    if (scalar(@ids_existing))
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
   348
    {
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
   349
      print "ERROR: The supplied build_id_string already exists for build id: @ids_existing. Not creating build.\n";
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
   350
      exit(1);
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
   351
	}
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
   352
  }
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
   353
  
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   354
  if (keys %{$builds_entry})
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
    my $field_list = '';
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   357
    my $qm_list = '';
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   358
    my @fields = ();
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   359
    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
   360
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   361
      $field_list .= "$field,";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   362
      $qm_list .= "?,";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   363
      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
   364
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   365
    $field_list =~ s/,$//;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   366
    $qm_list =~ s/,$//;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   367
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   368
    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
   369
      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
   370
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   371
    $query->execute(@fields)
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   372
		  or print "WARNING: Couldn't execute insert into builds ($field_list) values (@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
   373
		  
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   374
		$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
   375
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   376
  if (@{$envinfo})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   377
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   378
    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
   379
      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
   380
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   381
    for my $entry (@{$envinfo})
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
      my $tool = $entry->{tool};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   384
      my $version = $entry->{version};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   385
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   386
      $query->execute($tool, $version)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   387
		    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
   388
    }
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
  if (@{$failures})
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 " 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
   393
    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
   394
      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
   395
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   396
    for my $entry (@{$failures})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   397
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   398
      my $category = $entry->{category};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   399
      my $count = $entry->{count};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   400
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   401
      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
   402
      $query->execute($category, $count)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   403
		    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
   404
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   405
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   406
  if (@{$reports})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   407
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   408
    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
   409
    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
   410
      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
   411
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   412
    for my $entry (@{$reports})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   413
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   414
      my $name = $entry->{name};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   415
      my $url = $entry->{url};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   416
      my $type = $entry->{type};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   417
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   418
      print " execute '$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
   419
      $query->execute($name, $url, $type)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   420
		    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
   421
    }
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
  if (@{$content})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   424
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   425
    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
   426
    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
   427
      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
   428
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   429
    for my $entry (@{$content})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   430
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   431
      my $name = $entry->{name};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   432
      my $url = $entry->{url};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   433
      my $revision = $entry->{revision};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   434
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   435
      print " 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
   436
      $query->execute($name, $url, $revision)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   437
		    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
   438
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   439
  }
1176
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   440
  if (@{$baselines})
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   441
  {
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   442
    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
   443
    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
   444
      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
   445
      
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   446
    for my $entry (@{$baselines})
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   447
    {
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   448
      my $type = $entry->{type};
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   449
      my $path = $entry->{path};
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   450
    
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   451
      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
   452
      $query->execute($type, $path)
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   453
		    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
   454
    }
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   455
  }
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   456
  if (@{$labels})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   457
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   458
    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
   459
    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
   460
      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
   461
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   462
    for my $entry (@{$labels})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   463
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   464
      my $label = $entry->{label};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   465
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   466
      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
   467
      $query->execute($label)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   468
		    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
   469
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   470
  }
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   471
  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   472
  if (@{$testing})
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   473
  {
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   474
    print " prepare_cached 'insert into testing (build_id,name,type,target,started,finished,cases_total,cases_passed,cases_failed,cases_not_run,cases_not_available,pass_rate) values ($newbuildid,?,?,?,?,?,?,?,?,?,?,?)'\n" if ($verbose);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   475
    my $query = $db->prepare_cached("insert into testing (build_id,name,type,target,started,finished,cases_total,cases_passed,cases_failed,cases_not_run,cases_not_available,pass_rate) values ($newbuildid,?,?,?,?,?,?,?,?,?,?,?)")
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   476
      or die("Couldn't prepare query insert into testing: " . $db->errstr()) if (!$dryrun);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   477
      
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   478
    for my $entry (@{$testing})
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   479
    {
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   480
      my $name = $entry->{name};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   481
      my $type = $entry->{type};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   482
      my $target = $entry->{target};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   483
      my $started = $entry->{started};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   484
      my $finished = $entry->{finished};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   485
      my $cases_total = $entry->{cases_total};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   486
      my $cases_passed = $entry->{cases_passed};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   487
      my $cases_failed = $entry->{cases_failed};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   488
      my $cases_not_run = $entry->{cases_not_run};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   489
      my $cases_not_available = $entry->{cases_not_available};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   490
      my $pass_rate = $entry->{pass_rate};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   491
    
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   492
      print " execute '$name,$type,$target,$started,$finished,$cases_total,$cases_passed,$cases_failed,$cases_not_run,$cases_not_available,$pass_rate'\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   493
      $query->execute($name,$type,$target,$started,$finished,$cases_total,$cases_passed,$cases_failed,$cases_not_run,$cases_not_available,$pass_rate)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   494
		    or print "WARNING: Couldn't execute insert into testing ($name,$type,$target,$started,$finished,$cases_total,$cases_passed,$cases_failed,$cases_not_run,$cases_not_available,$pass_rate): " . $db->errstr() . "\n" if (!$dryrun);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   495
    }
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   496
  }
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   497
  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
   498
}
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   499
elsif ($id)
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   500
{
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   501
  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
   502
  
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   503
  if (defined $builds_entry->{id} && $id != $builds_entry->{id})
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   504
  {
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   505
    print "ERROR: The build id specified in the input file is different than the one on the command line. Not updating build.\n";
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   506
    exit(1);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   507
  }
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   508
  
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   509
  if (keys %{$builds_entry})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   510
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   511
    my $field_list = '';
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   512
    my @fields = ();
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   513
    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
   514
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   515
      $field_list .= "$field=?,";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   516
      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
   517
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   518
    $field_list =~ s/,$//;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   519
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   520
    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
   521
    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
   522
      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
   523
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   524
    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
   525
    $query->execute(@fields)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   526
		  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
   527
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   528
  if (@{$envinfo})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   529
  {
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   530
	if (!$append)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   531
	{
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   532
      print " prepare 'delete from envinfo where build_id=$id'\n" if ($verbose);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   533
      my $delete_query = $db->prepare("delete from envinfo where build_id=$id")
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   534
        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
   535
    
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   536
      print " execute ''\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   537
      $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   538
	    or print "WARNING: Couldn't execute delete from envinfo: " . $db->errstr() . "\n" if (!$dryrun);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   539
    }
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 " 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
   542
    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
   543
      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
   544
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   545
    for my $entry (@{$envinfo})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   546
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   547
      my $tool = $entry->{tool};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   548
      my $version = $entry->{version};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   549
    
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   550
      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
   551
      $query->execute($tool, $version)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   552
		    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
   553
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   554
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   555
  if (@{$failures})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   556
  {
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   557
    if (!$append)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   558
	{
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   559
      print " prepare 'delete from failures where build_id=$id'\n" if ($verbose);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   560
      my $delete_query = $db->prepare("delete from failures where build_id=$id")
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   561
        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
   562
    
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   563
      print " execute ''\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   564
      $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   565
	    or print "WARNING: Couldn't execute delete from failures: " . $db->errstr() . "\n" if (!$dryrun);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   566
    }
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   567
	    
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   568
    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
   569
    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
   570
      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
   571
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   572
    for my $entry (@{$failures})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   573
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   574
      my $category = $entry->{category};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   575
      my $count = $entry->{count};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   576
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   577
      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
   578
      $query->execute($category, $count)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   579
		    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
   580
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   581
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   582
  if (@{$reports})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   583
  {
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   584
    if (!$append)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   585
	{
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   586
      print " prepare 'delete from reports where build_id=$id'\n" if ($verbose);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   587
      my $delete_query = $db->prepare("delete from reports where build_id=$id")
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   588
        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
   589
    
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   590
      print " execute ''\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   591
      $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   592
	    or print "WARNING: Couldn't execute delete from reports: " . $db->errstr() . "\n";
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   593
    }
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   594
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   595
    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
   596
    my $query = $db->prepare_cached("insert into reports (build_id,name,url,type) values ($id,?,?,?)")
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   597
      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
   598
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   599
    for my $entry (@{$reports})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   600
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   601
      my $name = $entry->{name};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   602
      my $url = $entry->{url};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   603
      my $type = $entry->{type};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   604
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   605
      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
   606
      $query->execute($name, $url, $type)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   607
		    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
   608
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   609
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   610
  if (@{$content})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   611
  {
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   612
    if (!$append)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   613
	{
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   614
	  print " prepare 'delete from content where build_id=$id'\n" if ($verbose);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   615
      my $delete_query = $db->prepare("delete from content where build_id=$id")
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   616
        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
   617
    
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   618
      print " execute ''\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   619
      $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   620
	    or print "WARNING: Couldn't execute delete from content: " . $db->errstr() . "\n" if (!$dryrun);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   621
    }
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   622
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   623
    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
   624
    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
   625
      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
   626
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   627
    for my $entry (@{$content})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   628
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   629
      my $name = $entry->{name};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   630
      my $url = $entry->{url};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   631
      my $revision = $entry->{revision};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   632
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   633
      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
   634
      $query->execute($name, $url, $revision)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   635
		    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
   636
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   637
  }
1176
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   638
  if (@{$baselines})
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   639
  {
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   640
    if (!$append)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   641
	{
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   642
	  print " prepare 'delete from baselines where build_id=$id'\n" if ($verbose);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   643
      my $delete_query = $db->prepare("delete from baselines where build_id=$id")
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   644
        or die("Couldn't prepare query delete from baselines: " . $db->errstr()) if (!$dryrun);
1176
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   645
    
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   646
      print " execute ''\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   647
      $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   648
	    or print "WARNING: Couldn't execute delete from baselines: " . $db->errstr() . "\n" if (!$dryrun);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   649
    }
1176
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   650
    
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   651
    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
   652
    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
   653
      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
   654
      
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   655
    for my $entry (@{$baselines})
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   656
    {
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   657
      my $type = $entry->{type};
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   658
      my $path = $entry->{path};
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   659
    
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   660
      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
   661
      $query->execute($type, $path)
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   662
		    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
   663
    }
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   664
  }
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   665
  if (@{$labels})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   666
  {
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   667
    if (!$append)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   668
	{
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   669
	  print " prepare 'delete from labels where build_id=$id'\n" if ($verbose);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   670
      my $delete_query = $db->prepare("delete from labels where build_id=$id")
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   671
        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
   672
    
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   673
      print " execute ''\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   674
      $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   675
	    or print "WARNING: Couldn't execute delete from labels: " . $db->errstr() . "\n" if (!$dryrun);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   676
    }
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   677
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   678
    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
   679
    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
   680
      or die("Couldn't prepare query insert into label: " . $db->errstr()) if (!$dryrun);
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   681
    
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   682
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   683
    for my $entry (@{$labels})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   684
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   685
      my $label = $entry->{label};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   686
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   687
      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
   688
      $query->execute($label)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   689
		    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
   690
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   691
  }
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   692
  if (@{$testing})
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   693
  {
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   694
    if (!$append)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   695
	{
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   696
	  print " prepare 'delete from testing where build_id=$id'\n" if ($verbose);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   697
      my $delete_query = $db->prepare("delete from testing where build_id=$id")
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   698
        or die("Couldn't prepare query delete from testing: " . $db->errstr()) if (!$dryrun);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   699
    
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   700
      print " execute ''\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   701
      $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   702
	    or print "WARNING: Couldn't execute delete from testing: " . $db->errstr() . "\n";
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   703
    }
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   704
    
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   705
    print " prepare 'insert into testing (build_id,name,type,target,started,finished,cases_total,cases_passed,cases_failed,cases_not_run,cases_not_available,pass_rate) values ($id,?,?,?,?,?,?,?,?,?,?,?)'\n" if ($verbose);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   706
    my $query = $db->prepare_cached("insert into testing (build_id,name,type,target,started,finished,cases_total,cases_passed,cases_failed,cases_not_run,cases_not_available,pass_rate) values ($id,?,?,?,?,?,?,?,?,?,?,?)")
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   707
      or die("Couldn't prepare query insert into testing: " . $db->errstr()) if (!$dryrun);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   708
      
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   709
    for my $entry (@{$testing})
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   710
    {
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   711
	  my $name = $entry->{name};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   712
      my $type = $entry->{type};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   713
      my $target = $entry->{target};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   714
      my $started = $entry->{started};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   715
      my $finished = $entry->{finished};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   716
      my $cases_total = $entry->{cases_total};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   717
      my $cases_passed = $entry->{cases_passed};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   718
      my $cases_failed = $entry->{cases_failed};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   719
      my $cases_not_run = $entry->{cases_not_run};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   720
      my $cases_not_available = $entry->{cases_not_available};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   721
      my $pass_rate = $entry->{pass_rate};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   722
    
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   723
      print " execute '$name,$type,$target,$started,$finished,$cases_total,$cases_passed,$cases_failed,$cases_not_run,$cases_not_available,$pass_rate'\n" if ($verbose);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   724
      $query->execute($name,$type,$target,$started,$finished,$cases_total,$cases_passed,$cases_failed,$cases_not_run,$cases_not_available,$pass_rate)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   725
		    or print "WARNING: Couldn't execute insert into testing ($name,$type,$target,$started,$finished,$cases_total,$cases_passed,$cases_failed,$cases_not_run,$cases_not_available,$pass_rate): " . $db->errstr() . "\n" if (!$dryrun);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   726
    }
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   727
  }
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   728
}
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   729
elsif ($delete)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   730
{
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   731
  print "Removing build $delete\n";
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   732
  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   733
  print " prepare 'delete from builds where id=$delete'\n" if ($verbose);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   734
  my $delete_query = $db->prepare("delete from builds where id=$delete")
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   735
    or die("Couldn't prepare query delete from builds: " . $db->errstr()) if (!$dryrun);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   736
  print " execute ''\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   737
  $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   738
    or print "WARNING: Couldn't execute delete from builds: " . $db->errstr() . "\n" if (!$dryrun);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   739
  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   740
  print " prepare 'delete from envinfo where build_id=$delete'\n" if ($verbose);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   741
  $delete_query = $db->prepare("delete from envinfo where build_id=$delete")
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   742
    or die("Couldn't prepare query delete from envinfo: " . $db->errstr()) if (!$dryrun);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   743
  print " execute ''\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   744
  $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   745
    or print "WARNING: Couldn't execute delete from envinfo: " . $db->errstr() . "\n" if (!$dryrun);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   746
  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   747
  print " prepare 'delete from failures where build_id=$delete'\n" if ($verbose);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   748
  $delete_query = $db->prepare("delete from failures where build_id=$delete")
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   749
    or die("Couldn't prepare query delete from failures: " . $db->errstr()) if (!$dryrun);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   750
  print " execute ''\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   751
  $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   752
    or print "WARNING: Couldn't execute delete from failures: " . $db->errstr() . "\n" if (!$dryrun);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   753
    
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   754
  print " prepare 'delete from reports where build_id=$delete'\n" if ($verbose);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   755
  $delete_query = $db->prepare("delete from reports where build_id=$delete")
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   756
    or die("Couldn't prepare query delete from reports: " . $db->errstr()) if (!$dryrun);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   757
  print " execute ''\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   758
  $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   759
    or print "WARNING: Couldn't execute delete from reports: " . $db->errstr() . "\n" if (!$dryrun);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   760
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   761
  print " prepare 'delete from content where build_id=$delete'\n" if ($verbose);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   762
  $delete_query = $db->prepare("delete from content where build_id=$delete")
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   763
    or die("Couldn't prepare query delete from content: " . $db->errstr()) if (!$dryrun);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   764
  print " execute ''\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   765
  $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   766
    or print "WARNING: Couldn't execute delete from content: " . $db->errstr() . "\n" if (!$dryrun);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   767
    
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   768
  print " prepare 'delete from baselines where build_id=$delete'\n" if ($verbose);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   769
  $delete_query = $db->prepare("delete from baselines where build_id=$delete")
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   770
    or die("Couldn't prepare query delete from baselines: " . $db->errstr()) if (!$dryrun);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   771
  print " execute ''\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   772
  $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   773
    or print "WARNING: Couldn't execute delete from baselines: " . $db->errstr() . "\n" if (!$dryrun);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   774
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   775
  print " prepare 'delete from labels where build_id=$delete'\n" if ($verbose);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   776
  $delete_query = $db->prepare("delete from labels where build_id=$delete")
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   777
    or die("Couldn't prepare query delete from labels: " . $db->errstr()) if (!$dryrun);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   778
  print " execute ''\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   779
  $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   780
    or print "WARNING: Couldn't execute delete from labels: " . $db->errstr() . "\n" if (!$dryrun);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   781
    
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   782
  print " prepare 'delete from testing where build_id=$delete'\n" if ($verbose);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   783
  $delete_query = $db->prepare("delete from testing where build_id=$delete")
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   784
    or die("Couldn't prepare query delete from testing: " . $db->errstr()) if (!$dryrun);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   785
  print " execute ''\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   786
  $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   787
    or print "WARNING: Couldn't execute delete from testing: " . $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
   788
}
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   789
DisconnectFromDB();
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   790
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   791