releasing/cbrtools/perl/PathData/ProjectBased.pm
author Ross Qin <ross.qin@nokia.com>
Thu, 28 Oct 2010 11:18:50 +0800
changeset 667 a3b39a14147a
parent 602 3145852acc89
permissions -rw-r--r--
Remove the PrintingServices component from TB10.1 on wards(on behalf of dane.waby@nokia.com)
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/ProjectBased.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::ProjectBased;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    21
use Utils;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    22
use Carp;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    23
use File::Spec;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    24
use strict;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    25
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    26
BEGIN {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    27
  @PathData::ProjectBased::ISA=('PathData');
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    28
};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    29
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    30
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    31
# Public
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    32
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    33
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    34
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    35
sub ProcessLine {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    36
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    37
  my $keywordref = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    38
  my $lineref = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    39
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    40
  die "Unknown keyword $$keywordref for project-based path data" unless ($$keywordref =~ m/archive_path/i);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    41
  $$lineref =~ m/(\S+)\s+(\S+)(?:\s+(\S*))?/ or die "Error: Couldn't cope with archive path arguments \"$$lineref\": possibly the wrong number of arguments?\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    42
  my $entry = {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    43
    'name' => lc $1,
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    44
    'local' => $2,
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    45
    'remote' => $3
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    46
  };
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    47
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    48
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    49
  $self->{project_paths} ||= []; # I know this line is redundant, but I prefer explicitness :-)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    50
  die "You cannot have multiple archive_path lines with the same project name (".$entry->{name}.")" if (grep { $_->{name} eq $entry->{'name'} } @{$self->{project_paths}});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    51
  # You are allowed to have multiple lines with the same local and/or remote path lines,
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    52
  # but it ain't necessarily a good plan.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    53
  push @{$self->{project_paths}}, $entry;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    54
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    55
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    56
sub LocalArchivePath {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    57
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    58
  my $project = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    59
  my $result;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    60
  $self->BasicChecks();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    61
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    62
  if(defined $project){
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    63
    $self->CheckProject($project);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    64
    $result = $self->FindEntry("name", $project);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    65
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    66
  else{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    67
    $result = $self->FindEntryWithSub(sub { -d ($_->{'local'})});
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
  return undef unless $result;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    71
  print "Existing component stored at $result\n" if ($self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    72
  return $result->{'local'};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    73
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    74
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    75
sub LocalArchivePathForNewComponent {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    76
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    77
  my $comp = shift || confess "No component provided";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    78
  my $ver = shift || confess "No version provided";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    79
  my $project = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    80
  $self->BasicChecks();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    81
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    82
  my $result;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    83
  if (defined $project) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    84
    $self->CheckProject($project);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    85
    $result = $self->FindEntry("name", $project);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    86
  } else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    87
    $result = $self->{project_paths}->[0];
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    88
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    89
  die "Error: No archive paths found\n" unless $result; # should never happen due to BasicChecks
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    90
  $self->CreateLocalDirectory($result);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    91
  $result = $result->{'local'};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    92
  print "New component being stored at $result\n" if ($self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    93
  return $result . "\\$comp\\$ver";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    94
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    95
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    96
sub LocalArchivePathForExistingComponent {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    97
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    98
  my $comp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    99
  my $ver = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   100
  my $project = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   101
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   102
  my $result;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   103
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   104
  $self->BasicChecks();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   105
  confess "Component name undefined" unless defined $comp;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   106
  confess "Version number undefined" unless defined $ver;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   107
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   108
  if(defined $project){
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   109
    $self->CheckProject($project);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   110
    $result = $self->FindEntry("name", $project);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   111
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   112
  else{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   113
    $result = $self->FindEntryWithSub(sub { -d ($_->{'local'}.'\\'.$comp.'\\'.$ver)});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   114
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   115
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   116
  return undef unless $result;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   117
  print "Existing component stored at $result\n" if ($self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   118
  return $result->{'local'} . "\\$comp\\$ver";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   119
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   120
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   121
sub LocalArchivePathForImportingComponent {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   122
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   123
  my $comp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   124
  my $ver = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   125
  my $remotepath = shift; 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   126
  $self->BasicChecks();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   127
  confess "Component name undefined" unless defined $comp;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   128
  confess "Version number undefined" unless defined $ver;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   129
  $remotepath =~ s/(.*)\/.*/$1/;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   130
  my $result = $self->FindEntry("remote", $remotepath);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   131
  $self->CreateLocalDirectory($result);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   132
  die "Couldn't find the remote project directory $remotepath where component $comp is being imported from." unless defined $result;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   133
  return $result->{'local'} . "\\$comp\\$ver";
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 RemoteArchivePathForExistingComponent {
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
  my $comp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   139
  my $ver = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   140
  my $remotesite = shift; # we must get passed a remote site object
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   141
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   142
  $self->CheckRemoteSites();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   143
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   144
  $self->BasicChecks();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   145
  confess "Component name undefined" unless defined $comp;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   146
  confess "Version number undefined" unless defined $ver;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   147
  confess "No remote site object was provided" unless (ref $remotesite);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   148
  die "Component name undefined" unless defined $comp;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   149
  my %checked;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   150
  my $result = $self->FindEntryWithSub(sub {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   151
     return undef unless $_->{'remote'}; # skip those with no remote path
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   152
     return undef if $checked{$_->{'remote'}}; # already checked this remote path
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   153
     $checked{$_->{'remote'}} = 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   154
     $remotesite->FileExists($_->{'remote'}."/$comp/$comp$ver.zip"
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   155
   )});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   156
  return undef unless defined $result;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   157
  $result = $result->{remote};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   158
  return $result . "/$comp";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   159
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   160
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   161
sub RemoteArchivePathForExportingComponent {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   162
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   163
  my $comp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   164
  my $ver = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   165
  my $localpath = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   166
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   167
  $self->CheckRemoteSites();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   168
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   169
  $localpath =~ s/(.*)[\/\\].*?[\/\\].*?$/$1/; # remove last two path segments
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   170
  $self->BasicChecks();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   171
  confess "Component name undefined" unless defined $comp;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   172
  my $result = $self->FindEntry("local", $localpath);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   173
  die "Couldn't find the local project directory $localpath where component $comp is being exported from." unless (defined $result);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   174
  die "Error: The archive ".$result->{name}." does not have a remote path listed in reltools.ini" unless (defined $result->{remote});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   175
  return $result->{remote} . "/$comp";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   176
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   177
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   178
sub ListComponents {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   179
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   180
  my $remote = shift || 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   181
  my $continue = shift || 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   182
  # This returns a list of the components we have locally or remotely.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   183
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   184
  my $archiveExists;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   185
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   186
  $self->BasicChecks();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   187
  my @list;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   188
  if ($remote) { # list remote archive
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   189
    $self->CheckRemoteSites();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   190
    die "Need a remote site object" unless (ref $remote);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   191
    foreach (map { $_->{'remote'} } @{$self->{project_paths}}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   192
      next unless $remote->DirExists($_);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   193
      $archiveExists = 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   194
      my $rawlist = $remote->DirList($_);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   195
      if ($rawlist) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   196
        push @list, grep { !m/^\./ } map { s/.*[\\\/]//; $_ } @$rawlist;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   197
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   198
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   199
  } else { # list local archive
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   200
    foreach (map { $_->{'local'} } @{$self->{project_paths}}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   201
      if (!-d $_) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   202
        if ($continue) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   203
          next;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   204
        }		
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   205
        die "Project path $_ does not correspond to a real directory" ;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   206
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   207
      
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   208
      $archiveExists = 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   209
      
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   210
      opendir LISTHANDLE, $_;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   211
      push @list, grep { !/^\./ } readdir LISTHANDLE;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   212
      closedir LISTHANDLE;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   213
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   214
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   215
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   216
  if (!$archiveExists) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   217
    warn "Warning: The archive path locations specified in your reltools.ini do not exist\n";
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
  # Now unique-ify list as per Perl Cookbook recipe
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   221
  my %seen;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   222
  @list = grep { ! $seen{$_} ++ } @list;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   223
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   224
  return @list if wantarray;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   225
  return \@list;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   226
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   227
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   228
sub ListProjects {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   229
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   230
  $self->BasicChecks();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   231
  my @results = map { $_->{name} } @{$self->{project_paths}};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   232
  return @results if wantarray;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   233
  return \@results;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   234
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   235
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   236
sub ListVersions {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   237
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   238
  my $comp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   239
  my $remote = shift || 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   240
  my $filter = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   241
  my $latestverFilter = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   242
  $self->BasicChecks();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   243
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   244
  my $archiveExists;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   245
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   246
  confess "Component name undefined" unless defined $comp;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   247
  my @found;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   248
  if ($remote) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   249
    $self->CheckRemoteSites();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   250
    die "Need a remote site object" unless (ref $remote);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   251
    foreach (map { $_->{'remote'} } @{$self->{project_paths}}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   252
      my $dir = "$_/$comp";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   253
      next unless $remote->DirExists($dir);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   254
      $archiveExists = 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   255
      my $files = $remote->DirList($dir);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   256
      push @found, grep { $_ } map { m/.*(?:^|\\|\/)\Q$comp\E[\\\/]\Q$comp\E(.*?)\.zip$/i; $1 } @$files;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   257
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   258
  } else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   259
    foreach (map { $_->{'local'} } @{$self->{project_paths}}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   260
      if (-e $_) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   261
        $archiveExists = 1;
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
      my $dir = "$_\\$comp";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   265
      if (-d $dir) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   266
        foreach my $entry (@{Utils::ReadDir($dir)}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   267
          if (-d File::Spec->catdir($dir, $entry)) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   268
            push @found, $entry;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   269
          }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   270
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   271
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   272
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   273
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   274
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   275
  if (!$archiveExists) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   276
    warn "Warning: The archive path locations specified in your reltools.ini do not exist\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   277
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   278
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   279
  # Now unique-ify list as per Perl Cookbook recipe
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   280
  my %seen;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   281
  @found = grep { ! $seen{$_} ++ } @found;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   282
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   283
  # The filter regexes may have been compiled, here we uncompile them
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   284
  $latestverFilter =~ s/^\(\?[-imsx]*:(.*)\)$/$1/i if ($latestverFilter);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   285
  $filter =~ s/^\(\?[-imsx]*:(.*)\)$/$1/i if ($filter);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   286
           
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   287
  # Now apply a filter to the list
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   288
  @found = grep { ! m/$latestverFilter/i } @found if ($latestverFilter);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   289
  @found = grep { m/$filter/i } @found if ($filter);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   290
  return @found if wantarray;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   291
  return \@found;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   292
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   293
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   294
sub ComponentProjects {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   295
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   296
  my $comp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   297
  my $ver = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   298
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   299
  confess "Component name undefined" unless defined $comp;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   300
  confess "Version number undefined" unless defined $ver;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   301
  $self->BasicChecks();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   302
  my @results = $self->FindEntriesWithSub(sub {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   303
    -d ($_->{local}."\\$comp\\$ver")
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   304
  });
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   305
  return map {$_->{name}} @results; 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   306
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   307
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   308
sub ComponentProject {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   309
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   310
  my $comp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   311
  my $ver = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   312
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   313
  confess "Component name undefined" unless defined $comp;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   314
  confess "Version number undefined" unless defined $ver;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   315
  $self->BasicChecks();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   316
  my $archive = $self->FindEntryWithSub(sub {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   317
    -d ($_->{local}."\\$comp\\$ver")
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   318
  });
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   319
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   320
  if (defined $archive) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   321
    return $archive->{name};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   322
  } else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   323
    return "<none>";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   324
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   325
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   326
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   327
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   328
# Private
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   329
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   330
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   331
sub BasicChecks {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   332
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   333
  die "No project paths are defined" unless ($self->{project_paths});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   334
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   335
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   336
sub CheckProject {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   337
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   338
  my $project = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   339
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   340
  die "Project \"$project\" unknown" unless $self->FindEntry("name", $project);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   341
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   342
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   343
sub FindEntry {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   344
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   345
  my $type = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   346
  my $what = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   347
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   348
  return ($self->FindEntries($type, $what))[0];
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   349
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   350
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   351
sub FindEntries {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   352
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   353
  my $type = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   354
  my $what = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   355
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   356
  return $self->FindEntriesWithSub(sub { lc $_->{$type} eq lc $what });
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   357
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   358
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   359
sub CreateLocalDirectory {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   360
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   361
  my $entry = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   362
  if (-e $entry->{'local'}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   363
    die "Error: Local archive path ".$entry->{'local'}." is not a directory\n" unless (-d _);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   364
  } else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   365
    print "Warning: creating local archive path ".$entry->{local}."\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   366
    Utils::MakeDir($entry->{'local'});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   367
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   368
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   369
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   370
sub FindEntryWithSub {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   371
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   372
  my $checksub = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   373
  my $projectPath;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   374
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   375
  foreach (@{$self->{project_paths}}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   376
    if (&$checksub) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   377
      $projectPath = $_;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   378
      last;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   379
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   380
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   381
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   382
  return $projectPath;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   383
} 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   384
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   385
sub FindEntriesWithSub {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   386
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   387
  my $checksub = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   388
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   389
  return grep { &$checksub } @{$self->{project_paths}};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   390
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   391
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   392
sub CheckRemoteSites {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   393
  my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   394
  my $hasRemoteSite = 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   395
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   396
  foreach my $project (@{$self->{project_paths}}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   397
    $hasRemoteSite = 1 if ($project->{remote}); 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   398
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   399
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   400
  die "Error: No remote sites are defined in your reltools.ini\n" if (!$hasRemoteSite);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   401
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   402
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   403
1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   404
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   405
__END__
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   406
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   407
=head1 NAME
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   408
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   409
PathData/ProjectBased.pm - Provides the location of archived releases with a new-style archive structure.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   410
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   411
=head1 DESCRIPTION
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   412
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   413
A subclass of C<PathData>, provides the understanding of the new-style archive path structure and returns information on where to store releases, and where existing releases are stored.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   414
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   415
=head1 INTERFACE
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   416
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   417
The abstract methods of C<PathData> are implemented.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   418
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   419
=head2 LocalArchivePathForNewComponent
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   420
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   421
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
   422
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   423
=head2 LocalArchivePathForExistingComponent
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   424
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   425
This takes a component, version and optionally a project. 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   426
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   427
=head2 LocalArchivePathForImportingComponent
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   428
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   429
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
   430
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   431
=head2 RemoteArchivePathForExistingComponent
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   432
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   433
This takes a component, a version and a C<RemoteSite> object.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   434
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   435
=head2 RemoteArchivePathForExportingComponent
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   436
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   437
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
   438
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   439
=head2 ListComponents
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   440
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   441
This takes a remote and continue flag. The remote flag when set as "1" is used to indicate that it should list the components stored remotely, not locally. The continue flag when set as "1" is used to indicate that the script should continue regardless of any problems found with regards to the paths set.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   442
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   443
=head2 ListVersions
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   444
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   445
This takes a component. It may optionally take a "1" to indicate that it should list the versions stored remotely, not locally. The third parameter is also optional; it's a Perl-syntax pattern match for the versions.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   446
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   447
=head2 ListProjects
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   448
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   449
=head2 ComponentProjects
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   450
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   451
This takes a component and a version and returns the project name of all archives where the release is found.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   452
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   453
=head2 ComponentProject
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   454
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   455
This takes a component name and a version and returns the project name of the first archive where the release is found.  It gives the corresponding project name to the path that LocalArchivePathForExistingComponent gives for the same arguments.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   456
=head2 ProcessLine
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   457
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   458
This processes a line from the F<reltools.ini>.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   459
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   460
=head1 IMPLEMENTATION
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   461
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   462
This object has a data member, C<project_paths>, which is an array of the project descriptions found in the F<reltools.ini>. Each line is stored as a hash struct, with keys "name", "local" and "remote". It's filled in by C<ProcessLine>, and used by all the other methods via a variety of subroutines which check the contents of this array.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   463
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   464
=head1 KNOWN BUGS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   465
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   466
None.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   467
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   468
=head1 COPYRIGHT
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   469
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   470
 Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   471
 All rights reserved.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   472
 This component and the accompanying materials are made available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   473
 under the terms of the License "Eclipse Public License v1.0"
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   474
 which accompanies this distribution, and is available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   475
 at the URL "http://www.eclipse.org/legal/epl-v10.html".
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   476
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   477
 Initial Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   478
 Nokia Corporation - initial contribution.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   479
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   480
 Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   481
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   482
 Description:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   483
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   484
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   485
=cut