common/tools/bitops.pl
author Dario Sestito <darios@symbian.org>
Tue, 05 Oct 2010 13:32:23 +0100
changeset 1248 61388ab6ba2c
parent 1170 f15fa527df95
child 1249 c5308055d94d
permissions -rw-r--r--
Enable update of build without removing entries first. Add remove operation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     1
use strict;
1150
1127dea6b78b Fix: DBD-mysql is missing
Dario Sestito <darios@symbian.org>
parents: 1146
diff changeset
     2
1127dea6b78b Fix: DBD-mysql is missing
Dario Sestito <darios@symbian.org>
parents: 1146
diff changeset
     3
use FindBin;
1127dea6b78b Fix: DBD-mysql is missing
Dario Sestito <darios@symbian.org>
parents: 1146
diff changeset
     4
use lib "$FindBin::Bin/lib";
1127dea6b78b Fix: DBD-mysql is missing
Dario Sestito <darios@symbian.org>
parents: 1146
diff changeset
     5
1146
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;
1248
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    13
my $file = '';
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    14
my $id = '';
1248
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    15
my $append = 0;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    16
my $delete = '';
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    17
my $verbose = 0;
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
    18
my $dryrun = 0;
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    19
GetOptions((
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    20
	'create!' => \$create,
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    21
	'file=s' => \$file,
1248
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    22
	'update=s' => \$id,
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    23
	'append!' => \$append,
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    24
	'remove=s' => \$delete,
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    25
	'help!' => \$help,
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
    26
	'verbose!' => \$verbose,
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
    27
	'dryrun!' => \$dryrun,
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    28
));
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    29
1248
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    30
if ($help||(($create||$id)&&!$file)||(!$create&&!$id&&!$delete))
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    31
{
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    32
  print <<_EOH;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    33
bitops
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    34
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
    35
1248
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    36
Usage:
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    37
  bitops.pl -c -f FILE
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    38
  bitops.pl -u ID [-a] -f FILE
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    39
  bitops.pl -r ID
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    40
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    41
Options:
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    42
  -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
    43
  -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
    44
                        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
    45
                        the newly created build.
1248
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    46
  -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: 1170
diff changeset
    47
                        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: 1170
diff changeset
    48
                        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: 1170
diff changeset
    49
                        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: 1170
diff changeset
    50
                        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: 1170
diff changeset
    51
                        changed with the -a option)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    52
  -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: 1170
diff changeset
    53
                        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: 1170
diff changeset
    54
                        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: 1170
diff changeset
    55
                        option for more information)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    56
  -r, --remove          Remove build ID (entries in all tables) from the db
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    57
  -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
    58
                        See below for file format.
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
    59
  -v, --verbose         Increase info level
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
    60
  -d, --dryrun          Only show what would happen, do not actually interact
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
    61
                        with the DB
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    62
  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    63
File format:
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    64
  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
    65
  attribute and value are separated by a tab.
1248
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    66
  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: 1170
diff changeset
    67
  the table they belong to:
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    68
  - build_id_string - BUILDS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    69
  - package (VALUE) - BUILDS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    70
  - platform (VALUE) - BUILDS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    71
  - started (VALUE) - BUILDS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    72
  - finished (VALUE) - BUILDS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    73
  - creator (VALUE) - BUILDS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    74
  - machine (VALUE) - BUILDS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    75
  - build_brag (VALUE) - BUILDS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    76
  - test_brag (VALUE) - BUILDS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    77
  - baseline_short (VALUE) - BUILDS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    78
  - sources_short (VALUE) - BUILDS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    79
  - envinfo (TOOL,VERSION) - ENVINFO
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    80
  - failure (CATEGORY,COUNT) - FAILURES
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    81
  - report (NAME,URL,TYPE) - REPORTS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    82
  - content (NAME,URL,REVISION) - CONTENT
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    83
  - baseline (TYPE,PATH) - BASELINES
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    84
  - label (VALUE) - LABELS
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    85
  - 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: 1170
diff changeset
    86
      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: 1170
diff changeset
    87
  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
    88
Note on the update operation:
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    89
_EOH
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    90
	exit(0);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    91
}
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    92
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    93
my $db = undef;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    94
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    95
my $builds_entry = {};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    96
my $envinfo = [];
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    97
my $failures = [];
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    98
my $reports = [];
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    99
my $content = [];
1164
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   100
my $baselines = [];
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   101
my $labels = [];
1248
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   102
my $testing = [];
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   103
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   104
sub ConnectToDB()
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   105
{
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   106
	$db = DBI->connect('DBI:mysql:bit:v800016:3306','fbf','mysql')
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   107
		or die("Couldn't connect to database: " . DBI->errstr()) if (!$dryrun);
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   108
}
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   109
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   110
sub DisconnectFromDB()
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   111
{
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   112
	$db->disconnect() if (!$dryrun);
1146
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
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   115
sub parse_file
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   116
{
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   117
  my ($file) = @_;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   118
  
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   119
  print "Reading $file...\n" if ($verbose);
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   120
  
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   121
  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
   122
  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   123
  while (<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 $line = $_;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   126
    chomp $line;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   127
    $line =~ s/^\s//g;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   128
    $line =~ s/\s$//g;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   129
    next if ($line !~ /[^\s]/);
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
    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
   132
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   133
      my $attr = $1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   134
      my $value = $2;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   135
      
1248
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   136
      if ($attr =~ /^(build_id_string|package|platform|started|finished|creator|machine|build_brag|test_brag|baseline_short|sources_short|id)$/i)
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   137
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   138
        $attr = lc($attr);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   139
        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
   140
        $builds_entry->{$attr}=$value;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   141
      }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   142
      elsif ($attr =~ /^(envinfo)$/i)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   143
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   144
        $attr = lc($attr);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   145
        if ($value =~ /([^,]*),([^,]*)/)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   146
        {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   147
          my $tool = $1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   148
          my $version = $2;
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
          if (!$tool || !$version)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   151
          {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   152
            print "ERROR: 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
   153
            return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   154
          }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   155
          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
   156
          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
   157
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   158
        else
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: 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
   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
      }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   164
      elsif ($attr =~ /^(failure)$/i)
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
        $attr = lc($attr);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   167
        if ($value =~ /([^,]*),([^,]*)/)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   168
        {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   169
          my $category = $1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   170
          my $count = $2;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   171
          
1170
f15fa527df95 Fix: bitops.pl reports an error if failure count is zero
Dario Sestito <darios@symbian.org>
parents: 1164
diff changeset
   172
          if (!$category || !defined $count || $count eq '')
1146
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
            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
   175
            return 1;
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
          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
   178
          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
   179
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   180
        else
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: 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
   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
      }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   186
      elsif ($attr =~ /^(report)$/i)
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
        $attr = lc($attr);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   189
        if ($value =~ /([^,]*),([^,]*),([^,]*)/)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   190
        {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   191
          my $name = $1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   192
          my $url = $2;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   193
          my $type = $3;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   194
          
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   195
          if (!$name || !$url || !$type)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   196
          {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   197
            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
   198
            return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   199
          }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   200
          print " found ($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
   201
          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
   202
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   203
        else
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   204
        {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   205
          print "ERROR: Could not understand 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
   206
          return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   207
        }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   208
      }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   209
      elsif ($attr =~ /^(content)$/i)
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
        $attr = lc($attr);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   212
        if ($value =~ /([^,]*),([^,]*),([^,]*)/)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   213
        {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   214
          my $name = $1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   215
          my $url = $2;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   216
          my $revision = $3;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   217
          
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   218
          if (!$name || !$url || !$revision)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   219
          {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   220
            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
   221
            return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   222
          }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   223
          print " found ($name,$url,$revision) for table 'content'\n" if ($verbose);
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   224
          push(@{$content}, {name=>$name, url=>$url, revision=>$revision});
1146
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
        else
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: 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
   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
      }
1164
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   232
      elsif ($attr =~ /^(baseline)$/i)
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   233
      {
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   234
        $attr = lc($attr);
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   235
        if ($value =~ /([^,]*),([^,]*)/)
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   236
        {
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   237
          my $type = $1;
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   238
          my $path = $2;
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   239
          
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   240
          if (!$type || !$path)
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   241
          {
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   242
            print "ERROR: Type or path empty: \"$value\"\n";
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   243
            return 1;
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   244
          }
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   245
          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: 1163
diff changeset
   246
          push(@{$baselines}, {type=>$type, path=>$path});
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   247
        }
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   248
        else
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   249
        {
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   250
          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: 1163
diff changeset
   251
          return 1;
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   252
        }
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   253
      }
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   254
      elsif ($attr =~ /^(label)$/i)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   255
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   256
        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
   257
        push(@{$labels}, {label=>$value});
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   258
      }
1248
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   259
      elsif ($attr =~ /^(test)$/i)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   260
      {
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   261
        $attr = lc($attr);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   262
        if ($value =~ /([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*)/)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   263
        {
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   264
          my $name=$1;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   265
          my $type=$2;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   266
          my $target=$3;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   267
          my $started=$4;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   268
          my $finished=$5;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   269
          my $cases_total=$6;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   270
          $cases_total=0 if (!$cases_total);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   271
          my $cases_passed=$7;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   272
          $cases_passed=0 if (!$cases_passed);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   273
          my $cases_failed=$8;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   274
          $cases_failed=0 if (!$cases_failed);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   275
          my $cases_not_run=$9;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   276
          $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: 1170
diff changeset
   277
          my $cases_not_available=$10;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   278
          $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: 1170
diff changeset
   279
          my $pass_rate=$11;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   280
          $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: 1170
diff changeset
   281
          
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   282
          if (!$name)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   283
          {
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   284
            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: 1170
diff changeset
   285
            return 1;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   286
          }
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   287
          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: 1170
diff changeset
   288
          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: 1170
diff changeset
   289
            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: 1170
diff changeset
   290
            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: 1170
diff changeset
   291
        }
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   292
        else
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   293
        {
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   294
          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: 1170
diff changeset
   295
          return 1;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   296
        }
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   297
      }
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   298
      else
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   299
      {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   300
        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
   301
        return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   302
      }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   303
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   304
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   305
    else
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   306
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   307
      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
   308
      return 1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   309
    }
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
  close(FILE);
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   313
  return 0;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   314
}
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   315
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   316
# MAIN PROGRAM
1248
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   317
my $r=0;
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   318
$r=parse_file($file) if ($create||$id);
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   319
if ($r)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   320
{
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   321
  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
   322
  exit(1);
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
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   325
print "Executing SQL commands...\n" if ($verbose);
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   326
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   327
ConnectToDB();
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   328
my $newbuildid = -1;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   329
if ($create)
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   330
{
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   331
  if (keys %{$builds_entry})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   332
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   333
    my $field_list = '';
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   334
    my $qm_list = '';
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   335
    my @fields = ();
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   336
    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
   337
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   338
      $field_list .= "$field,";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   339
      $qm_list .= "?,";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   340
      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
   341
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   342
    $field_list =~ s/,$//;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   343
    $qm_list =~ s/,$//;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   344
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   345
    my $query = $db->prepare("insert into builds ($field_list) values ($qm_list)")
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   346
      or die("Couldn't prepare query insert into builds: " . $db->errstr()) if (!$dryrun);
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   347
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   348
    $query->execute(@fields)
1248
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   349
		  or print "WARNING: Couldn't execute insert into builds ($field_list) values (@fields): " . $db->errstr() . "\n" if (!$dryrun);
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   350
		  
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   351
		$newbuildid = $db->last_insert_id(undef, undef, undef, undef) if (!$dryrun);
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   352
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   353
  if (@{$envinfo})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   354
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   355
    my $query = $db->prepare_cached("insert into envinfo (build_id,tool,version) values ($newbuildid,?,?)")
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   356
      or die("Couldn't prepare query insert into envinfo: " . $db->errstr()) if (!$dryrun);
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   357
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   358
    for my $entry (@{$envinfo})
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 $tool = $entry->{tool};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   361
      my $version = $entry->{version};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   362
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   363
      $query->execute($tool, $version)
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   364
		    or print "WARNING: Couldn't execute insert into envinfo ($tool,$version): " . $db->errstr() . "\n" if (!$dryrun);
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   365
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   366
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   367
  if (@{$failures})
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
    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
   370
    my $query = $db->prepare_cached("insert into failures (build_id,category,count) values ($newbuildid,?,?)")
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   371
      or die("Couldn't prepare query insert into failures: " . $db->errstr()) if (!$dryrun);
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   372
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   373
    for my $entry (@{$failures})
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
      my $category = $entry->{category};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   376
      my $count = $entry->{count};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   377
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   378
      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
   379
      $query->execute($category, $count)
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   380
		    or print "WARNING: Couldn't execute insert into failures ($category,$count): " . $db->errstr() . "\n" if (!$dryrun);
1146
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
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   383
  if (@{$reports})
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
    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
   386
    my $query = $db->prepare_cached("insert into reports (build_id,name,url,type) values ($newbuildid,?,?,?)")
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   387
      or die("Couldn't prepare query insert into reports: " . $db->errstr()) if (!$dryrun);
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   388
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   389
    for my $entry (@{$reports})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   390
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   391
      my $name = $entry->{name};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   392
      my $url = $entry->{url};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   393
      my $type = $entry->{type};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   394
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   395
      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
   396
      $query->execute($name, $url, $type)
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   397
		    or print "WARNING: Couldn't execute insert into reports ($name,$url,$type): " . $db->errstr() . "\n" if (!$dryrun);
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   398
    }
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
  if (@{$content})
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
    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
   403
    my $query = $db->prepare_cached("insert into content (build_id,name,url,revision) values ($newbuildid,?,?,?)")
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   404
      or die("Couldn't prepare query insert into content: " . $db->errstr()) if (!$dryrun);
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   405
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   406
    for my $entry (@{$content})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   407
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   408
      my $name = $entry->{name};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   409
      my $url = $entry->{url};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   410
      my $revision = $entry->{revision};
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 " 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
   413
      $query->execute($name, $url, $revision)
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   414
		    or print "WARNING: Couldn't execute insert into content ($name,$url,$revision): " . $db->errstr() . "\n" if (!$dryrun);
1146
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
  }
1164
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   417
  if (@{$baselines})
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   418
  {
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   419
    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: 1163
diff changeset
   420
    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: 1163
diff changeset
   421
      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: 1163
diff changeset
   422
      
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   423
    for my $entry (@{$baselines})
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   424
    {
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   425
      my $type = $entry->{type};
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   426
      my $path = $entry->{path};
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   427
    
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   428
      print " execute '$type, $path'\n" if ($verbose);  
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   429
      $query->execute($type, $path)
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   430
		    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: 1163
diff changeset
   431
    }
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   432
  }
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   433
  if (@{$labels})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   434
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   435
    print " prepare_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
   436
    my $query = $db->prepare_cached("insert into labels (build_id,label) values ($newbuildid,?)")
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   437
      or die("Couldn't prepare query insert into labels: " . $db->errstr()) if (!$dryrun);
1146
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
    for my $entry (@{$labels})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   440
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   441
      my $label = $entry->{label};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   442
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   443
      print " execute '$label'\n" if ($verbose);  
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   444
      $query->execute($label)
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   445
		    or print "WARNING: Couldn't execute insert into revision ($label): " . $db->errstr() . "\n" if (!$dryrun);
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   446
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   447
  }
1248
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   448
  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   449
  if (@{$testing})
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   450
  {
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   451
    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: 1170
diff changeset
   452
    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: 1170
diff changeset
   453
      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: 1170
diff changeset
   454
      
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   455
    for my $entry (@{$testing})
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   456
    {
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   457
      my $name = $entry->{name};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   458
      my $type = $entry->{type};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   459
      my $target = $entry->{target};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   460
      my $started = $entry->{started};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   461
      my $finished = $entry->{finished};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   462
      my $cases_total = $entry->{cases_total};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   463
      my $cases_passed = $entry->{cases_passed};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   464
      my $cases_failed = $entry->{cases_failed};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   465
      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: 1170
diff changeset
   466
      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: 1170
diff changeset
   467
      my $pass_rate = $entry->{pass_rate};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   468
    
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   469
      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: 1170
diff changeset
   470
      $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: 1170
diff changeset
   471
		    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: 1170
diff changeset
   472
    }
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   473
  }
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   474
  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
   475
}
1248
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   476
elsif ($id)
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   477
{
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   478
  print "Updating build $id\n";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   479
  
1248
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   480
  if (defined $builds_entry->{id} && $id != $builds_entry->{id})
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   481
  {
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   482
    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: 1170
diff changeset
   483
    exit(1);
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   484
  }
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   485
  
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   486
  if (keys %{$builds_entry})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   487
  {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   488
    my $field_list = '';
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   489
    my @fields = ();
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   490
    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
   491
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   492
      $field_list .= "$field=?,";
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   493
      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
   494
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   495
    $field_list =~ s/,$//;
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   496
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   497
    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
   498
    my $query = $db->prepare("update builds set $field_list where id=$id")
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   499
      or die("Couldn't prepare query update builds: " . $db->errstr()) if (!$dryrun);
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   500
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   501
    print " 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
   502
    $query->execute(@fields)
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   503
		  or print "WARNING: Couldn't execute update builds (@fields): " . $db->errstr() . "\n" if (!$dryrun);
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   504
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   505
  if (@{$envinfo})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   506
  {
1248
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   507
	if (!$append)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   508
	{
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   509
      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: 1170
diff changeset
   510
      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: 1170
diff changeset
   511
        or die("Couldn't prepare query delete from envinfo: " . $db->errstr()) if (!$dryrun);
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   512
    
1248
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   513
      print " execute ''\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   514
      $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   515
	    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: 1170
diff changeset
   516
    }
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   517
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   518
    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
   519
    my $query = $db->prepare_cached("insert into envinfo (build_id,tool,version) values ($id,?,?)")
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   520
      or die("Couldn't prepare query insert into envinfo: " . $db->errstr()) if (!$dryrun);
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   521
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   522
    for my $entry (@{$envinfo})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   523
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   524
      my $tool = $entry->{tool};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   525
      my $version = $entry->{version};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   526
    
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   527
      print " execute '$tool,$version'\n" if ($verbose);
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   528
      $query->execute($tool, $version)
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   529
		    or print "WARNING: Couldn't execute insert into envinfo ($tool,$version): " . $db->errstr() . "\n" if (!$dryrun);
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   530
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   531
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   532
  if (@{$failures})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   533
  {
1248
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   534
    if (!$append)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   535
	{
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   536
      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: 1170
diff changeset
   537
      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: 1170
diff changeset
   538
        or die("Couldn't prepare query delete from failures: " . $db->errstr()) if (!$dryrun);
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   539
    
1248
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   540
      print " execute ''\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   541
      $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   542
	    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: 1170
diff changeset
   543
    }
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   544
	    
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   545
    print " prepare 'insert into 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
   546
    my $query = $db->prepare_cached("insert into failures (build_id,category,count) values ($id,?,?)")
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   547
      or die("Couldn't prepare query insert into failures: " . $db->errstr()) if (!$dryrun);
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   548
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   549
    for my $entry (@{$failures})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   550
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   551
      my $category = $entry->{category};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   552
      my $count = $entry->{count};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   553
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   554
      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
   555
      $query->execute($category, $count)
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   556
		    or print "WARNING: Couldn't execute insert into failures ($category,$count): " . $db->errstr() . "\n" if (!$dryrun);
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   557
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   558
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   559
  if (@{$reports})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   560
  {
1248
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   561
    if (!$append)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   562
	{
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   563
      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: 1170
diff changeset
   564
      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: 1170
diff changeset
   565
        or die("Couldn't prepare query delete from reports: " . $db->errstr()) if (!$dryrun);
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   566
    
1248
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   567
      print " execute ''\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   568
      $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   569
	    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: 1170
diff changeset
   570
    }
1146
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
    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
   573
    my $query = $db->prepare_cached("insert into reports (build_id,name,url,type) values ($id,?,?,?)")
1248
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   574
      or die("Couldn't prepare query insert into reports: " . $db->errstr()) if (!$dryrun);
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   575
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   576
    for my $entry (@{$reports})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   577
    {
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   578
      my $name = $entry->{name};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   579
      my $url = $entry->{url};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   580
      my $type = $entry->{type};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   581
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   582
      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
   583
      $query->execute($name, $url, $type)
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   584
		    or print "WARNING: Couldn't execute insert into reports ($name,$url,$type): " . $db->errstr() . "\n" if (!$dryrun);
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   585
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   586
  }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   587
  if (@{$content})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   588
  {
1248
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   589
    if (!$append)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   590
	{
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   591
	  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: 1170
diff changeset
   592
      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: 1170
diff changeset
   593
        or die("Couldn't prepare query delete from content: " . $db->errstr()) if (!$dryrun);
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   594
    
1248
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   595
      print " execute ''\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   596
      $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   597
	    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: 1170
diff changeset
   598
    }
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   599
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   600
    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
   601
    my $query = $db->prepare_cached("insert into content (build_id,name,url,revision) values ($id,?,?,?)")
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   602
      or die("Couldn't prepare query insert into content: " . $db->errstr()) if (!$dryrun);
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   603
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   604
    for my $entry (@{$content})
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
      my $name = $entry->{name};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   607
      my $url = $entry->{url};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   608
      my $revision = $entry->{revision};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   609
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   610
      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
   611
      $query->execute($name, $url, $revision)
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   612
		    or print "WARNING: Couldn't execute insert into content ($name,$url,$revision): " . $db->errstr() . "\n" if (!$dryrun);
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   613
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   614
  }
1164
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   615
  if (@{$baselines})
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   616
  {
1248
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   617
    if (!$append)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   618
	{
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   619
	  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: 1170
diff changeset
   620
      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: 1170
diff changeset
   621
        or die("Couldn't prepare query delete from baselines: " . $db->errstr()) if (!$dryrun);
1164
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   622
    
1248
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   623
      print " execute ''\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   624
      $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   625
	    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: 1170
diff changeset
   626
    }
1164
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   627
    
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   628
    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: 1163
diff changeset
   629
    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: 1163
diff changeset
   630
      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: 1163
diff changeset
   631
      
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   632
    for my $entry (@{$baselines})
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   633
    {
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   634
      my $type = $entry->{type};
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   635
      my $path = $entry->{path};
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   636
    
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   637
      print " execute '$type,$path'\n" if ($verbose);  
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   638
      $query->execute($type, $path)
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   639
		    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: 1163
diff changeset
   640
    }
5fcaa694186a Enable new attribute 'baseline' for new 'baselines' table
Dario Sestito <darios@symbian.org>
parents: 1163
diff changeset
   641
  }
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   642
  if (@{$labels})
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   643
  {
1248
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   644
    if (!$append)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   645
	{
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   646
	  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: 1170
diff changeset
   647
      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: 1170
diff changeset
   648
        or die("Couldn't prepare query delete from labels: " . $db->errstr()) if (!$dryrun);
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   649
    
1248
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   650
      print " execute ''\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   651
      $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   652
	    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: 1170
diff changeset
   653
    }
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   654
    
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   655
    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
   656
    my $query = $db->prepare_cached("insert into label (build_id,label) values ($id,?)")
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   657
      or die("Couldn't prepare query insert into label: " . $db->errstr()) if (!$dryrun);
1248
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   658
    
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   659
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   660
    for my $entry (@{$labels})
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
      my $label = $entry->{label};
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   663
      
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   664
      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
   665
      $query->execute($label)
1163
b1b8e71b0c52 Add dryrun option to bitops.pl
Dario Sestito <darios@symbian.org>
parents: 1150
diff changeset
   666
		    or print "WARNING: Couldn't execute insert into labels ($label): " . $db->errstr() . "\n" if (!$dryrun);
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   667
    }
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   668
  }
1248
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   669
  if (@{$testing})
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   670
  {
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   671
    if (!$append)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   672
	{
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   673
	  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: 1170
diff changeset
   674
      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: 1170
diff changeset
   675
        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: 1170
diff changeset
   676
    
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   677
      print " execute ''\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   678
      $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   679
	    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: 1170
diff changeset
   680
    }
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   681
    
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   682
    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: 1170
diff changeset
   683
    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: 1170
diff changeset
   684
      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: 1170
diff changeset
   685
      
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   686
    for my $entry (@{$testing})
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   687
    {
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   688
	  my $name = $entry->{name};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   689
      my $type = $entry->{type};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   690
      my $target = $entry->{target};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   691
      my $started = $entry->{started};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   692
      my $finished = $entry->{finished};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   693
      my $cases_total = $entry->{cases_total};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   694
      my $cases_passed = $entry->{cases_passed};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   695
      my $cases_failed = $entry->{cases_failed};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   696
      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: 1170
diff changeset
   697
      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: 1170
diff changeset
   698
      my $pass_rate = $entry->{pass_rate};
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   699
    
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   700
      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: 1170
diff changeset
   701
      $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: 1170
diff changeset
   702
		    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: 1170
diff changeset
   703
    }
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   704
  }
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   705
}
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   706
elsif ($delete)
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   707
{
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   708
  print "Removing build $delete\n";
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   709
  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   710
  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: 1170
diff changeset
   711
  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: 1170
diff changeset
   712
    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: 1170
diff changeset
   713
  print " execute ''\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   714
  $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   715
    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: 1170
diff changeset
   716
  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   717
  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: 1170
diff changeset
   718
  $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: 1170
diff changeset
   719
    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: 1170
diff changeset
   720
  print " execute ''\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   721
  $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   722
    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: 1170
diff changeset
   723
  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   724
  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: 1170
diff changeset
   725
  $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: 1170
diff changeset
   726
    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: 1170
diff changeset
   727
  print " execute ''\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   728
  $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   729
    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: 1170
diff changeset
   730
    
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   731
  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: 1170
diff changeset
   732
  $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: 1170
diff changeset
   733
    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: 1170
diff changeset
   734
  print " execute ''\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   735
  $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   736
    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: 1170
diff changeset
   737
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   738
  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: 1170
diff changeset
   739
  $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: 1170
diff changeset
   740
    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: 1170
diff changeset
   741
  print " execute ''\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   742
  $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   743
    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: 1170
diff changeset
   744
    
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   745
  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: 1170
diff changeset
   746
  $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: 1170
diff changeset
   747
    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: 1170
diff changeset
   748
  print " execute ''\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   749
  $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   750
    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: 1170
diff changeset
   751
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   752
  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: 1170
diff changeset
   753
  $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: 1170
diff changeset
   754
    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: 1170
diff changeset
   755
  print " execute ''\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   756
  $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   757
    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: 1170
diff changeset
   758
    
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   759
  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: 1170
diff changeset
   760
  $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: 1170
diff changeset
   761
    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: 1170
diff changeset
   762
  print " execute ''\n" if ($verbose);  
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   763
  $delete_query->execute()
61388ab6ba2c Enable update of build without removing entries first. Add remove operation
Dario Sestito <darios@symbian.org>
parents: 1170
diff changeset
   764
    or print "WARNING: Couldn't execute delete from testing: " . $db->errstr() . "\n" if (!$dryrun);
1146
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   765
}
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   766
DisconnectFromDB();
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   767
739036c00f80 Add bitops.pl. Dump start info and envinfo to bitinfo.txt
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   768