releasing/cbrtools/perl/PathData/ComponentBased.pm
author Ross Qin <ross.qin@nokia.com>
Tue, 30 Nov 2010 14:05:41 +0800
changeset 713 7b7f0409fc00
parent 602 3145852acc89
permissions -rw-r--r--
merge
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
# Description:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    17
# PathData/ComponentBased.pm
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    18
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    19
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    20
package PathData::ComponentBased;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    21
use strict;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    22
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    23
BEGIN {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    24
  @PathData::ComponentBased::ISA=('PathData');
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    25
};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    26
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    27
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    28
# Public
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
sub ProcessLine {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    33
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    34
  my $keywordref = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    35
  my $lineref = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    36
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    37
  die "Unknown keyword $$keywordref for component-based path data" unless ($$keywordref =~ m/archive_path_file/i);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    38
  print "Warning: Deprecated keyword 'archive_path_file' found.  Support for component-based archives is planned for removal - please see documention for the 'archive_path' keyword for how to use project-based archives.\n"; 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    39
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    40
  die "Can't have multiple archive_path_file keywords in reltools.ini." if ($self->{archive_path_file});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    41
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    42
  $self->{archive_path_file} = $$lineref; # store the filename, just in case anybody wants to debug us - it might be useful.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    43
  $self->ParsePathData();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    44
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    45
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    46
sub LocalArchivePathForNewComponent {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    47
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    48
  my $comp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    49
  my $ver = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    50
  my $project = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    51
  die "Project $project does not make any sense when we are using an archive_path_data.txt file";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    52
  return $self->LocalArchivePath($comp, $ver);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    53
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    54
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    55
sub LocalArchivePathForExistingComponent {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    56
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    57
  my $comp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    58
  my $ver = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    59
  return $self->LocalArchivePath($comp, $ver);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    60
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    61
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    62
sub LocalArchivePathForImportingComponent {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    63
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    64
  my $comp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    65
  my $ver = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    66
  my $remotepath = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    67
  return $self->LocalArchivePath($comp, $ver);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    68
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    69
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    70
sub RemoteArchivePathForExistingComponent {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    71
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    72
  my $comp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    73
  my $ver = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    74
  return $self->RemoteArchivePath($comp, $ver);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    75
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    76
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    77
sub RemoteArchivePathForExportingComponent {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    78
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    79
  my $comp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    80
  my $ver = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    81
  my $localpath = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    82
  return $self->RemoteArchivePath($comp, $ver);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    83
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    84
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    85
sub ListComponents {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    86
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    87
  my $remote = shift || 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    88
  my @comps;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    89
  if ($remote) { # list those in the remote archive
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    90
    die "Must pass a remote site object to ListComponents if you want a list of the components on the remote site" unless ref $remote;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    91
    foreach my $location (values %{$self->{remote_archive_path}}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    92
      my $list = $remote->DirList($location);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    93
      $location =~ s/\\/\//g;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    94
      foreach (@$list) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    95
        s/^$location\/?//i;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    96
        push @comps, $_;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    97
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    98
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    99
  } else { # list those in the local archive
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   100
    foreach my $location (values %{$self->{local_archive_path}}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   101
      push @comps, @{Utils::ReadDir($location)} if (-d $location);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   102
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   103
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   104
  return \@comps;
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 ListProjects {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   108
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   109
  die "Cannot give a list of projects because we are using the component-based style of archive path data.";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   110
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   111
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   112
sub ListVersions {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   113
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   114
  my $comp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   115
  my $remote = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   116
  my $filter = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   117
  my $found;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   118
  if ($remote) { # list those in the remote archive
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   119
    die "Must pass a remote site object to ListVersions if you want a list of the versions on the remote site" unless ref $remote;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   120
    my $compDir = $self->GetArchivePath($comp, "remote_archive_path")."/$comp";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   121
    my $files = $remote->DirList($compDir);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   122
    my @results = map { m/\Q$comp\E([^\\\/]*)\.zip/i; $1 } @$files;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   123
    $found = \@results;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   124
  } else { # list those in the local archive
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   125
    my $compDir = $self->GetArchivePath($comp, "local_archive_path")."\\$comp";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   126
    return [] unless (-d $compDir);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   127
    $found = Utils::ReadDir($compDir);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   128
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   129
  @$found = grep { m/$filter/i } @$found if ($filter);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   130
  return @$found if wantarray;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   131
  return $found;
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
sub ComponentProjects {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   135
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   136
  my $comp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   137
  my $ver = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   138
  return ("<n/a>");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   139
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   140
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   141
sub ComponentProject {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   142
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   143
  my $comp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   144
  my $ver = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   145
  return ("<n/a>");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   146
}
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
# Private
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   150
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   151
#
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 GetArchivePath {
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 $component = lc(shift);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   157
  my $type = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   158
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   159
  die "Couldn't get archive path for undefined component" unless defined $component;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   160
  die unless defined $type;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   161
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   162
  if ($self->{$type}->{$component}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   163
    return $self->{$type}->{$component};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   164
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   165
  elsif ($self->{$type}->{default}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   166
    return $self->{$type}->{default};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   167
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   168
  else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   169
    die "Error: archive path not specified for $component\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   170
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   171
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   172
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   173
sub LocalArchivePath {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   174
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   175
  my $component = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   176
  my $ver = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   177
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   178
  return $self->GetArchivePath($component, "local_archive_path")."\\$component\\$ver";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   179
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   180
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   181
sub RemoteArchivePath {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   182
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   183
  my $component = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   184
  my $ver = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   185
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   186
  return $self->GetArchivePath($component, "remote_archive_path")."/$component";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   187
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   188
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   189
sub ParsePathData {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   190
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   191
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   192
  my $path_file = $self->{archive_path_file};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   193
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   194
  unless (-f $path_file) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   195
    die "Error: $path_file not found\n";
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
  open PATH, "$path_file" or die "Unable to open $path_file for reading\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   199
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   200
  while (my $line = <PATH>) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   201
    # Remove line feed, white space and comments.	   
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   202
    chomp $line;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   203
    $line =~ s/^\s*$//;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   204
    $line =~ s/#.*//;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   205
    if ($line eq '') {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   206
      # Nothing left.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   207
      next;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   208
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   209
    my ($component, $local, $remote) = split (/\s+/, $line, 4);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   210
    $component = lc($component);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   211
    unless ($local and $remote) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   212
      die "Error: Path not defined for \"$component\" in \"$path_file\"\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   213
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   214
    if (exists $self->{local_archive_path}->{$component}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   215
      die "Error: \"$component\" specified more than once in \"$path_file\"\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   216
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   217
    $self->{local_archive_path}->{$component} = $local;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   218
    $self->{remote_archive_path}->{$component} = $remote;   
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   219
  }  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   220
  close PATH;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   221
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   222
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   223
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   224
1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   225
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   226
__END__
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   227
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   228
=head1 NAME
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   229
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   230
PathData/ComponentBased.pm - Provides the location of archived releases with an old-style archive arrangement.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   231
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   232
=head1 DESCRIPTION
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   233
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   234
Parses a file containing paths to component release packets on both the local and remote archives.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   235
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   236
=head1 INTERFACE
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   237
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   238
=head2 ProcessLine
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   239
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   240
This interprets an C<archive_path_file> line from your F<reltools.ini>, and goes away to parse the F<archive_path.txt> file (which it does using the internal method C<ParsePathData>).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   241
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   242
The parser expects each line in the file to have the following form: 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   243
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   244
 <component_name>  <local_archive_path>  <remote_archive_path>
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   245
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   246
So an example file might have the following structure:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   247
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   248
 #
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   249
 # App Engines
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   250
 #
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   251
 agnmodel     X:\ProjectX\appeng      \ProjectX\appeng
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   252
 cntmodel     X:\ProjectX\appeng      \ProjectX\appeng
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   253
 damodel      X:\ProjectX\appeng      \ProjectX\appeng
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   254
 ...
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   255
 ...
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   256
 #
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   257
 # App Framework
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   258
 #
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   259
 apparc       X:\ProjectX\appframework      \ProjectX\appframework
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   260
 eikstd       X:\ProjectX\appframework      \ProjectX\appframework
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   261
 etext        X:\ProjectX\appframework      \ProjectX\appframework
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   262
 ...
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   263
 ...
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   264
 #
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   265
 # Default path
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   266
 #
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   267
 default      X:\ProjectX\misc       \ProjectX\misc
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   268
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   269
The C<default> line is optional (and there should be only one in the file). The C<default> value is the path given to all component releases which are not explicity listed in the file.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   270
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   271
[Note: text following a # is treated as a comment]   
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   272
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   273
=head2 Methods that return paths
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   274
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   275
All of these methods are expected to return the full location where the files should be stored; i.e. local archive paths should end in "\component\version" and remote archive paths should end in "/component".
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   276
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   277
=head2 LocalArchivePathForNewComponent
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   278
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   279
This takes a component and a version and (optionally) the name of the project to store the component in.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   280
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   281
=head2 LocalArchivePathForExistingComponent
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   282
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   283
This takes a component and a version.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   284
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   285
=head2 LocalArchivePathForImportingComponent
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   286
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   287
This takes a component, a version, and the remote path where the component was found.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   288
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   289
=head2 RemoteArchivePathForExistingComponent
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   290
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   291
This takes a component and a version.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   292
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   293
=head2 RemoteArchivePathForExportingComponent
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   294
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   295
This takes a component, a version, and the local path where the component was found.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   296
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   297
=head2 ListComponents
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   298
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   299
This may take "1" to indicate that it should list the components stored remotely, not locally. 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   300
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   301
=head2 ListVersions
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   302
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   303
This takes a component. It may optionally take a "1" to indicate that it should list the versions stored remotely, not locally.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   304
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   305
=head2 ListProjects
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   306
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   307
=head2 ComponentProjects
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   308
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   309
=head2 ComponentProject
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   310
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   311
These methods all throw an error, since projects aren't a relevant concept in this type of archive structure.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   312
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   313
=head1 IMPLEMENTATION
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   314
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   315
=head2 LocalArchivePath
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   316
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   317
Takes a component name. Returns the path of the component release packet on the local archive. Dies if not found.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   318
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   319
=head2 RemoteArchivePath
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   320
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   321
Takes a component name. Returns the path of the component release packet on the remote archive (either an FTP site or a network drive). Dies if not found.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   322
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   323
=head1 KNOWN BUGS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   324
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   325
None.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   326
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   327
=head1 COPYRIGHT
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   328
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   329
 Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   330
 All rights reserved.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   331
 This component and the accompanying materials are made available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   332
 under the terms of the License "Eclipse Public License v1.0"
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   333
 which accompanies this distribution, and is available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   334
 at the URL "http://www.eclipse.org/legal/epl-v10.html".
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   335
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   336
 Initial Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   337
 Nokia Corporation - initial contribution.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   338
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   339
 Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   340
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   341
 Description:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   342
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   343
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   344
=cut