releasing/cbrtools/perl/RelData.pm
author marvin shi <marvin.shi@nokia.com>
Wed, 17 Nov 2010 14:05:07 +0800
changeset 691 9eeecb73a5d4
parent 602 3145852acc89
permissions -rw-r--r--
fix ou1cimx1#651819
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 RelData;
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 Data::Dumper;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    21
use MrpData;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    22
use PathData;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    23
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    24
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    25
# Data version history.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    26
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    27
# 1 - Original release.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    28
# 2 - Added 'relToolsVer' tag.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    29
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    30
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
# Public.
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
sub New {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    37
  my $pkg = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    38
  my $self = {};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    39
  bless $self, $pkg;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    40
  $self->{iniData} = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    41
  $self->{mrpData} = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    42
  $self->{notesSrc} = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    43
  $self->{data}->{env} = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    44
  $self->{data}->{toolName} = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    45
  $self->{verbose} = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    46
  $self->{dontPersist} = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    47
  $self->{project} = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    48
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    49
  $self->{comp} = $self->{mrpData}->Component();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    50
  $self->{ver} = $self->{mrpData}->ExternalVersion();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    51
  $self->{data}->{dataFormatVer} = 2;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    52
  $self->{data}->{intVer} = $self->{mrpData}->InternalVersion();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    53
  $self->{data}->{mrpName} = $self->{mrpData}->MrpName();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    54
  $self->{data}->{relToolsVer} = Utils::ToolsVersion();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    55
  $self->{data}->{notesSrc}->{srcFilterErrors} = $self->{mrpData}->SourceFilterErrors();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    56
  $self->{data}->{notesSrc}->{date} = localtime;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    57
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    58
  foreach my $srcitem (keys %{$self->{mrpData}->SourceItems()}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    59
    if($self->{iniData}->HasMappings()){
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    60
      $srcitem = $self->{iniData}->PerformReverseMapOnFileName($srcitem);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    61
      $srcitem = Utils::RemoveSourceRoot($srcitem);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    62
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    63
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    64
    $self->{data}->{srcitems}->{$srcitem} = 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    65
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    66
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    67
  unless(defined $self->{data}->{srcitems}){
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    68
    $self->{data}->{srcitems} = $self->{mrpData}->SourceItems();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    69
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    70
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    71
  $self->{data}->{envUserName} = ($ENV{FirstName} || '') . " " . ($ENV{LastName} || '');
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    72
  $self->ParseNotesSource();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    73
  $self->WorkOutFirstCompatibleVersion();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    74
  unless (defined $self->{dontPersist}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    75
    $self->WriteToFile();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    76
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    77
  return $self;
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 Open {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    81
  my $pkg = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    82
  my $self = {};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    83
  bless $self, $pkg;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    84
  $self->{iniData} = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    85
  $self->{comp} = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    86
  $self->{ver} = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    87
  $self->{verbose} = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    88
  $self->ReadFromFile();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    89
  return $self;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    90
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    91
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    92
sub OpenExternal {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    93
  my $pkg = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    94
  my $externalArchive = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    95
  my $comp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    96
  my $ver = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    97
  my $self = {};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    98
  $self->{comp} = $comp;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    99
  $self->{ver} = $ver;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   100
  my $externalFile = File::Spec->catdir($externalArchive, $comp, $ver);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   101
  bless $self, $pkg;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   102
  $self->ReadFromSpecificFile($externalFile);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   103
  return $self;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   104
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   105
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   106
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   107
sub OpenSet {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   108
  my $pkg = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   109
  my $iniData = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   110
  my $comp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   111
  my $verbose = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   112
  my $versionfilter = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   113
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   114
  my @relDataObjects;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   115
  foreach my $ver (@{$iniData->PathData->ListVersions($comp, 0, $versionfilter, $iniData->LatestVerFilter)}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   116
    my $thisRelData = {};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   117
    bless $thisRelData, $pkg;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   118
    eval {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   119
      # ReadFromFile may die, if the file is corrupt.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   120
      # In which case we do not add it to the set.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   121
      $thisRelData->{iniData} = $iniData;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   122
      $thisRelData->{comp} = $comp;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   123
      $thisRelData->{ver} = $ver;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   124
      $thisRelData->{verbose} = $verbose;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   125
      $thisRelData->ReadFromFile();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   126
      push (@relDataObjects, $thisRelData);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   127
    };
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   128
    print "Warning: could not examine \"$comp\" \"$ver\" because $@" if ($@);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   129
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   130
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   131
  @relDataObjects = sort { $b->ReleaseTime() <=> $a->ReleaseTime() } @relDataObjects;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   132
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   133
  return \@relDataObjects;;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   134
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   135
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   136
sub Component {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   137
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   138
  die unless exists $self->{comp};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   139
  return $self->{comp};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   140
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   141
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   142
sub MadeWith {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   143
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   144
  my $ver = $self->{data}->{relToolsVer} || "(unknown version)";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   145
  my $tool = $self->{data}->{toolName} || "(unknown tool)";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   146
  return "$tool $ver";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   147
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   148
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   149
sub MadeWithVersion {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   150
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   151
  return "".$self->{data}->{relToolsVer};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   152
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   153
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   154
sub SourceIncluded {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   155
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   156
  my $items;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   157
  eval {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   158
    $items = $self->SourceItems();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   159
  };
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   160
  return "(unknown)" if $@;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   161
  return join (", ", keys %$items);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   162
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   163
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   164
sub Version {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   165
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   166
  die unless exists $self->{ver};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   167
  return $self->{ver};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   168
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   169
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   170
sub InternalVersion {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   171
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   172
  die unless exists $self->{data};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   173
  return $self->{data}->{intVer};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   174
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   175
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   176
sub MrpName {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   177
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   178
  die unless exists $self->{data};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   179
  return $self->{data}->{mrpName};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   180
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   181
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   182
sub FirstCompatibleVersion {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   183
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   184
  die unless exists $self->{data};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   185
  return $self->{data}->{firstCompatibleVersion};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   186
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   187
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   188
sub Environment {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   189
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   190
  die unless exists $self->{data};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   191
  return $self->{data}->{env};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   192
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   193
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   194
sub NotesSource {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   195
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   196
  die unless exists $self->{data};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   197
  return $self->{data}->{notesSrc};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   198
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   199
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   200
sub UpdateProject {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   201
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   202
  $self->{project} = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   203
  $self->WriteToFile();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   204
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   205
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   206
sub UpdateNotes {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   207
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   208
  $self->{notesSrc} = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   209
  $self->DeleteNotesSource();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   210
  $self->ParseNotesSource();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   211
  $self->WriteToFile();
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
sub UpdateInternalVersion {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   215
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   216
  $self->{data}->{intVer} = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   217
  $self->WriteToFile();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   218
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   219
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   220
sub UpdateEnv {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   221
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   222
  $self->{data}->{env} = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   223
  $self->WriteToFile();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   224
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   225
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   226
sub ReleaseTime {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   227
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   228
  unless (exists $self->{releaseTime}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   229
    $self->{releaseTime} = Utils::TextTimeToEpochSeconds($self->{data}->{notesSrc}->{date});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   230
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   231
  return $self->{releaseTime};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   232
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   233
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   234
sub SourceItems {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   235
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   236
  unless (defined $self->{data}->{srcitems}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   237
    my $createdver = $self->{data}->{relToolsVer} || 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   238
    if (Utils::CompareVers($createdver,2.54)<0) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   239
      die "this release was created with Release Tools $createdver, and the necessary information is only present in releases created with 2.54 or later.\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   240
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   241
    die "Could not return the list of \"source\" statements used in the MRP file." 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   242
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   243
  return $self->{data}->{srcitems};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   244
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   245
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   246
sub EnvUserName {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   247
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   248
  return $self->{data}->{envUserName};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   249
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   250
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   251
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   252
# Private.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   253
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   254
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   255
sub WriteToFile {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   256
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   257
  my $relDir = $self->{iniData}->PathData->LocalArchivePathForExistingOrNewComponent($self->{comp}, $self->{ver}, $self->{project});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   258
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   259
  my $file = "$relDir\\reldata";  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   260
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   261
  if (-e $file) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   262
    Utils::SetFileWritable($file);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   263
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   264
  open (OUT, ">$file") or die "Error: Couldn't open \"$file\" for writing: $!\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   265
  print OUT Data::Dumper->Dump([$self->{data}], ['self->{data}']);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   266
  close (OUT);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   267
  Utils::SetFileReadOnly($file);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   268
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   269
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   270
sub ReadFromFile {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   271
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   272
  my $pathData = shift || $self->{iniData}->PathData;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   273
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   274
  my $comp = $self->{comp};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   275
  my $ver = $self->{ver};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   276
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   277
  my $relDir = $pathData->LocalArchivePathForExistingComponent($comp, $ver);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   278
  die "Error: \"$comp $ver\" does not exist\n" unless $relDir;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   279
  die "Error: \"$comp $ver\" was not a valid release (can't find \"$relDir\\reldata\")\n" unless -e "$relDir\\reldata";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   280
  $self->{project} = $pathData->ComponentProject($comp, $ver);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   281
  $self->ReadFromSpecificFile($relDir);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   282
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   283
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   284
sub ReadFromSpecificFile {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   285
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   286
  my $relDir = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   287
  unless (-e $relDir) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   288
    die "Error: $self->{comp} $self->{ver} does not exist\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   289
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   290
  my $file = "$relDir\\reldata";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   291
  open (IN, $file) or die "Error: Couldn't open \"$file\" for reading: $!\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   292
  local $/ = undef;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   293
  my $data = <IN>;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   294
  die "Error: Reldata in \"$relDir\" is blank" unless $data =~ (m/\S/);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   295
  eval ($data) or die "Error: Couldn't parse reldata in \"$relDir\"\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   296
  close (IN);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   297
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   298
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   299
sub ParseNotesSource {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   300
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   301
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   302
  if ($self->{verbose} > 1) { print "Parsing notes source...\n"; }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   303
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   304
  open(SRC,"$self->{notesSrc}") or die "Unable to open $self->{notesSrc} for reading: $!\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   305
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   306
  my $thisTag;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   307
  while (<SRC>) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   308
    if (m/^NOTESRC/i) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   309
      chomp;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   310
      $thisTag = $_;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   311
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   312
    elsif (m/^\s*$/) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   313
      next;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   314
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   315
    elsif (defined $thisTag) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   316
      $self->AddLine($thisTag, $_);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   317
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   318
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   319
  close SRC;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   320
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   321
  $self->ValidateSource();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   322
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   323
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   324
sub AddLine {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   325
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   326
  my $thisTag = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   327
  my $thisLine = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   328
  chomp $thisLine;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   329
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   330
  if ($thisTag =~ m/^NOTESRC_RELEASER$/i) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   331
    $self->{data}->{notesSrc}->{releaser} = $thisLine;		
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   332
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   333
  elsif ($thisTag =~ m/^NOTESRC_RELEASE_REASON$/i) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   334
    push @{$self->{data}->{notesSrc}->{releaseReason}}, $thisLine;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   335
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   336
  elsif ($thisTag =~ m/^NOTESRC_GENERAL_COMMENTS$/i) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   337
    push @{$self->{data}->{notesSrc}->{generalComments}}, $thisLine;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   338
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   339
  elsif ($thisTag =~ m/^NOTESRC_KNOWN_DEVIATIONS$/i) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   340
    push @{$self->{data}->{notesSrc}->{knownDeviations}}, $thisLine;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   341
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   342
  elsif ($thisTag =~ m/^NOTESRC_BUGS_FIXED$/i) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   343
    push @{$self->{data}->{notesSrc}->{bugsFixed}}, $thisLine;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   344
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   345
  elsif ($thisTag =~ m/^NOTESRC_BUGS_REMAINING$/i) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   346
    push @{$self->{data}->{notesSrc}->{bugsRemaining}}, $thisLine;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   347
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   348
  elsif ($thisTag =~ m/^NOTESRC_OTHER_CHANGES$/i) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   349
    push @{$self->{data}->{notesSrc}->{otherChanges}}, $thisLine;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   350
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   351
  else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   352
    die "Error: Unknown tag \"$thisTag\" in $self->{notesSrc}\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   353
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   354
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   355
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   356
sub ValidateSource {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   357
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   358
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   359
  if ($self->{verbose} > 1) { print "Validating notes source...\n"; }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   360
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   361
  unless (exists $self->{data}->{notesSrc}->{releaser}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   362
    die "Error <NOTESRC_RELEASER> not specified in $self->{notesSrc}\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   363
  } 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   364
  unless (exists $self->{data}->{notesSrc}->{releaseReason}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   365
    die "Error <NOTESRC_RELEASE_REASON> not specified in $self->{notesSrc}\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   366
  } 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   367
  unless (exists $self->{data}->{notesSrc}->{generalComments}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   368
    push @{$self->{data}->{notesSrc}->{generalComments}}, "<unspecified>";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   369
  } 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   370
  unless (exists $self->{data}->{notesSrc}->{knownDeviations}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   371
    push @{$self->{data}->{notesSrc}->{knownDeviations}}, "<unspecified>";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   372
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   373
  unless (exists $self->{data}->{notesSrc}->{bugsFixed}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   374
    push @{$self->{data}->{notesSrc}->{bugsFixed}}, "<unspecified>";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   375
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   376
  unless (exists $self->{data}->{notesSrc}->{bugsRemaining}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   377
    push @{$self->{data}->{notesSrc}->{bugsRemaining}}, "<unspecified>";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   378
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   379
  unless (exists $self->{data}->{notesSrc}->{otherChanges}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   380
    push @{$self->{data}->{notesSrc}->{otherChanges}}, "<unspecified>";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   381
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   382
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   383
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   384
sub DeleteNotesSource {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   385
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   386
  delete $self->{data}->{notesSrc}->{releaser};		
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   387
  delete $self->{data}->{notesSrc}->{releaseReason};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   388
  delete $self->{data}->{notesSrc}->{generalComments};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   389
  delete $self->{data}->{notesSrc}->{knownDeviations};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   390
  delete $self->{data}->{notesSrc}->{bugsFixed};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   391
  delete $self->{data}->{notesSrc}->{bugsRemaining};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   392
  delete $self->{data}->{notesSrc}->{otherChanges};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   393
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   394
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   395
sub WorkOutFirstCompatibleVersion {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   396
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   397
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   398
  my $version = "2.00";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   399
  $version = "2.50" if ($self->{iniData}->CategoriseBinaries());
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   400
  $version = "2.59" if ($self->{iniData}->CategoriseExports());
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   401
  $version = "2.80.1000" if grep /[^A-GX]/, @{$self->{mrpData}->SourceCategories()}; 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   402
  # Add to this when extra features are added which break
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   403
  # backward compatibility of release formats.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   404
  $self->{data}->{firstCompatibleVersion} = $version;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   405
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   406
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   407
sub WarnIfReleaseTooNew {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   408
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   409
  # Called from EnvDb::InstallComponent
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   410
  my $relversion = $self->FirstCompatibleVersion();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   411
  return unless defined $relversion;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   412
  my $toolsver = Utils::ToolsVersion;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   413
  if (Utils::CompareVers($relversion,$toolsver)>0) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   414
    my $thisComp = $self->{comp};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   415
    print "Warning: $thisComp requires Release Tools version $relversion or later. You have $toolsver.\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   416
    print "         It's recommended you stop and upgrade your tools before continuing, as\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   417
    print "         the release probably won't install correctly.\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   418
    print "         Continue? [y/n] ";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   419
    my $response = <STDIN>;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   420
    chomp $response;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   421
    if (lc $response eq 'y') {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   422
      return;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   423
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   424
    die "Aborting operation.\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   425
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   426
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   427
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   428
1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   429
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   430
=head1 NAME
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   431
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   432
RelData.pm - Provides an interface to data associated with a release.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   433
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   434
=head1 DESCRIPTION
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   435
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   436
Along with the source and binaries of a component release, the following information is also stored:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   437
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   438
=over 4
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   439
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   440
=item *
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   441
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   442
The name of the F<mrp> file used to create the release.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   443
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   444
=item *
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   445
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   446
The release's internal version.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   447
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   448
=item *
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   449
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   450
The name and version of every component in the environment used to create the release.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   451
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   452
=item *
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   453
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   454
The time and date the release was made.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   455
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   456
=item *
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   457
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   458
The release notes source, which can subsequently be used to compile the release notes.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   459
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   460
=back
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   461
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   462
All this information is stored in a single file named F<reldata> within the release directory using the module Data::Dumper.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   463
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   464
=head1 INTERFACE
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   465
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   466
=head2 New
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   467
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   468
Creates a new C<RelData> object and corresponding data file. Expects to be passed an C<IniData> reference, a component name, a version, an internal version,  an F<mrp> file name, release notes source file name, a reference to a list of components in the release environment and a verbosity level. This information is assembled into an in-memory data structure, and then written into F<reldata> in the component's release directory. You may optionally pass a "project" name to this function, to specify where the F<reldata> should be written.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   469
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   470
=head2 Open
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   471
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   472
Creates a C<RelData> object from an already existing data file. Expects to be passed an C<IniData> reference, a component name, a version, and a verbosity level.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   473
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   474
=head2 OpenExternal
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   475
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   476
As C<New> except expects to be explicitly passed an archive path file name, rather than an C<IniData> object. Effectively creates a C<RelData> object from an external archive.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   477
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   478
=head2 OpenSet
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   479
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   480
Expects to be passed an C<IniData> reference, a component name, and a verbosity level. Opens C<RelData> objects for all of the releases of the specified component made to date and returns a reference to an array of references to them in descending date order.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   481
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   482
Optionally takes a regular expression to limit the versions that are returned.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   483
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   484
=head2 Component
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   485
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   486
Returns the component name.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   487
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   488
=head2 Version
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   489
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   490
Returns the component's version.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   491
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   492
=head2 InternalVersion
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   493
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   494
Returns the component's internal version.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   495
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   496
=head2 MrpName
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   497
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   498
Returns the component's F<mrp> file name.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   499
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   500
=head2 Environment
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   501
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   502
Returns a reference to a hash containing component name / version pairs for the components that were in the release environment.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   503
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   504
=head2 NotesSource
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   505
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   506
Returns a reference to a hash containing all the data needed to compile a set of release notes.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   507
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   508
=head1 SourceItems
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   509
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   510
Returns a reference to a hash of all the "source" lines that were in the MRP file used to create this component. This function will die if no such information was found; this means it will die for releases created with Release Tools versions prior to 2.54.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   511
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   512
Note that a hash is used just to ensure uniqueness. Only the keys of the hash have value; the values of the hash currently have no meaning.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   513
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   514
=head2 SourceIncluded
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   515
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   516
Returns a string version of the output of SourceItems.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   517
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   518
=head2 UpdateProject
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   519
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   520
Expects to be passed a project. The project passed is then set as the project for the reldata.pm object, which is used when writing the reldata file.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   521
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   522
=head2 UpdateNotes
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   523
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   524
Expects to be passed the name of a notes source file. Parses this and replaces the persisted version of the release notes.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   525
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   526
=head2 UpdateInternalVersion
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   527
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   528
Expects to be passed an internal version. The internal version is then set as internal version for the reldata.pm object, which is used when writing the reldata file.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   529
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   530
=head2 UpdateEnv
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   531
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   532
Expects to be passed an environment. The environment is then set as environment for the reldata.pm object, which is used when writing the reldata file.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   533
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   534
=head2 ReleaseTime
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   535
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   536
Returns the time (in epoch seconds) at which the release was made.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   537
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   538
=head2 MadeWith
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   539
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   540
Returns a string describing which tool this was made with, including the version number.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   541
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   542
=head2 EnvUserName
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   543
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   544
Returns the full name of the user who made this release, according to environment variables FirstName and LastName.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   545
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   546
=head1 KNOWN BUGS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   547
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   548
None.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   549
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   550
=head1 COPYRIGHT
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   551
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   552
 Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   553
 All rights reserved.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   554
 This component and the accompanying materials are made available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   555
 under the terms of the License "Eclipse Public License v1.0"
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   556
 which accompanies this distribution, and is available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   557
 at the URL "http://www.eclipse.org/legal/epl-v10.html".
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   558
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   559
 Initial Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   560
 Nokia Corporation - initial contribution.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   561
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   562
 Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   563
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   564
 Description:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   565
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   566
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   567
=cut