releasing/cbrtools/perl/CleanLocalArch
author lorewang
Wed, 10 Nov 2010 14:19:09 +0800
changeset 676 b5e6747818a9
parent 602 3145852acc89
permissions -rw-r--r--
add rofs image compare
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
602
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     1
#!perl
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     2
# Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     3
# All rights reserved.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     4
# This component and the accompanying materials are made available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     5
# under the terms of the License "Eclipse Public License v1.0"
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     6
# which accompanies this distribution, and is available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     8
# 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     9
# Initial Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    10
# Nokia Corporation - initial contribution.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    11
# 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    12
# Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    13
# 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    14
# Description:
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
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    18
use strict;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    19
use FindBin;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    20
use lib "$FindBin::Bin";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    21
use Getopt::Long;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    22
use IniData;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    23
use RelData;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    24
use File::Copy;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    25
use File::Path;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    26
use File::Spec;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    27
use File::Basename;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    28
use Cleaner;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    29
use Utils;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    30
use Cwd;
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
# Globals.
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
my $verbose = 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    37
my $overwrite = 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    38
my $dummyRun = 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    39
my $descriptionFile;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    40
my $iniData = IniData->New();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    41
my $cleaner; # object that does most of it
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    42
my $cleanTo;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    43
my $expunge = 0; # don't leave reldatas lying around
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    44
my $reallyClean;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    45
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    46
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    47
# Main.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    48
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    49
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    50
ProcessCommandLine();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    51
$cleaner = Cleaner->New($iniData, 0, $verbose, $reallyClean); # 0 = local not remote
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    52
ParseDescriptionFile($descriptionFile);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    53
$cleaner->SetCleaningSubroutine(\&CleaningSubroutine);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    54
if (!$expunge) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    55
  $cleaner->SetRevertingSubroutine(\&RevertingSubroutine);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    56
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    57
$cleaner->Clean();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    58
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    59
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    60
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    61
# Subs.
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
sub ProcessCommandLine {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    65
  Getopt::Long::Configure ("bundling");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    66
  my $help;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    67
  GetOptions('h' => \$help, 'd' => \$dummyRun, 'v+' => \$verbose, 'o' => \$overwrite, 'r' => \$reallyClean);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    68
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    69
  if ($help) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    70
    Usage(0);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    71
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    72
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    73
  $descriptionFile = shift @ARGV;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    74
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    75
  unless ($descriptionFile) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    76
    print "Error: Archive cleaning description file not specified\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    77
    Usage(1);
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
  unless ($#ARGV == -1) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    81
    print "Error: Invalid number of arguments\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    82
    Usage(1);
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
  if ($dummyRun and not $verbose) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    86
    $verbose = 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    87
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    88
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    89
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    90
sub Usage {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    91
  my $exitCode = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    92
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    93
  Utils::PrintDeathMessage($exitCode, "\nUsage: cleanlocalarch [options] description-file
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    94
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    95
options:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    96
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    97
-h  help
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    98
-d  dummy run (don't do anything) - assumes -v
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    99
-r  really clean (removes corrupt and partially released components)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   100
-v  verbose output (-vv very verbose)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   101
-o  overwrite destination (delete destination then normal copy)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   102
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   103
Please note, if you are in the process of publishing components to the archive
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   104
and specify the -r option you may lose partially released components.\n");
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
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   108
sub ParseDescriptionFile {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   109
  if ($dummyRun) { print "Running in dummy mode...\n"; }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   110
  if ($verbose) { print "Parsing \"$descriptionFile\"...\n"; }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   111
  open (DES, $descriptionFile) or die "Unable to open \"$descriptionFile\" for reading: $!\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   112
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   113
  while (my $line = <DES>) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   114
    # Remove line feed, white space and comments.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   115
    chomp($line);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   116
    $line =~ s/^\s*$//;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   117
    $line =~ s/#.*//;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   118
    if ($line eq '') {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   119
      # Nothing left.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   120
      next;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   121
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   122
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   123
    my $keyWord;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   124
    my @operand;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   125
    if ($line =~ /^(\w+)\s+(.*)/) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   126
      $keyWord = $1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   127
      @operand = ();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   128
      if ($2) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   129
        @operand = split /\s+/, $2;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   130
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   131
    } else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   132
      $keyWord = $line;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   133
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   134
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   135
    unless (defined $keyWord) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   136
      die "Error: Invalid line in \"$descriptionFile\":\n$line\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   137
      next;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   138
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   139
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   140
    if ($cleaner->ProcessDescriptionLine($descriptionFile, $keyWord, @operand)) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   141
      # We're happy because Cleaner.pm knows what to do with this line
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   142
    } elsif ($keyWord =~ /^clean_to$/) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   143
      unless ($#operand == 0) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   144
        die "Error: Incorrect number of arguments to \'$keyWord\' keyword in \"$descriptionFile\"\nSyntax: clean_to <path>\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   145
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   146
      if ($cleanTo) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   147
        die "Error: \'$keyWord\' keyword specifed more than once in \"$descriptionFile\"\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   148
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   149
      $cleanTo = $operand[0];
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   150
    } elsif ($keyWord =~ /^delete$/) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   151
      if (@operand) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   152
        die "Error: Incorrect number of arguments to \'$keyWord\' keyword in \"$descriptionFile\"\nSyntax: delete\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   153
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   154
    } elsif ($keyWord =~ /^expunge$/) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   155
      $expunge = 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   156
      $cleaner->{expunge_already_cleaned} = 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   157
    } elsif ($keyWord =~ /^no_prompt$/) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   158
      print "Warning: currently, CleanLocalArch does not prompt. 'no_prompt' keyword is redundant.\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   159
    } else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   160
      die "Error: Unknown keyword \'$keyWord\' in \"$descriptionFile\"\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   161
    }
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
  close (DES);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   165
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   166
  unless ($cleanTo || $expunge) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   167
    die "Error: \"Clean to\" path not specified in \"$descriptionFile\"\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   168
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   169
  if ($cleanTo && $expunge) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   170
    die "Error: can't specify both \"clean_to\" and \"expunge\" in \"$descriptionFile\"\n";
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
  if ($verbose > 1) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   174
    $cleaner->PrintEnvsToKeep();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   175
  }
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 CleaningSubroutine {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   179
  # This actually gets run by Cleaner.pm (it's a callback)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   180
  my $thisComp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   181
  my $thisVer = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   182
  my $relDir = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   183
  if ($expunge) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   184
    print "Expunging $thisComp $thisVer from $relDir...\n" if ($verbose);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   185
    return DeleteComp($relDir);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   186
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   187
  print "Archiving $thisComp $thisVer from $relDir to $cleanTo...\n" if ($verbose);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   188
  my $cleanDir = "$cleanTo\\$thisComp\\$thisVer";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   189
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   190
  if (CopyComp($relDir, $cleanDir)) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   191
    print "Wiping $thisComp $thisVer from $relDir...\n" if ($verbose);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   192
    if (DeleteComp("$relDir")) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   193
      # Check if the remaining dir is empty
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   194
      my ($parent, $file, $ext) = Utils::SplitFileName($relDir);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   195
      return DeleteCompIfEmpty($parent);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   196
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   197
    else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   198
      # Call the reverting subroutine here because cleaner.pm will only revert clean components
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   199
      RevertingSubroutine($thisComp, $thisVer, $relDir);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   200
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   201
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   202
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   203
  return 0;
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 RevertingSubroutine {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   207
  # Again, this gets run by Cleaner.pm
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   208
  my $thisComp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   209
  my $thisVer = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   210
  my $relDir = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   211
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   212
  print "Restoring $thisComp $thisVer to $relDir...\n" if ($verbose);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   213
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   214
  # create the reldir if required
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   215
  if(!-d $relDir) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   216
    Utils::MakeDir($relDir);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   217
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   218
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   219
  my $fullCleanToPath = File::Spec->catdir($cleanTo, $thisComp, $thisVer);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   220
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   221
  my $dirContents = Utils::ReadDir($fullCleanToPath);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   222
  foreach my $thisFile (@$dirContents) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   223
     copy(File::Spec->catdir($fullCleanToPath, $thisFile), $relDir);
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
  print "Removing copy of $thisComp $thisVer from $cleanTo...\n" if ($verbose);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   227
  if (DeleteComp("$cleanTo\\$thisComp\\$thisVer")) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   228
    # Check if the remaining dir is empty
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   229
    return DeleteCompIfEmpty("$cleanTo\\$thisComp");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   230
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   231
  else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   232
    # Failed to even delete component
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   233
    return 0;
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
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   237
sub CopyComp {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   238
  my $dir = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   239
  my $destDir = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   240
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   241
  if (-e $destDir) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   242
    if ($overwrite) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   243
      if ($verbose > 0) { print "Overwriting by deleting \"$destDir\"\n"; }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   244
      DeleteComp("$destDir");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   245
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   246
    else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   247
      print "Error: Can't copy \"$dir\" to \"$destDir\" because directory \"$destDir\" already exists\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   248
      return 0;
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
  my $failed = 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   253
  my @copied;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   254
  eval {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   255
    Utils::MakeDir($destDir) unless $dummyRun;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   256
  };
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   257
  if ($@) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   258
    print "$@";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   259
    $failed = 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   260
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   261
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   262
  if($failed==0) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   263
    my $dirContents = Utils::ReadDir($dir);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   264
    foreach my $thisFile (@$dirContents) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   265
      if ($verbose > 1) { print "\tCopying \"$dir\\$thisFile\" to \"$destDir\"...\n"; }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   266
      if ($dummyRun) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   267
        return 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   268
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   269
      else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   270
        if (copy($dir."\\".$thisFile, $destDir)) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   271
          push @copied, $thisFile;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   272
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   273
        else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   274
          print "Error: Couldn't copy \"$dir\\$thisFile\" to \"$destDir\": $!\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   275
          $failed = 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   276
          if (-f $destDir."\\".$thisFile) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   277
            # Must've part-copied this file
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   278
            push @copied, $thisFile;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   279
          }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   280
          last;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   281
        }
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
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   285
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   286
  if ($failed) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   287
    # Revert copied files
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   288
    foreach my $thisFile (@copied) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   289
      unlink $destDir."\\".$thisFile or print "Error: Couldn't delete $destDir\\$thisFile when cleaning up\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   290
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   291
    DeleteCompIfEmpty($destDir) or print "Error: Couldn't clean up empty directory $destDir\n";
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
  return ($failed == 0);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   295
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   296
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   297
sub DeleteComp {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   298
  my $dir = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   299
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   300
  if (!$dummyRun) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   301
    local $SIG{__WARN__} = sub {my $line = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   302
                                $line =~ s/ at .*$//;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   303
                                print "Error: $line\n";};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   304
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   305
    my $reldataFile = File::Spec->catdir($dir, 'reldata');
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   306
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   307
    my $origDir = cwd();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   308
    chdir(dirname($dir));
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   309
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   310
    if (-e $reldataFile) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   311
      # Delete the reldata file first, if something goes wrong other tools will identify the archived component
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   312
      # as corrupt by the absence of reldata
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   313
      if (!unlink $reldataFile) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   314
        print "Error: Couldn't delete \"$reldataFile\"\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   315
        return 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   316
      }
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
    if (!rmtree($dir, 0, 0) or -d $dir) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   320
      print "Error: Couldn't delete \"$dir\"\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   321
      return 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   322
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   323
    else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   324
      chdir($origDir);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   325
      return 1;
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
  else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   329
    return 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   330
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   331
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   332
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   333
sub DeleteCompIfEmpty {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   334
  my $dir = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   335
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   336
  if (!$dummyRun) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   337
    if (opendir(DIR, $dir)) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   338
      my @files = grep( !/\.\.?$/, readdir DIR);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   339
      if (!closedir(DIR)) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   340
        die "Error: Couldn't close '$dir' after reading. Aborting\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   341
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   342
      if (scalar(@files) == 0) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   343
        print "Tidying $dir...\n" if ($verbose);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   344
        return DeleteComp("$dir");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   345
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   346
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   347
      else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   348
        return 1; # Nothing to do
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
    else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   352
      print "Warning: Couldn't open '$dir' directory for reading. An empty directory may have been left behind.\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   353
      return 1; # Warning only
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
  else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   357
    return 1; # Dummy run
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   358
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   359
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   360
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   361
__END__
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   362
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   363
=head1 NAME
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   364
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   365
CleanLocalArch - Cleans unwanted releases from the local release archive.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   366
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   367
=head1 SYNOPSIS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   368
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   369
  cleanlocalarch [options] <description_file>
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   370
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   371
options:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   372
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   373
  -h  help
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   374
  -d  dummy run (don't do anything) - assumes -v
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   375
  -r  really clean (removes corrupt and partially released components)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   376
  -v  verbose output (-vv very verbose)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   377
  -o  overwrite destination (delete destination then normal copy)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   378
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   379
Please note, if you are in the process of publishing components to the archive and specify the -r option you may lose partially released components.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   380
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   381
=head1 DESCRIPTION
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   382
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   383
C<CleanLocalArch> allows releases to be cleaned out of a local archive. This may be useful if a local archive is consuming a large amount of disk space and there are old releases present that are no longer required. Note that releases to be cleaned are normally backed up to a user defined directory before being deleted. This allows the cleaned releases to be permanently archived (to say a writable CDROM) before they are deleted.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   384
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   385
If C<CleanLocalArch> encounters an error while backing up releases to be cleaned, it will attempt to back out of the change by deleting the backups of any releases already done. If C<CleanLocalArch> encounters errors while backing out of a clean, it has the potential to leave releases in the backup directory. Similarly, if after backing up all releases to delete, it encounters errors while actually deleting them, it may leave releases in the local archive. However the clean can be repeated to a fresh backup directory once the problem has been isolated to get rid of these releases.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   386
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   387
Before using C<CleanLocalArchive> you must write a plain text file that describes which releases you want to keep etc. The following keywords are supported:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   388
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   389
=over 4
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   390
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   391
=item keep_env <component> <version>
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   392
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   393
Instructs C<CleanLocalArchive> to keep all the component versions in the environment from which the specified component was released. This keyword may be used multiple times.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   394
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   395
=item keep_rel <component> <version>
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   396
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   397
Instructs C<CleanLocalArchive> to keep a specific component release. This keyword may be used multiple times.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   398
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   399
=item keep_recent_env <component> <num_days>
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   400
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   401
Instructs C<CleanLocalArchive> to keep all named component releases, including their environments, where the component release has been made within the specified number of days (since the current time). This keyword may be used multiple times provided it is used for different components each time.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   402
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   403
=item keep_recent_rel [component] <num_days>
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   404
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   405
Instructs C<CleanLocalArchive> to keep any component releases made within the specified number of days (since the current time). If a component name is specified, C<CleanLocalArchive> will only keep component releases which match that name (and are sufficiently recent). This keyword may be used multiple times if the command is used for different components.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   406
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   407
=item keep_recent <num_days>
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   408
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   409
B<Depricated:> Equivalent to keep_recent_rel without a component name entered.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   410
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   411
=item clean_to
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   412
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   413
Specifies where to move release to be cleaned. Use of this keyword is mandatory and may only be used once. There is an alternative, 'expunge', which will actually delete the releases - but this is only intended for test scripts and use on real, important archives is strongly discouraged.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   414
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   415
=item force
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   416
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   417
This keyword, which takes no operands, specifies that cleanlocalarch should be non-interactive.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   418
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   419
=back
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   420
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   421
For example:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   422
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   423
 keep_env     pixie alpha
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   424
 keep_env     pixie beta
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   425
 keep_rel     comp1 rel1
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   426
 keep_recent  10
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   427
 clean_to     \\backup\pixie_cleaned_releases
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   428
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   429
C<CleanLocalArch> will work out which component releases need to be kept in order to satisfy the specified keep criteria. All other component releases found in the archive will be moved to the C<clean_to> directory. B<It is therefore extremely important that the list of environments to keep is complete>. It is recommended that this file be controlled using a configuration management tool. It is also recommended that each project has only one description file, and that all users of C<CleanLocalArch> know where to find it.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   430
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   431
Recommended procedure for using C<CleanLocalArch>:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   432
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   433
=over 4
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   434
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   435
=item 1
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   436
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   437
Inform all users of the archive that a clean is about to be performed, and that the archive will be unavailable whilst this is happening.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   438
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   439
=item 2
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   440
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   441
Take the archive off-line or alter directory permissions such that you are the only person that can access it.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   442
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   443
=item 3
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   444
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   445
Backup the archive.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   446
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   447
=item 4
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   448
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   449
Run C<CleanLocalArchive> and carefully check the list of components that are about to be cleaned. If you are happy, type 'yes' to continue, otherwise type 'no', modify your description file and re-run C<CleanLocalArchive>.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   450
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   451
=item 5
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   452
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   453
Backup the C<clean_to> directory.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   454
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   455
=item 6
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   456
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   457
Bring the archive back on-line.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   458
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   459
=item 7
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   460
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   461
Inform all users of the archive that it is available for use once more.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   462
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   463
=back
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   464
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   465
=head1 STATUS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   466
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   467
Supported. If you find a problem, please report it to us.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   468
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   469
=head1 COPYRIGHT
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   470
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   471
 Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   472
 All rights reserved.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   473
 This component and the accompanying materials are made available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   474
 under the terms of the License "Eclipse Public License v1.0"
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   475
 which accompanies this distribution, and is available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   476
 at the URL "http://www.eclipse.org/legal/epl-v10.html".
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   477
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   478
 Initial Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   479
 Nokia Corporation - initial contribution.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   480
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   481
 Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   482
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   483
 Description:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   484
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   485
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   486
=cut