releasing/cbrtools/perl/NotesCompiler.pm
author Bob Rosenberg <bob.rosenberg@nokia.com>
Mon, 06 Sep 2010 09:57:24 +0100
changeset 639 0e65f93be3cb
parent 602 3145852acc89
permissions -rw-r--r--
Joinsysdef schema calculation handles missing files. rootsystef generation does not modify embedded metatdata.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
602
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     1
# Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     2
# All rights reserved.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     3
# This component and the accompanying materials are made available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     4
# under the terms of the License "Eclipse Public License v1.0"
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     5
# which accompanies this distribution, and is available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     6
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     7
# 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     8
# Initial Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     9
# Nokia Corporation - initial contribution.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    10
# 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    11
# Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    12
# 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    13
# Description:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    14
# 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    15
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    16
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    17
package NotesCompiler;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    18
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    19
use strict;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    20
use CGI qw(-no_debug :standard start_ul);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    21
use IniData;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    22
use RelData;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    23
use EnvDb;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    24
use MrpData;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    25
use IO::File;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    26
use File::Basename;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    27
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    28
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    29
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    30
# Constants.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    31
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    32
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    33
use constant NOTES_DIREXTENSION => '.RelNotes';
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    34
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    35
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    36
# Public.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    37
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    38
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    39
sub New {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    40
  my $pkg = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    41
  my $self = {};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    42
  bless $self, $pkg;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    43
  $self->{iniData} = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    44
  $self->{comp} = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    45
  $self->{ver} = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    46
  $self->{verbose} = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    47
  $self->{htmlMainFile} = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    48
  $self->{outputSTDOUTonly} = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    49
  $self->{htmlNotes} = shift; # flag to render old notes as html or plain text
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    50
  $self->{fh} = undef; # filehandle to write to
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    51
  $self->{envDb} = EnvDb->Open($self->{iniData}, $self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    52
  # Not using 'use constant' because that requires Utils::PrependEpocRoot to be called at compile-time
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    53
  $self->{notes_store} = Utils::PrependEpocRoot('\\epoc32\\relinfo\\notes'); # constant
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    54
  return $self;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    55
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    56
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    57
sub DoStandardNotes {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    58
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    59
  if( !defined ($self->{htmlMainFile} )) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    60
    my $filename = $self->{comp}.".".$self->{ver};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    61
    if ($self->{htmlNotes}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    62
      $filename.=".htmlnotes";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    63
    } else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    64
      $filename.=".textnotes";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    65
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    66
    $self->{htmlName} = $self->{notes_store} . "\\$filename.html";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    67
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    68
  else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    69
    $self->{htmlName} = $self->{htmlMainFile};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    70
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    71
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    72
  if(!defined ($self->{outputSTDOUTonly})){
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    73
    $self->WriteUnlessAlreadyCompiled(\&PrepareStandardNotes, undef, 1); # sub, filename, cache
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    74
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    75
  else{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    76
    $self->WriteUnlessAlreadyCompiled(\&PrepareStandardNotes, undef, 0); # sub, filename, cache
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    77
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    78
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    79
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    80
sub DoCompSummary {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    81
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    82
  if( !defined ($self->{htmlMainFile} )) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    83
    $self->{htmlName} = $self->{notes_store} . "\\$self->{comp}.summary.html";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    84
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    85
  else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    86
    $self->{htmlName} = $self->{htmlMainFile};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    87
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    88
  my $relDataObjects = RelData->OpenSet($self->{iniData}, $self->{comp}, $self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    89
  @$relDataObjects = grep { $self->PassesFilter($_) } @$relDataObjects;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    90
  foreach my $thisRelData (@$relDataObjects) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    91
    my $ver = $thisRelData->Version();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    92
    my $htmlName;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    93
    my $filename = $self->{comp}.".".$ver;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    94
    if ($self->{htmlNotes}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    95
      $filename.=".htmlnotes";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    96
    } else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    97
      $filename.=".textnotes";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    98
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    99
    if( !defined ($self->{htmlMainFile}) ) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   100
      $htmlName = $self->{notes_store} . "\\$filename.html";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   101
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   102
    else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   103
      $htmlName = $self->{htmlMainFile} . NOTES_DIREXTENSION . "\\$filename.html";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   104
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   105
    $self->WriteUnlessAlreadyCompiled(\&PrepareStandardNotes, $htmlName, 1, $thisRelData); # sub, filename, cache, @args
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   106
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   107
  $self->WriteUnlessAlreadyCompiled(\&PrepareSummary, undef, 0, $relDataObjects, 1); # sub, filename, cache, @args
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   108
  return $self;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   109
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   110
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   111
sub DoEnvSummary {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   112
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   113
  if( !defined ($self->{htmlMainFile} )) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   114
    if ($self->{comp} and $self->{ver}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   115
      $self->{htmlName} = $self->{notes_store} . "\\$self->{comp}.$self->{ver}.summary.html";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   116
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   117
    else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   118
      $self->{htmlName} = $self->{notes_store} . "\\current_env_summary.html";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   119
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   120
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   121
  else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   122
    $self->{htmlName} = $self->{htmlMainFile};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   123
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   124
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   125
  my $versionInfo;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   126
  if ($self->{comp} and $self->{ver}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   127
    my $relData = RelData->Open($self->{iniData}, $self->{comp}, $self->{ver}, $self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   128
    $versionInfo = $relData->Environment();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   129
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   130
  else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   131
    $versionInfo = $self->{envDb}->VersionInfo();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   132
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   133
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   134
  my @relData;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   135
  foreach my $thisComp (sort keys %$versionInfo) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   136
    my $thisVer = $versionInfo->{$thisComp};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   137
    (my $relData, my $preview) = $self->CreateRelData($thisComp, $thisVer);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   138
    next unless $self->PassesFilter($relData);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   139
    push (@relData, $relData);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   140
    my $htmlName;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   141
    my $filename = $thisComp.".".$thisVer;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   142
    if ($self->{htmlNotes}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   143
      $filename.=".htmlnotes";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   144
    } else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   145
      $filename.=".textnotes";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   146
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   147
    if( !defined ($self->{htmlMainFile} )) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   148
      $htmlName = $self->{notes_store} . "\\$filename.html";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   149
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   150
    else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   151
      $htmlName = $self->{htmlMainFile} . NOTES_DIREXTENSION . "\\$filename.html";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   152
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   153
    $self->WriteUnlessAlreadyCompiled(\&PrepareStandardNotes, $htmlName, 1, $relData, $preview); # sub, filename, cache, @args
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   154
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   155
  $self->WriteUnlessAlreadyCompiled(\&PrepareSummary, undef, 0, \@relData); # sub, filename, cache, @args
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   156
  return $self;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   157
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   158
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   159
sub DoDiffEnvSummary {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   160
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   161
  my $comp2 = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   162
  my $ver2 = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   163
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   164
  require EnvDifferencer;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   165
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   166
  my $comp1 = $self->{comp};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   167
  my $ver1 = $self->{ver};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   168
  $comp2 ||= $comp1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   169
  $ver2 ||=  $self->{envDb}->VersionInfo()->{$comp2};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   170
  unless ($ver2) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   171
    die "Error: $comp2 not installed in current environment\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   172
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   173
  if( !defined ($self->{htmlMainFile} )) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   174
    my $filename = $comp1.".".$ver1.".".$comp2.".".$ver2."-full";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   175
    if ($self->{htmlNotes}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   176
      $filename.=".htmlnotes";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   177
    } else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   178
      $filename.=".textnotes";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   179
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   180
    $self->{htmlName} = $self->{notes_store} . "\\$filename.html";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   181
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   182
  else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   183
    $self->{htmlName} = $self->{htmlMainFile};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   184
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   185
  if(!defined ($self->{outputSTDOUTonly})){
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   186
    $self->WriteUnlessAlreadyCompiled(\&PrepareDiffEnvReport, undef, 1, $comp2, $ver2); # sub, filename, cache, @args
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   187
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   188
  else{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   189
    $self->WriteUnlessAlreadyCompiled(\&PrepareDiffEnvReport, undef, 0, $comp2, $ver2); # sub, filename, cache, @args
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   190
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   191
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   192
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   193
sub HtmlFileName {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   194
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   195
  return $self->{htmlName};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   196
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   197
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   198
sub HtmlMainFile {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   199
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   200
  return $self->{htmlMainFile};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   201
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   202
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   203
sub SetProjectFilter {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   204
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   205
  $self->{filter}->{project} = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   206
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   207
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   208
sub SetVersionNumberFilter {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   209
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   210
  $self->{filter}->{versionregex} = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   211
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   212
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   213
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   214
# Private.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   215
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   216
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   217
sub WriteUnlessAlreadyCompiled {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   218
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   219
  my $sub = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   220
  my $filename = shift || $self->{htmlName};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   221
  my $cache = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   222
  my @args = @_;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   223
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   224
  if ($cache) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   225
    return if $self->NotesFileAlreadyCompiled($filename, $self->{comp}, $self->{ver});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   226
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   227
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   228
  my $output = $sub->($self, @args);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   229
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   230
  if (!defined ($self->{outputSTDOUTonly})) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   231
    my $fh = $self->OpenFileForWriting($filename);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   232
    print "FILE LOCATION: $filename\n" if ($self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   233
    print $fh $output;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   234
    $fh = undef; # close file
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   235
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   236
  else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   237
    print $output;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   238
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   239
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   240
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   241
sub OpenFileForWriting {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   242
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   243
  my $filename = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   244
  Utils::MakeDir(dirname($filename));
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   245
  return new IO::File($filename, "w") or die "Couldn't open file \"$filename\" for writing: $!";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   246
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   247
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   248
sub PrepareDiffEnvReport {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   249
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   250
  my $endcomp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   251
  my $endver = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   252
  my $startcomp = $self->{comp};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   253
  my $startver = $self->{ver};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   254
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   255
  $self->{envDb} = EnvDb->Open($self->{iniData}, $self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   256
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   257
  my $envDifferencer = EnvDifferencer->New($self->{iniData}, $self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   258
  $envDifferencer->SetStartCompVer($startcomp, $startver);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   259
  $envDifferencer->SetEndCompVer($endcomp, $endver);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   260
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   261
  my @contentsrows;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   262
  my $bodies;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   263
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   264
  my $changedcomps = $envDifferencer->ChangedComps();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   265
  my $i=0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   266
  foreach my $comp (sort @$changedcomps) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   267
    $i++; # counter for debug output only
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   268
    my $endReldata = $envDifferencer->EndReldata($comp);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   269
    my $intermediateReldatas = $envDifferencer->IntermediateReldatas($comp);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   270
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   271
    my @allreldatas = (@$intermediateReldatas, $endReldata);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   272
    @allreldatas = grep { $self->PassesFilter($_) } @allreldatas;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   273
    print "Processing $comp ($i/".(scalar @$changedcomps)."): ".(scalar @allreldatas)." releases to process\n" if $self->{verbose};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   274
    next unless @allreldatas;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   275
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   276
    my @versions;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   277
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   278
    $bodies .= hr . h2(a({name=>$comp},$comp));
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   279
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   280
    my $firstver;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   281
    foreach my $reldata (sort { $b->ReleaseTime() <=> $a->ReleaseTime() } @allreldatas) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   282
      my $ver = $reldata->Version();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   283
      my $link = "$comp$ver";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   284
      if(defined $self->{htmlMainFile})
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   285
        {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   286
        $link = $self->{htmlMainFile} . NOTES_DIREXTENSION . "/" . $link;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   287
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   288
      # First add an entry to our contents table
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   289
      push @versions, td(a{href=>"#$link"}, $ver);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   290
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   291
      # Now prepare the body itself
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   292
      $bodies .= a({name=>$link}, h3($ver));
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   293
      $bodies .= ul($self->MainBody($reldata, 1)); # 1 = concise
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   294
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   295
    push @contentsrows, Tr(th(a({href=>"#$comp"},$comp)), @versions);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   296
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   297
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   298
  my $output = "";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   299
  $output .= h1("Differences between $startcomp $startver and $endcomp $endver");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   300
  $output .= h1("Contents");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   301
  $output .= p("Newer releases are on the left.");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   302
  $output .= table({border=>1},@contentsrows);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   303
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   304
  if(defined $bodies){
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   305
    $output .= $bodies;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   306
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   307
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   308
  return $output;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   309
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   310
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   311
sub PrepareStandardNotes {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   312
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   313
  my $relData = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   314
  my $preview;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   315
  my $comp;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   316
  my $ver;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   317
  if ($relData) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   318
    $comp = $relData->Component();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   319
    $ver = $relData->Version();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   320
  } else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   321
    $comp = $self->{comp};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   322
    $ver = $self->{ver};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   323
    ($relData, $preview) = $self->CreateRelData($comp, $ver);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   324
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   325
  my $output = "";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   326
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   327
  if ($self->{verbose}) { print "Compiling release notes for $comp $ver...\n"; }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   328
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   329
  if ($preview) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   330
    $output .= start_html({-title => "$comp $ver release notes PREVIEW"})
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   331
      .h1({-style=>'Color: red;'}, 'Release Notes Preview'). hr
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   332
      .h1("$comp")
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   333
      .hr;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   334
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   335
  else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   336
    $output .= start_html({-title => "$comp $ver release notes"})
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   337
      .h1("$comp")
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   338
      .hr;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   339
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   340
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   341
  $output .= $self->MainBody($relData);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   342
  $output .= $self->EnvDetails($relData, $preview);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   343
  $output .= $self->SrcFilterErrors($relData, $preview);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   344
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   345
  $output .= end_html();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   346
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   347
  return $output;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   348
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   349
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   350
sub PrepareSummary {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   351
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   352
  my $relDataObjects = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   353
  my $compSummary = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   354
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   355
  my $output = "";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   356
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   357
  if ($compSummary) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   358
    if ($self->{verbose}) { print "Writing component summary for $self->{comp}...\n"; }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   359
    $output .= (start_html({-title => "Release note summary for component $self->{comp}"})
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   360
      .h1("Release note summary for component $self->{comp}")
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   361
      .hr);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   362
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   363
  else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   364
    if ($self->{comp} and $self->{ver}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   365
      if ($self->{verbose}) { print "Writing environment summary for $self->{comp} $self->{ver}...\n"; }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   366
      $output .= (start_html({-title => "Release note summary for environment $self->{comp} $self->{ver}"})
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   367
      .h1("Release note summary for environment $self->{comp} $self->{ver}")
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   368
      .hr);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   369
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   370
    else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   371
      if ($self->{verbose}) { print "Writing environment summary for current environment...\n"; }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   372
      $output .= (start_html({-title => "Release note summary for the current environment"})
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   373
        .h1("Release note summary for the current environment")
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   374
        .hr);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   375
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   376
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   377
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   378
  foreach my $thisRelData (@$relDataObjects) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   379
    my $thisVer = $thisRelData->Version();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   380
    my $thisComp = $thisRelData->Component();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   381
    my $thisIntVer = $thisRelData->InternalVersion();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   382
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   383
    my $link;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   384
    if ($compSummary) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   385
      my $filename = $self->{comp}.".".$thisVer;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   386
      if ($self->{htmlNotes}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   387
        $filename.=".htmlnotes";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   388
      } else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   389
        $filename.=".textnotes";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   390
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   391
      $link = "$filename.html";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   392
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   393
    else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   394
      my $filename = $thisComp.".".$thisVer;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   395
      if ($self->{htmlNotes}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   396
        $filename.=".htmlnotes";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   397
      } else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   398
        $filename.=".textnotes";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   399
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   400
      $link = "$filename.html";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   401
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   402
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   403
    if(defined $self->{htmlMainFile})
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   404
      {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   405
      $link = $self->{htmlMainFile} . NOTES_DIREXTENSION . "/" . $link;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   406
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   407
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   408
    my $caption = $thisVer;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   409
    if ($thisIntVer) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   410
      $caption .= " [$thisIntVer]";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   411
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   412
    unless ($compSummary) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   413
      $caption = "$thisComp $caption";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   414
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   415
    my $notesSrc = $thisRelData->NotesSource();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   416
    $output .= a({ -href => $link }, $caption). ' - ';
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   417
    $output .= ("Made by $notesSrc->{releaser} on $notesSrc->{date}");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   418
    $output .= (p(""));
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   419
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   420
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   421
  $output .= (end_html());
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   422
  return $output;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   423
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   424
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   425
sub CreateRelData {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   426
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   427
  my $comp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   428
  my $ver = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   429
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   430
  my $installedVer = $self->{envDb}->Version($comp);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   431
  my $preview = 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   432
  my $relData;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   433
  if (defined $installedVer) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   434
    if ($ver eq $installedVer) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   435
      if ($self->{envDb}->Status($comp) == EnvDb::STATUS_PENDING_RELEASE) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   436
        # This release has not yet been made, so preview the notes.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   437
        $preview = 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   438
        my $intVer = $self->{envDb}->InternalVersion($comp);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   439
        unless (defined $intVer) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   440
          $intVer = ' ';
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   441
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   442
        my $mrpData = MrpData->New($self->{envDb}->MrpName($comp),
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   443
          $ver, $intVer, $self->{iniData}, $self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   444
          $relData = RelData->New($self->{iniData}, $mrpData,
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   445
          Utils::PrependSourceRoot($mrpData->NotesSource()), $self->{envDb}->VersionInfo(), 'viewnotes', $self->{verbose}, 1);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   446
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   447
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   448
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   449
  unless (defined $relData) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   450
    # This release has already been made, so we can read it's reldata.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   451
    $relData = RelData->Open($self->{iniData}, $comp, $ver, $self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   452
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   453
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   454
  return ($relData, $preview);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   455
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   456
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   457
sub MainBody {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   458
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   459
  my $relData = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   460
  my $concise = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   461
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   462
  my $output = "";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   463
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   464
  if ($self->{verbose} > 1) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   465
    print "Compiling release notes main body for ".$relData->Component()." ".$relData->Version()."...\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   466
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   467
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   468
  my $notesSrc = $relData->NotesSource();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   469
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   470
  my $release_version = $relData->MadeWithVersion();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   471
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   472
  foreach my $key (keys %{$notesSrc}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   473
    my $html_markers;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   474
    my $note = $notesSrc->{$key};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   475
    if (ref $note eq 'ARRAY') {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   476
      $html_markers = $self->CheckHtmlMarkers(join("",@$note));
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   477
    } else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   478
      $html_markers = $self->CheckHtmlMarkers($note);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   479
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   480
    if (!$html_markers) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   481
      if (Utils::CompareVers($release_version, "2.83.1013") > 0) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   482
        # 'Recent' release: escape html chars
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   483
        $notesSrc->{$key} = $self->EscapeHtmlChars($note);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   484
      } else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   485
        # Old release
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   486
        if (!($self->{htmlNotes})) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   487
          # User hasn't set html_notes: escape html chars
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   488
          $notesSrc->{$key} = $self->EscapeHtmlChars($note);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   489
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   490
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   491
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   492
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   493
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   494
  unless ($concise) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   495
    my $comp = $relData->Component();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   496
    my $ver = $relData->Version();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   497
    my $intVer = $relData->InternalVersion();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   498
    my $toolsver = $relData->MadeWith();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   499
    my $sourcecode = $relData->SourceIncluded();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   500
    my $mrpName = $relData->MrpName();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   501
    my $project = $self->ComponentProject($comp, $ver);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   502
    my $envUserName = $relData->EnvUserName() || "";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   503
    my $firstCompatibleVersion = $relData->FirstCompatibleVersion() || "&lt;unknown&gt;";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   504
    my $zipsize;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   505
    eval {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   506
      $zipsize = $self->{envDb}->GetReleaseSize($relData->Component(), $relData->Version());
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   507
    };
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   508
    $zipsize ||= "-"; # for example, if we're pending release...
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   509
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   510
    $output .= table({-border=>0}, Tr({-align =>'left'},
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   511
               [td([b('Version'), $ver]),
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   512
          td([b('Internal version'), ($intVer || "&lt;none&gt;")]),
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   513
          td([b('Made by'), $notesSrc->{releaser}]),
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   514
          td([b('Date'), $notesSrc->{date}]),
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   515
          td([b('Made with'), $toolsver]),
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   516
          td([b('Earliest compatible tools'), $firstCompatibleVersion]),
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   517
          td([b('Source included'), tt($sourcecode)]),
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   518
          td([b('Size of release zips'), tt($zipsize)]),
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   519
          td([b('Project storage archive'), $project]),
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   520
          td([b('MRP file used'), tt($mrpName)]),
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   521
          td([b('Environment username'), $envUserName])
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   522
               ]));
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   523
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   524
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   525
  $output .= hr;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   526
  $output .= h2("Release Summary");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   527
  $output .= h3("Reason for release");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   528
  foreach my $line (@{$notesSrc->{releaseReason}}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   529
    $output .= tt($line). br;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   530
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   531
  $output .= h3("General release comments");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   532
  foreach my $line (@{$notesSrc->{generalComments}}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   533
      $output .= tt($line). br;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   534
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   535
  $output .= h3("Known omissions, deviations and discrepancies");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   536
  foreach my $line (@{$notesSrc->{knownDeviations}}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   537
      $output .= tt($line). br;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   538
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   539
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   540
  @{$notesSrc->{bugsFixed}} = map tt($_), @{$notesSrc->{bugsFixed}};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   541
  @{$notesSrc->{bugsRemaining}} = map tt($_), @{$notesSrc->{bugsRemaining}}; 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   542
  @{$notesSrc->{otherChanges}} = map tt($_), @{$notesSrc->{otherChanges}};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   543
   
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   544
  $output .= hr;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   545
  $output .= h2("Bugs fixed");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   546
  $output .= ul(li($notesSrc->{bugsFixed}));
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   547
  $output .= hr;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   548
  $output .= h2("Known bugs remaining");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   549
  $output .= ul(li($notesSrc->{bugsRemaining}));
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   550
  $output .= hr;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   551
  $output .= h2("Other changes");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   552
  $output .= ul(li($notesSrc->{otherChanges}));
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   553
  $output .= hr;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   554
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   555
  return $output;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   556
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   557
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   558
sub EscapeHtmlChars {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   559
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   560
  my $note = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   561
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   562
  my $newnote;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   563
  if (ref $note eq 'ARRAY') {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   564
    $newnote = [];
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   565
    foreach my $line (@$note) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   566
      my $newline = $line;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   567
      $newline =~ s/&/&amp;/g;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   568
      $newline =~ s/</&lt;/g;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   569
      $newline =~ s/>/&gt;/g;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   570
      push @$newnote, $newline;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   571
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   572
  } else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   573
    $newnote = $note;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   574
    $newnote =~ s/&/&amp;/g;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   575
    $newnote =~ s/</&lt;/g;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   576
    $newnote =~ s/>/&gt;/g;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   577
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   578
  return $newnote;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   579
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   580
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   581
sub CheckHtmlMarkers {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   582
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   583
  my $note = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   584
  if ($note =~ /^\s*<\s*html\s*>.*<\s*[\/\\]\s*html\s*>\s*$/i) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   585
    # Note begins with <html> and ends with </html> or something along those lines
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   586
    return 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   587
  } else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   588
    return 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   589
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   590
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   591
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   592
sub EnvDetails {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   593
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   594
  my $relData = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   595
  my $preview = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   596
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   597
  my $contents = "";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   598
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   599
  if ($preview) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   600
    $contents .= h2("Release environment");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   601
    $contents .= span({-style=>'Color: red;'}, '[not yet known]');
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   602
    $contents .= br();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   603
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   604
  else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   605
    my $env = $relData->Environment();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   606
    if (defined $env) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   607
      $contents .= h2("Release environment");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   608
      my $tableData;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   609
      $contents .= p("Number of components: ".(scalar keys %$env));
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   610
      foreach my $comp (sort keys %{$env}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   611
  push (@$tableData, td([b($comp), $env->{$comp}]));
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   612
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   613
      $contents .= table({-border=>0}, Tr({-align =>'left'}, $tableData));
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   614
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   615
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   616
  return $contents;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   617
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   618
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   619
sub SrcFilterErrors {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   620
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   621
  my $relData = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   622
  my $preview = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   623
  my $notesSrc = $relData->NotesSource();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   624
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   625
  my $contents = "";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   626
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   627
  if (defined $notesSrc->{srcFilterErrors} and scalar(@{$notesSrc->{srcFilterErrors}}) > 0) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   628
    $contents .= hr, h2("Source filter errors");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   629
    foreach my $errorLine (@{$notesSrc->{srcFilterErrors}}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   630
      $contents .= $errorLine, br();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   631
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   632
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   633
  return $contents;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   634
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   635
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   636
sub NotesFileAlreadyCompiled {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   637
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   638
  my $fileName = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   639
  my $comp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   640
  my $ver = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   641
  my $alreadyCompiled = 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   642
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   643
  if(!(defined $self->{htmlMainFile})) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   644
    if (-e $fileName && $comp && $ver) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   645
      my $reldata = $self->{iniData}->PathData->LocalArchivePathForExistingOrNewComponent($comp, $ver) . '\\reldata';
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   646
      if (-e $reldata and Utils::FileModifiedTime($reldata) < Utils::FileModifiedTime($fileName)) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   647
        $alreadyCompiled = 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   648
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   649
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   650
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   651
  return $alreadyCompiled;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   652
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   653
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   654
sub PassesFilter {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   655
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   656
  my $rd = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   657
  my $comp = $rd->Component();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   658
  my $ver = $rd->Version();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   659
  if ($self->{filter}->{project}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   660
    return 0 unless $self->ComponentProject($comp, $ver) eq $self->{filter}->{project};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   661
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   662
  if ($self->{filter}->{versionregex}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   663
    my $re = $self->{filter}->{versionregex};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   664
    return 0 unless $ver =~ m/$re/i;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   665
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   666
  return 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   667
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   668
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   669
sub ComponentProject {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   670
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   671
  my $comp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   672
  my $ver = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   673
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   674
  return $self->{iniData}->PathData->ComponentProject($comp, $ver);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   675
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   676
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   677
1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   678
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   679
__END__
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   680
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   681
=head1 NAME
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   682
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   683
NotesCompiler.pm - Compiles a set of release notes into HTML.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   684
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   685
=head1 INTERFACE
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   686
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   687
=head2 New
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   688
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   689
Expects to be passed an C<IniData> reference, a component name, a version, a verbosity level, an output HTML file name and an output STDOUT only flag. Creates a C<RelData> object for the component release and uses the information contained within it to compile the output HTML file.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   690
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   691
=head1 KNOWN BUGS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   692
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   693
None.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   694
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   695
=head1 COPYRIGHT
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   696
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   697
 Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   698
 All rights reserved.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   699
 This component and the accompanying materials are made available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   700
 under the terms of the License "Eclipse Public License v1.0"
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   701
 which accompanies this distribution, and is available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   702
 at the URL "http://www.eclipse.org/legal/epl-v10.html".
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   703
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   704
 Initial Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   705
 Nokia Corporation - initial contribution.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   706
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   707
 Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   708
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   709
 Description:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   710
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   711
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   712
=cut