releasing/cbrtools/perl/pullrel
author Bob Rosenberg <bob.rosenberg@nokia.com>
Fri, 27 Aug 2010 14:50:55 +0100
changeset 638 024a31e39848
parent 602 3145852acc89
permissions -rw-r--r--
Change bld.inf install location to epoc32\tools\sysdeftools

#!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, 'PullRel');
my $comp;
my $ver;
my $externalIniDataFile;


#
# Main.
#

ProcessCommandLine();
PullRel();


#
# 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: pullrel [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 PullRel {
  my $ppr = new PushPullRel(
    $iniData,
    $externalIniDataFile,
    0, # pushing
    $verbose,
    $force
  );
  $ppr->TransferRel($comp,$ver);
  $ppr->SummariseErrors;
}


__END__

=head1 NAME

PullRel - Copies a released component to another archive.

=head1 SYNOPSIS

  pullrel [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<PullEnv> and C<PullEnv> (and C<PullRel> 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 remote environment, checks to see if the corresponding release directory exists on the local 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