common/tools/bitops.pl
author Dario Sestito <darios@symbian.org>
Wed, 06 Oct 2010 11:18:12 +0100
changeset 1285 05c7556875df
parent 1281 c5308055d94d
permissions -rw-r--r--
Enable option to only upload testing data (used for migration)
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 = '';
1285
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
    18
my $testingonly = 0;
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    19
my $verbose = 0;
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
    20
my $dryrun = 0;
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    21
GetOptions((
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    22
	'create!' => \$create,
1281
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
    23
	'stringcheck!' => \$stringcheck,
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    24
	'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
    25
	'update=s' => \$id,
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    26
	'append!' => \$append,
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    27
	'remove=s' => \$delete,
1285
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
    28
	'testingonly!' => \$testingonly,
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    29
	'help!' => \$help,
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
    30
	'verbose!' => \$verbose,
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
    31
	'dryrun!' => \$dryrun,
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    32
));
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    33
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    34
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
    35
{
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    36
  print <<_EOH;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    37
bitops
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    38
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
    39
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    40
Usage:
1281
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
    41
  bitops.pl -c [-n] -f FILE
1285
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
    42
  bitops.pl -u ID [-a] [-t] -f FILE
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    43
  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
    44
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    45
Options:
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    46
  -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
    47
  -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
    48
                        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
    49
                        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
    50
  -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
    51
                        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
    52
  -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
    53
                        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
    54
                        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
    55
                        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
    56
                        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
    57
                        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
    58
  -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
    59
                        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
    60
                        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
    61
                        option for more information)
1285
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
    62
  -t, --testingonly     Only update the TESTING table and use ID obtained by
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
    63
                        match of build_id_string
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    64
  -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
    65
  -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
    66
                        See below for file format.
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
    67
  -v, --verbose         Increase info level
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
    68
  -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
    69
                        with the DB
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    70
  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    71
File format:
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    72
  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
    73
  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
    74
  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
    75
  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
    76
  - 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
    77
  - package (VALUE) - BUILDS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    78
  - platform (VALUE) - BUILDS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    79
  - started (VALUE) - BUILDS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    80
  - finished (VALUE) - BUILDS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    81
  - creator (VALUE) - BUILDS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    82
  - machine (VALUE) - BUILDS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    83
  - 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
    84
  - 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
    85
  - 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
    86
  - 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
    87
  - 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
    88
  - 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
    89
  - 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
    90
  - 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
    91
  - 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
    92
  - label (VALUE) - LABELS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    93
  - 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
    94
      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
    95
  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
    96
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
    97
_EOH
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    98
	exit(0);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    99
}
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   100
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   101
my $db = undef;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   102
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   103
my $builds_entry = {};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   104
my $envinfo = [];
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   105
my $failures = [];
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   106
my $reports = [];
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   107
my $content = [];
1176
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   108
my $baselines = [];
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   109
my $labels = [];
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   110
my $testing = [];
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   111
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   112
sub ConnectToDB()
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
	$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
   115
		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
   116
}
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
sub DisconnectFromDB()
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   119
{
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   120
	$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
   121
}
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   122
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   123
sub parse_file
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   124
{
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   125
  my ($file) = @_;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   126
  
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   127
  print "Reading $file...\n" if ($verbose);
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   128
  
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   129
  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
   130
  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   131
  while (<FILE>)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   132
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   133
    my $line = $_;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   134
    chomp $line;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   135
    $line =~ s/^\s//g;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   136
    $line =~ s/\s$//g;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   137
    next if ($line !~ /[^\s]/);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   138
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   139
    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
   140
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   141
      my $attr = $1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   142
      my $value = $2;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   143
      
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   144
      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
   145
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   146
        $attr = lc($attr);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   147
        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
   148
        $builds_entry->{$attr}=$value;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   149
      }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   150
      elsif ($attr =~ /^(envinfo)$/i)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   151
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   152
        $attr = lc($attr);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   153
        if ($value =~ /([^,]*),([^,]*)/)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   154
        {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   155
          my $tool = $1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   156
          my $version = $2;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   157
          
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   158
          if (!$tool || !$version)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   159
          {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   160
            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
   161
            return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   162
          }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   163
          print " 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
   164
          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
   165
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   166
        else
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
          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
   169
          return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   170
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   171
      }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   172
      elsif ($attr =~ /^(failure)$/i)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   173
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   174
        $attr = lc($attr);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   175
        if ($value =~ /([^,]*),([^,]*)/)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   176
        {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   177
          my $category = $1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   178
          my $count = $2;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   179
          
1182
f15fa527df95 Fix: bitops.pl reports an error if failure count is zero
Dario Sestito <darios@symbian.org>
parents: 1176
diff changeset
   180
          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
   181
          {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   182
            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
   183
            return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   184
          }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   185
          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
   186
          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
   187
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   188
        else
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   189
        {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   190
          print "ERROR: 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
   191
          return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   192
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   193
      }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   194
      elsif ($attr =~ /^(report)$/i)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   195
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   196
        $attr = lc($attr);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   197
        if ($value =~ /([^,]*),([^,]*),([^,]*)/)
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
          my $name = $1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   200
          my $url = $2;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   201
          my $type = $3;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   202
          
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   203
          if (!$name || !$url || !$type)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   204
          {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   205
            print "ERROR: 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
   206
            return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   207
          }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   208
          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
   209
          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
   210
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   211
        else
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
          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
   214
          return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   215
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   216
      }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   217
      elsif ($attr =~ /^(content)$/i)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   218
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   219
        $attr = lc($attr);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   220
        if ($value =~ /([^,]*),([^,]*),([^,]*)/)
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
          my $name = $1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   223
          my $url = $2;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   224
          my $revision = $3;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   225
          
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   226
          if (!$name || !$url || !$revision)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   227
          {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   228
            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
   229
            return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   230
          }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   231
          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
   232
          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
   233
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   234
        else
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   235
        {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   236
          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
   237
          return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   238
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   239
      }
1176
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   240
      elsif ($attr =~ /^(baseline)$/i)
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   241
      {
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   242
        $attr = lc($attr);
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   243
        if ($value =~ /([^,]*),([^,]*)/)
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   244
        {
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   245
          my $type = $1;
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   246
          my $path = $2;
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   247
          
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   248
          if (!$type || !$path)
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   249
          {
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   250
            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
   251
            return 1;
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   252
          }
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   253
          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
   254
          push(@{$baselines}, {type=>$type, path=>$path});
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   255
        }
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   256
        else
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   257
        {
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   258
          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
   259
          return 1;
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   260
        }
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   261
      }
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   262
      elsif ($attr =~ /^(label)$/i)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   263
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   264
        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
   265
        push(@{$labels}, {label=>$value});
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   266
      }
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   267
      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
   268
      {
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   269
        $attr = lc($attr);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   270
        if ($value =~ /([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*)/)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   271
        {
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   272
          my $name=$1;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   273
          my $type=$2;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   274
          my $target=$3;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   275
          my $started=$4;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   276
          my $finished=$5;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   277
          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
   278
          $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
   279
          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
   280
          $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
   281
          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
   282
          $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
   283
          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
   284
          $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
   285
          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
   286
          $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
   287
          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
   288
          $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
   289
          
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   290
          if (!$name)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   291
          {
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   292
            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
   293
            return 1;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   294
          }
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   295
          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
   296
          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
   297
            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
   298
            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
   299
        }
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   300
        else
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   301
        {
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   302
          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
   303
          return 1;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   304
        }
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   305
      }
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   306
      else
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
        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
   309
        return 1;
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
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   312
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   313
    else
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   314
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   315
      print "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
   316
      return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   317
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   318
  }
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
  close(FILE);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   321
  return 0;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   322
}
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   323
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   324
# MAIN PROGRAM
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   325
my $r=0;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   326
$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
   327
if ($r)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   328
{
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   329
  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
   330
  exit(1);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   331
}
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   332
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   333
print "Executing SQL commands...\n" if ($verbose);
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   334
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   335
ConnectToDB();
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   336
my $newbuildid = -1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   337
if ($create)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   338
{
1281
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
   339
  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
   340
  {
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
   341
    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
   342
    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
   343
    $query->execute();
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
   344
    my @ids_existing=();
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
   345
    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
   346
    $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
   347
    while($query->fetch())
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
      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
   350
    }
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
   351
    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
   352
    {
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
   353
      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
   354
      exit(1);
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
   355
	}
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
   356
  }
c5308055d94d Enable option to check that the build_id_string is unique
Dario Sestito <darios@symbian.org>
parents: 1280
diff changeset
   357
  
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   358
  if (keys %{$builds_entry})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   359
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   360
    my $field_list = '';
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   361
    my $qm_list = '';
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   362
    my @fields = ();
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   363
    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
   364
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   365
      $field_list .= "$field,";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   366
      $qm_list .= "?,";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   367
      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
   368
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   369
    $field_list =~ s/,$//;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   370
    $qm_list =~ s/,$//;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   371
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   372
    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
   373
      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
   374
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   375
    $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
   376
		  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
   377
		  
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   378
		$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
   379
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   380
  if (@{$envinfo})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   381
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   382
    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
   383
      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
   384
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   385
    for my $entry (@{$envinfo})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   386
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   387
      my $tool = $entry->{tool};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   388
      my $version = $entry->{version};
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
      $query->execute($tool, $version)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   391
		    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
   392
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   393
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   394
  if (@{$failures})
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
    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
   397
    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
   398
      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
   399
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   400
    for my $entry (@{$failures})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   401
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   402
      my $category = $entry->{category};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   403
      my $count = $entry->{count};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   404
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   405
      print " 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
   406
      $query->execute($category, $count)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   407
		    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
   408
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   409
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   410
  if (@{$reports})
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
    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
   413
    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
   414
      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
   415
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   416
    for my $entry (@{$reports})
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
      my $name = $entry->{name};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   419
      my $url = $entry->{url};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   420
      my $type = $entry->{type};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   421
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   422
      print " 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
   423
      $query->execute($name, $url, $type)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   424
		    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
   425
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   426
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   427
  if (@{$content})
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
    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
   430
    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
   431
      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
   432
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   433
    for my $entry (@{$content})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   434
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   435
      my $name = $entry->{name};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   436
      my $url = $entry->{url};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   437
      my $revision = $entry->{revision};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   438
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   439
      print " execute '$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
   440
      $query->execute($name, $url, $revision)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   441
		    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
   442
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   443
  }
1176
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   444
  if (@{$baselines})
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
    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
   447
    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
   448
      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
   449
      
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   450
    for my $entry (@{$baselines})
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   451
    {
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   452
      my $type = $entry->{type};
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   453
      my $path = $entry->{path};
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
      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
   456
      $query->execute($type, $path)
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   457
		    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
   458
    }
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   459
  }
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   460
  if (@{$labels})
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
    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
   463
    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
   464
      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
   465
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   466
    for my $entry (@{$labels})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   467
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   468
      my $label = $entry->{label};
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
      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
   471
      $query->execute($label)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   472
		    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
   473
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   474
  }
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   475
  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   476
  if (@{$testing})
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
    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
   479
    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
   480
      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
   481
      
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   482
    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
   483
    {
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   484
      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
   485
      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
   486
      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
   487
      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
   488
      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
   489
      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
   490
      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
   491
      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
   492
      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
   493
      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
   494
      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
   495
    
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   496
      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
   497
      $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
   498
		    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
   499
    }
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   500
  }
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   501
  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
   502
}
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   503
elsif ($id)
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   504
{
1285
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
   505
  my $extra = '';
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
   506
  $extra="for TESTING table only" if ($testingonly);
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
   507
  print "Updating build $id $extra\n";
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   508
  
1285
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
   509
  if (defined $builds_entry->{id} && $id != $builds_entry->{id} && !$testingonly)
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   510
  {
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   511
    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
   512
    exit(1);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   513
  }
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   514
  
1285
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
   515
  if ($testingonly)
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
   516
  {
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
   517
	die "build_id_string must be provided" if (!defined $builds_entry->{build_id_string});
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
   518
    print "Search for matching build_id_string\n" if ($verbose);
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
   519
    my $query=$db->prepare("select id from builds where build_id_string='$builds_entry->{build_id_string}';");
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
   520
    $query->execute();
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
   521
    my @ids_existing=();
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
   522
    my $id_existing=-1;
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
   523
    $query->bind_columns(\$id_existing);
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
   524
    while($query->fetch())
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
   525
    {
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
   526
      push(@ids_existing, $id_existing);
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
   527
    }
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
   528
    die "More than 1 id matching: @ids_existing" if (scalar(@ids_existing)>1);
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
   529
    $id=shift @ids_existing;
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
   530
    $builds_entry->{id}=$id;
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
   531
    print "Now changing id to $id\n";
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
   532
  }
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
   533
  
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
   534
  if (keys %{$builds_entry} && !$testingonly)
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   535
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   536
    my $field_list = '';
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   537
    my @fields = ();
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   538
    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
   539
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   540
      $field_list .= "$field=?,";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   541
      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
   542
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   543
    $field_list =~ s/,$//;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   544
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   545
    print " prepare '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
   546
    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
   547
      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
   548
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   549
    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
   550
    $query->execute(@fields)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   551
		  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
   552
  }
1285
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
   553
  if (@{$envinfo} && !$testingonly)
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   554
  {
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   555
	if (!$append)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   556
	{
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   557
      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
   558
      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
   559
        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
   560
    
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   561
      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
   562
      $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   563
	    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
   564
    }
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   565
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   566
    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
   567
    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
   568
      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
   569
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   570
    for my $entry (@{$envinfo})
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
      my $tool = $entry->{tool};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   573
      my $version = $entry->{version};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   574
    
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   575
      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
   576
      $query->execute($tool, $version)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   577
		    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
   578
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   579
  }
1285
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
   580
  if (@{$failures} && !$testingonly)
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   581
  {
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   582
    if (!$append)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   583
	{
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   584
      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
   585
      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
   586
        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
   587
    
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   588
      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
   589
      $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   590
	    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
   591
    }
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   592
	    
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   593
    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
   594
    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
   595
      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
   596
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   597
    for my $entry (@{$failures})
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
      my $category = $entry->{category};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   600
      my $count = $entry->{count};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   601
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   602
      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
   603
      $query->execute($category, $count)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   604
		    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
   605
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   606
  }
1285
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
   607
  if (@{$reports} && !$testingonly)
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   608
  {
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   609
    if (!$append)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   610
	{
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   611
      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
   612
      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
   613
        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
   614
    
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   615
      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
   616
      $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   617
	    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
   618
    }
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   619
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   620
    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
   621
    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
   622
      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
   623
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   624
    for my $entry (@{$reports})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   625
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   626
      my $name = $entry->{name};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   627
      my $url = $entry->{url};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   628
      my $type = $entry->{type};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   629
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   630
      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
   631
      $query->execute($name, $url, $type)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   632
		    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
   633
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   634
  }
1285
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
   635
  if (@{$content} && !$testingonly)
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   636
  {
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   637
    if (!$append)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   638
	{
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   639
	  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
   640
      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
   641
        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
   642
    
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   643
      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
   644
      $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   645
	    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
   646
    }
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   647
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   648
    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
   649
    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
   650
      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
   651
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   652
    for my $entry (@{$content})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   653
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   654
      my $name = $entry->{name};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   655
      my $url = $entry->{url};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   656
      my $revision = $entry->{revision};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   657
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   658
      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
   659
      $query->execute($name, $url, $revision)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   660
		    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
   661
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   662
  }
1285
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
   663
  if (@{$baselines} && !$testingonly)
1176
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   664
  {
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   665
    if (!$append)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   666
	{
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   667
	  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
   668
      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
   669
        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
   670
    
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   671
      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
   672
      $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   673
	    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
   674
    }
1176
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   675
    
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   676
    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
   677
    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
   678
      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
   679
      
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   680
    for my $entry (@{$baselines})
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   681
    {
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   682
      my $type = $entry->{type};
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   683
      my $path = $entry->{path};
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   684
    
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   685
      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
   686
      $query->execute($type, $path)
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   687
		    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
   688
    }
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1175
diff changeset
   689
  }
1285
05c7556875df Enable option to only upload testing data (used for migration)
Dario Sestito <darios@symbian.org>
parents: 1281
diff changeset
   690
  if (@{$labels} && !$testingonly)
1158
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 (!$append)
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
	  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
   695
      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
   696
        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
   697
    
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   698
      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
   699
      $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   700
	    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
   701
    }
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   702
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   703
    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
   704
    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
   705
      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
   706
    
1158
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   707
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   708
    for my $entry (@{$labels})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   709
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   710
      my $label = $entry->{label};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   711
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   712
      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
   713
      $query->execute($label)
1175
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1162
diff changeset
   714
		    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
   715
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   716
  }
1280
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   717
  if (@{$testing})
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   718
  {
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   719
    if (!$append)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   720
	{
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   721
	  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
   722
      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
   723
        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
   724
    
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   725
      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
   726
      $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   727
	    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
   728
    }
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   729
    
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   730
    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
   731
    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
   732
      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
   733
      
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   734
    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
   735
    {
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   736
	  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
   737
      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
   738
      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
   739
      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
   740
      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
   741
      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
   742
      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
   743
      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
   744
      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
   745
      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
   746
      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
   747
    
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   748
      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
   749
      $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
   750
		    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
   751
    }
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   752
  }
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
elsif ($delete)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   755
{
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   756
  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
   757
  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   758
  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
   759
  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
   760
    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
   761
  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
   762
  $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   763
    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
   764
  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   765
  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
   766
  $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
   767
    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
   768
  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
   769
  $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   770
    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
   771
  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   772
  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
   773
  $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
   774
    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
   775
  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
   776
  $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   777
    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
   778
    
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   779
  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
   780
  $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
   781
    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
   782
  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
   783
  $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   784
    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
   785
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   786
  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
   787
  $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
   788
    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
   789
  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
   790
  $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   791
    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
   792
    
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   793
  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
   794
  $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
   795
    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
   796
  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
   797
  $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   798
    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
   799
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   800
  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
   801
  $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
   802
    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
   803
  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
   804
  $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   805
    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
   806
    
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   807
  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
   808
  $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
   809
    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
   810
  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
   811
  $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1182
diff changeset
   812
    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
   813
}
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   814
DisconnectFromDB();
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   815
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   816