|
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 File::Path; |
|
24 use IniData; |
|
25 use RelData; |
|
26 use PathData; |
|
27 use CommandController; |
|
28 use PushPullRel; |
|
29 |
|
30 |
|
31 # |
|
32 # Globals. |
|
33 # |
|
34 |
|
35 my $verbose = 0; |
|
36 my $force = 0; |
|
37 my $iniData = IniData->New(); |
|
38 my $commandController = CommandController->New($iniData, 'PullEnv'); |
|
39 my $comp; |
|
40 my $ver; |
|
41 my $externalIniDataFile; |
|
42 |
|
43 |
|
44 # |
|
45 # Main. |
|
46 # |
|
47 |
|
48 ProcessCommandLine(); |
|
49 PullEnv(); |
|
50 |
|
51 |
|
52 # |
|
53 # Subs. |
|
54 # |
|
55 |
|
56 sub ProcessCommandLine { |
|
57 Getopt::Long::Configure ("bundling"); |
|
58 my $help; |
|
59 GetOptions('h' => \$help, 'f' => \$force, 'v+' => \$verbose); |
|
60 |
|
61 if ($help) { |
|
62 Usage(0); |
|
63 } |
|
64 |
|
65 $comp = shift @ARGV; |
|
66 $ver = shift @ARGV; |
|
67 $externalIniDataFile = shift @ARGV; |
|
68 |
|
69 unless (defined $comp and defined $ver and defined $externalIniDataFile and $#ARGV == -1) { |
|
70 print "Error: Invalid arguments\n"; |
|
71 Usage(1); |
|
72 } |
|
73 |
|
74 unless (-e $externalIniDataFile) { |
|
75 die "Error: $externalIniDataFile does not exist\n"; |
|
76 } |
|
77 } |
|
78 |
|
79 sub Usage { |
|
80 my $exitCode = shift; |
|
81 |
|
82 Utils::PrintDeathMessage($exitCode, "\nUsage: pullenv [options] <component> <version> <remote-reltools-ini-file> |
|
83 |
|
84 options: |
|
85 |
|
86 -h help |
|
87 -f if check fails, overwrite local copy |
|
88 -v verbose output (-vv very verbose)\n"); |
|
89 } |
|
90 |
|
91 sub PullEnv { |
|
92 my $ppr = new PushPullRel( |
|
93 $iniData, |
|
94 $externalIniDataFile, |
|
95 0, # pushing |
|
96 $verbose, |
|
97 $force |
|
98 ); |
|
99 $ppr->TransferEnv($comp,$ver); |
|
100 $ppr->SummariseErrors; |
|
101 } |
|
102 |
|
103 |
|
104 __END__ |
|
105 |
|
106 =head1 NAME |
|
107 |
|
108 PullEnv - Copies a released environment from another archive. |
|
109 |
|
110 =head1 SYNOPSIS |
|
111 |
|
112 pullenv [options] <component> <version> <remote-reltools-ini-file> |
|
113 |
|
114 options: |
|
115 |
|
116 -h help |
|
117 -f if check fails, overwrite local copy |
|
118 -v verbose output (-vv very verbose) |
|
119 |
|
120 =head1 DESCRIPTION |
|
121 |
|
122 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. |
|
123 |
|
124 For each component in the specified external environment, checks to see if the corresponding release directory exists in the local archive. If it does, each if is checked to ensure its modified time and size is that same as in the external 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. |
|
125 |
|
126 =head1 KNOWN BUGS |
|
127 |
|
128 None. |
|
129 |
|
130 =head1 COPYRIGHT |
|
131 |
|
132 Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
133 All rights reserved. |
|
134 This component and the accompanying materials are made available |
|
135 under the terms of the License "Eclipse Public License v1.0" |
|
136 which accompanies this distribution, and is available |
|
137 at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
138 |
|
139 Initial Contributors: |
|
140 Nokia Corporation - initial contribution. |
|
141 |
|
142 Contributors: |
|
143 |
|
144 Description: |
|
145 |
|
146 |
|
147 =cut |