releasing/cbrtools/perl/pushrel
author jascui
Tue, 16 Nov 2010 15:56:27 +0800
changeset 683 8e0eb519ef53
parent 602 3145852acc89
permissions -rw-r--r--
Solve incorrect handling of ExportName=SymbolName@Ordinal syntax

#!perl
# Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of the License "Eclipse Public License v1.0"
# which accompanies this distribution, and is available
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
# 
# Initial Contributors:
# Nokia Corporation - initial contribution.
# 
# Contributors:
# 
# Description:
# 
#

use strict;
use FindBin;
use lib "$FindBin::Bin";
use Getopt::Long;
use File::Copy;
use IniData;
use RelData;
use PathData;
use CommandController;
use PushPullRel;


#
# Globals.
#

my $verbose = 0;
my $force = 0;
my $iniData = IniData->New();
my $commandController = CommandController->New($iniData, 'PushRel');
my $comp;
my $ver;
my $externalIniDataFile;


#
# Main.
#

ProcessCommandLine();
PushRel();


#
# Subs.
#

sub ProcessCommandLine {
  Getopt::Long::Configure ("bundling");
  my $help;
  GetOptions('h' => \$help, 'f' => \$force, 'v+' => \$verbose);

  if ($help) {
    Usage(0);
  }

  $comp = shift @ARGV;
  $ver = shift @ARGV;
  $externalIniDataFile = shift @ARGV;

  unless (defined $comp and defined $ver and defined $externalIniDataFile and $#ARGV == -1) {
    print "Error: Invalid arguments\n";
    Usage(1);
  }

  unless (-e $externalIniDataFile) {
    die "Error: $externalIniDataFile does not exist\n";
  }
}

sub Usage {
  my $exitCode = shift;

  Utils::PrintDeathMessage($exitCode, "\nUsage: pushrel [options] <component> <version> <remote-site-reltools-ini-file>

options:

-h  help
-f  if check fails, overwrite external copy
-v  verbose output (-vv very verbose)\n");
}

sub PushRel {
  my $ppr = new PushPullRel(
    $iniData,
    $externalIniDataFile,
    1, # pushing
    $verbose,
    $force
  );
  $ppr->TransferRel($comp,$ver);
  $ppr->SummariseErrors;
}


__END__

=head1 NAME

PushRel - Copies a released component to another archive.

=head1 SYNOPSIS

  pushrel [options] <component> <version> <remote-site-reltools-ini-file>

options:

  -h  help
  -f  if check fails, overwrite external copy
  -v  verbose output (-vv very verbose)

=head1 DESCRIPTION

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.

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.

=head1 KNOWN BUGS

None.

=head1 COPYRIGHT

 Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
 All rights reserved.
 This component and the accompanying materials are made available
 under the terms of the License "Eclipse Public License v1.0"
 which accompanies this distribution, and is available
 at the URL "http://www.eclipse.org/legal/epl-v10.html".
 
 Initial Contributors:
 Nokia Corporation - initial contribution.
 
 Contributors:
 
 Description:
 

=cut