releasing/cbrtools/perl/PushEnv
changeset 607 378360dbbdba
parent 602 3145852acc89
equal deleted inserted replaced
591:22486c9c7b15 607:378360dbbdba
       
     1 #!perl
       
     2 # Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 # All rights reserved.
       
     4 # This component and the accompanying materials are made available
       
     5 # under the terms of the License "Eclipse Public License v1.0"
       
     6 # which accompanies this distribution, and is available
       
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 # 
       
     9 # Initial Contributors:
       
    10 # Nokia Corporation - initial contribution.
       
    11 # 
       
    12 # Contributors:
       
    13 # 
       
    14 # Description:
       
    15 # 
       
    16 #
       
    17 
       
    18 use strict;
       
    19 use FindBin;
       
    20 use lib "$FindBin::Bin";
       
    21 use Getopt::Long;
       
    22 use File::Copy;
       
    23 use IniData;
       
    24 use RelData;
       
    25 use PathData;
       
    26 use CommandController;
       
    27 use PushPullRel;
       
    28 
       
    29 
       
    30 #
       
    31 # Globals.
       
    32 #
       
    33 
       
    34 my $verbose = 0;
       
    35 my $force = 0;
       
    36 my $iniData = IniData->New();
       
    37 my $commandController = CommandController->New($iniData, 'PushEnv');
       
    38 my $comp;
       
    39 my $ver;
       
    40 my $externalIniDataFile;
       
    41 
       
    42 
       
    43 #
       
    44 # Main.
       
    45 #
       
    46 
       
    47 ProcessCommandLine();
       
    48 PushEnv();
       
    49 
       
    50 
       
    51 #
       
    52 # Subs.
       
    53 #
       
    54 
       
    55 sub ProcessCommandLine {
       
    56   Getopt::Long::Configure ("bundling");
       
    57   my $help;
       
    58   GetOptions('h' => \$help, 'f' => \$force, 'v+' => \$verbose);
       
    59 
       
    60   if ($help) {
       
    61     Usage(0);
       
    62   }
       
    63 
       
    64   $comp = shift @ARGV;
       
    65   $ver = shift @ARGV;
       
    66   $externalIniDataFile = shift @ARGV;
       
    67 
       
    68   unless (defined $comp and defined $ver and defined $externalIniDataFile and $#ARGV == -1) {
       
    69     print "Error: Invalid arguments\n";
       
    70     Usage(1);
       
    71   }
       
    72 
       
    73   unless (-e $externalIniDataFile) {
       
    74     die "Error: $externalIniDataFile does not exist\n";
       
    75   }
       
    76 }
       
    77 
       
    78 sub Usage {
       
    79   my $exitCode = shift;
       
    80 
       
    81   Utils::PrintDeathMessage($exitCode, "\nUsage: pushenv [options] <component> <version> <remote-site-reltools-ini-file>
       
    82 
       
    83 options:
       
    84 
       
    85 -h  help
       
    86 -f  if check fails, overwrite external copy
       
    87 -v  verbose output (-vv very verbose)\n");
       
    88 }
       
    89 
       
    90 sub PushEnv {
       
    91   my $ppr = new PushPullRel(
       
    92     $iniData,
       
    93     $externalIniDataFile,
       
    94     1, # pushing
       
    95     $verbose,
       
    96     $force
       
    97   );
       
    98   $ppr->TransferEnv($comp,$ver);
       
    99   $ppr->SummariseErrors;
       
   100 }
       
   101 
       
   102 __END__
       
   103 
       
   104 =head1 NAME
       
   105 
       
   106 PushEnv - Copies a released environment to another archive.
       
   107 
       
   108 =head1 SYNOPSIS
       
   109 
       
   110   pushenv [options] <component> <version> <remote-site-reltools-ini-file>
       
   111 
       
   112 options:
       
   113 
       
   114   -h  help
       
   115   -f  if check fails, overwrite external copy
       
   116   -v  verbose output (-vv very verbose)
       
   117 
       
   118 =head1 DESCRIPTION
       
   119 
       
   120 If two sites that share a common WAN want to have separate local archives, the commands C<PushEnv> and C<PullEnv> can be used to keep them in sync. They are similar is spirit to C<ExportEnv> and C<ImportEnv>, however the files are copied directly rather than being encrypted and placed on a shared repository.
       
   121 
       
   122 For each component in the specified local environment, checks to see if the corresponding release directory exists on the remote site. If it does, each if is checked to ensure its modified time and size is that same as in the local archive. If the check fails an error is thrown (by default, unless the C<-f> switch is used). If is does not, the directory is created and the component is copied into it.
       
   123 
       
   124 =head1 KNOWN BUGS
       
   125 
       
   126 None.
       
   127 
       
   128 =head1 COPYRIGHT
       
   129 
       
   130  Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
       
   131  All rights reserved.
       
   132  This component and the accompanying materials are made available
       
   133  under the terms of the License "Eclipse Public License v1.0"
       
   134  which accompanies this distribution, and is available
       
   135  at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
   136  
       
   137  Initial Contributors:
       
   138  Nokia Corporation - initial contribution.
       
   139  
       
   140  Contributors:
       
   141  
       
   142  Description:
       
   143  
       
   144 
       
   145 =cut