releasing/cbrtools/perl/pushrel
changeset 602 3145852acc89
equal deleted inserted replaced
600:6d08f4a05d93 602:3145852acc89
       
     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, 'PushRel');
       
    38 my $comp;
       
    39 my $ver;
       
    40 my $externalIniDataFile;
       
    41 
       
    42 
       
    43 #
       
    44 # Main.
       
    45 #
       
    46 
       
    47 ProcessCommandLine();
       
    48 PushRel();
       
    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: pushrel [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 PushRel {
       
    91   my $ppr = new PushPullRel(
       
    92     $iniData,
       
    93     $externalIniDataFile,
       
    94     1, # pushing
       
    95     $verbose,
       
    96     $force
       
    97   );
       
    98   $ppr->TransferRel($comp,$ver);
       
    99   $ppr->SummariseErrors;
       
   100 }
       
   101 
       
   102 
       
   103 __END__
       
   104 
       
   105 =head1 NAME
       
   106 
       
   107 PushRel - Copies a released component to another archive.
       
   108 
       
   109 =head1 SYNOPSIS
       
   110 
       
   111   pushrel [options] <component> <version> <remote-site-reltools-ini-file>
       
   112 
       
   113 options:
       
   114 
       
   115   -h  help
       
   116   -f  if check fails, overwrite external copy
       
   117   -v  verbose output (-vv very verbose)
       
   118 
       
   119 =head1 DESCRIPTION
       
   120 
       
   121 If two sites that share a common WAN want to have separate local archives, the commands C<PushEnv> and C<PullEnv> (and C<PushRel> and C<PullRel>) 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.
       
   122 
       
   123 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.
       
   124 
       
   125 =head1 KNOWN BUGS
       
   126 
       
   127 None.
       
   128 
       
   129 =head1 COPYRIGHT
       
   130 
       
   131  Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
       
   132  All rights reserved.
       
   133  This component and the accompanying materials are made available
       
   134  under the terms of the License "Eclipse Public License v1.0"
       
   135  which accompanies this distribution, and is available
       
   136  at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
   137  
       
   138  Initial Contributors:
       
   139  Nokia Corporation - initial contribution.
       
   140  
       
   141  Contributors:
       
   142  
       
   143  Description:
       
   144  
       
   145 
       
   146 =cut