releasing/cbrtools/perl/cleanremote
author kelvzhu
Mon, 18 Oct 2010 16:16:46 +0800
changeset 655 3f65fd25dfd4
parent 602 3145852acc89
permissions -rw-r--r--
sync up SVN codes
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 CommandController;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    25
use Cleaner;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    26
use Utils;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    27
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    28
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    29
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    30
# Globals.
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
my $verbose = 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    34
my $dummyRun = 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    35
my $descriptionFile;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    36
my $iniData = IniData->New();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    37
my $commandController = CommandController->New($iniData, 'CleanRemote');
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    38
my $keepAfter;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    39
my %envsToKeep;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    40
my %relsToKeep;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    41
my %relsToClean;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    42
my @filesToDelete;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    43
my $remoteSite = $iniData->RemoteSite;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    44
my $cleaner;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    45
my $doall = 0; # skips prompting
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    46
my $skipWarnings;
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
# Main.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    50
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    51
ProcessCommandLine();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    52
$cleaner = Cleaner->New($iniData, 1, $verbose, 0); # 1 = remote
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
ParseDescriptionFile($descriptionFile);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    55
$cleaner->Clean();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    56
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    57
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    58
# Subs.
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
sub ProcessCommandLine {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    62
  Getopt::Long::Configure ("bundling");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    63
  my $help;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    64
  GetOptions('h' => \$help, 'd' => \$dummyRun, 'v+' => \$verbose, 'f' => \$skipWarnings);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    65
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    66
  if ($help) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    67
    Usage(0);
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
  $descriptionFile = shift @ARGV;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    71
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    72
  unless ($descriptionFile) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    73
    print "Error: Archive cleaning description file not specified\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    74
    Usage(1);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    75
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    76
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    77
  unless ($#ARGV == -1) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    78
    print "Error: Invalid number of arguments\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    79
    Usage(1);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    80
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    81
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    82
  if ($dummyRun and not $verbose) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    83
    $verbose = 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    84
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    85
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    86
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    87
sub Usage {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    88
  my $exitCode = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    89
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    90
  Utils::PrintDeathMessage($exitCode, "\nUsage: cleanremote [options] <description_file>
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    91
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    92
options:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    93
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    94
-h  help
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    95
-d  dummy run (don't do anything) - assumes -v
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    96
-f  (deprecated)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    97
-v  verbose output (-vv very verbose).\n");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    98
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    99
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   100
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   101
sub ParseDescriptionFile {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   102
  if ($verbose) { print "Parsing \"$descriptionFile\"...\n"; }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   103
  open (DES, $descriptionFile) or die "Unable to open \"$descriptionFile\" for reading: $!\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   104
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   105
  while (my $line = <DES>) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   106
    # Remove line feed, white space and comments.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   107
    chomp($line);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   108
    $line =~ s/^\s*$//;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   109
    $line =~ s/#.*//;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   110
    if ($line eq '') {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   111
      # Nothing left.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   112
      next;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   113
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   114
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   115
    my $keyWord;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   116
    my @operand;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   117
    if ($line =~ /^(\w+)\s+(.*)/) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   118
      $keyWord = $1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   119
      @operand = ();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   120
      if ($2) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   121
        @operand = split /\s+/, $2;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   122
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   123
    } else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   124
      $keyWord = $line;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   125
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   126
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   127
    unless (defined $keyWord) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   128
      die "Error: Invalid line in \"$descriptionFile\":\n$line\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   129
      next;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   130
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   131
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   132
    if ($cleaner->ProcessDescriptionLine($descriptionFile, $keyWord, @operand)) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   133
      # We're happy because Cleaner.pm knows what to do with this line
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   134
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   135
    elsif ($keyWord =~ /^(?:no_prompt)$/ ) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   136
      $doall = 1;    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   137
    } elsif ($keyWord =~ /^(?:clean_to|expunge)$/ ) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   138
      my $msg = "You have accidentally left a \"$keyWord\" keyword in your configuration file. That's appropriate for cleaning local archives, but cleanremote just completely deletes stuff. Do you want to continue?";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   139
      die unless $cleaner->Query($msg);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   140
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   141
    else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   142
      die "Error: Unknown keyword \'$keyWord\' in \"$descriptionFile\"\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   143
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   144
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   145
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   146
  close (DES);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   147
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   148
  if ($verbose > 1) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   149
    $cleaner->PrintEnvsToKeep();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   150
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   151
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   152
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   153
sub CleaningSubroutine {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   154
  # This actually gets run by Cleaner.pm (it's a callback)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   155
  my $thisComp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   156
  my $thisVer = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   157
  my $relDir = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   158
  print "Cleaning $thisComp $thisVer from $relDir...\n" if ($verbose);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   159
  unless ($doall) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   160
    print "Do it?\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   161
    my $ans = <STDIN>;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   162
    die "Not doing" unless $ans =~ m/[ay]/i;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   163
    $doall = 1 if $ans =~ m/a/i;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   164
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   165
  die "Couldn't delete $relDir because it didn't exist" unless $remoteSite->DirExists($relDir);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   166
  my $fullfile = "$relDir/$thisComp$thisVer.zip";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   167
  print "Actually deleting release file $fullfile\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   168
  DeleteFile($fullfile);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   169
  my @files = @{$remoteSite->DirList($relDir) || []};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   170
  foreach my $fullfile (@files) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   171
    if ($fullfile =~ m/lpdrt\d{5}\.tmp$/) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   172
      # Remove temp files older than $keepAfter time
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   173
      my $modifiedTime = $remoteSite->FileModifiedTime($fullfile);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   174
      my $keepAfter = $cleaner->{keepAfter};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   175
      if ($modifiedTime and (not defined $keepAfter or $modifiedTime <= $keepAfter)) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   176
        print "Actually deleting temp file $fullfile\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   177
        DeleteFile($fullfile);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   178
      } else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   179
        print "Not deleting temp file $fullfile because too new\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   180
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   181
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   182
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   183
  if (!$dummyRun) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   184
    # Now check the directory is empty and delete the directory if so
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   185
    @files = @{$remoteSite->DirList($relDir) || []};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   186
    @files = map { m/.*\/(.*?)$/; $1 } @files;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   187
    print "Wanting to remove directory $relDir - @files files left in it\n" if ($verbose);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   188
    DeleteFile($relDir) unless @files;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   189
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   190
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   191
  return 1; # This cleaner doesn't currently support returning of any errors
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   192
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   193
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   194
sub DeleteFile {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   195
  my $file = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   196
  print "Deleting \"$file\"\n" if ($verbose);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   197
	eval {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   198
		$remoteSite->DeleteFile($file) unless ($dummyRun);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   199
	};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   200
	if ($@) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   201
		print "Warning: Couldn't delete \"$file\" because \"$@\"\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   202
		# Usually because $file is a directory, which turns out not to be
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   203
		# empty.
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
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   207
__END__
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   208
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   209
=head1 NAME
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   210
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   211
CleanRemote - Cleans unwanted releases and files from a remote archive.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   212
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   213
=head1 SYNOPSIS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   214
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   215
  cleanremote [options] <description_file>
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   216
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   217
options:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   218
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   219
  -h  help
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   220
  -d  dummy run (don't do anything) - assumes -v
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   221
  -f  (deprecated)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   222
  -v  verbose output (-vv very verbose)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   223
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   224
=head1 DESCRIPTION
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   225
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   226
C<cleanremote> allows releases to be cleaned out of a remote archive. This may be useful if a remote archive is consuming a large amount of disk space and there are old releases present that are no longer required.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   227
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   228
B<Warning: C<cleanremote> has the potential to seriously alter the state of a remote archive, and hence seriously damage productivity of all users of the remote archive. Be very careful using it.>
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   229
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   230
Before using C<cleanremote> 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
   231
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   232
=over 4
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   233
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   234
=item keep_env <component> <version>
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   235
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   236
Instructs C<cleanremote> 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
   237
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   238
=item keep_rel <component> <version>
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   239
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   240
Instructs C<cleanremote> to keep a specific component release. This keyword may be used multiple times.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   241
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   242
=item keep_recent_env <component> <num_days>
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   243
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   244
Instructs C<cleanremote> to keep all named component releases, including their environments, where the component release has been exported within the specified number of days (since the current time) (note: the export time, rather than release time is used).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   245
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   246
It should be noted that for this keyword to work, an accessible local archive must contain copies of the same component releases as are identified on the remote server as ones to keep.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   247
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   248
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
   249
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   250
=item keep_recent_rel [component] <num_days>
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   251
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   252
Instructs C<cleanremote> to keep any component releases exported within the specified number of days (since the current time). If a component name is specified, C<cleanremote> will only keep component releases which match that name (and are sufficiently recent). Please note that the time is taken from time of export, not time of release.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   253
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   254
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
   255
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   256
=item keep_recent <num_days>
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   257
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   258
B<Depricated:> Equivalent to keep_recent_rel without a component name entered.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   259
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   260
=item no_prompt
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   261
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   262
Instructs C<cleanremote> to not prompt the user to delete every component. This is equivalent to typing 'a' (all) at the first component prompt.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   263
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   264
=back
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   265
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   266
For example:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   267
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   268
 keep_env     pixie alpha
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   269
 keep_env     pixie beta
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   270
 keep_rel     comp1 rel1
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   271
 keep_recent  10
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   272
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   273
C<cleanremote> 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 deleted (along with temporary files used during FTP uploads). 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<cleanremote> know where to find it.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   274
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   275
Recommended procedure for using C<cleanremote>:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   276
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   277
=over 4
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   278
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   279
=item 1
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   280
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   281
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
   282
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   283
=item 2
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   284
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   285
Take the archive off-line or alter permissions such that you are the only person that can access it.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   286
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   287
=item 3
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   288
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   289
Backup the archive.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   290
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   291
=item 4
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   292
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   293
Run C<cleanremote> 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<cleanremote>.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   294
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   295
=item 5
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   296
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   297
Bring the archive back on-line.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   298
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   299
=item 6
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   300
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   301
Inform all users of the archive that it is available for use once more.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   302
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   303
=back
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   304
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   305
=head1 STATUS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   306
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   307
Supported. If you find a problem, please report it to us.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   308
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   309
=head1 KNOWN BUGS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   310
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   311
None.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   312
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   313
=head1 COPYRIGHT
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   314
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   315
 Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   316
 All rights reserved.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   317
 This component and the accompanying materials are made available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   318
 under the terms of the License "Eclipse Public License v1.0"
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   319
 which accompanies this distribution, and is available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   320
 at the URL "http://www.eclipse.org/legal/epl-v10.html".
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   321
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   322
 Initial Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   323
 Nokia Corporation - initial contribution.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   324
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   325
 Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   326
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   327
 Description:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   328
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   329
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   330
=cut