checkdeliver.pl (0817ece2) checkdeliver.pl (b0fb6f9d)
1:
2eval 'exec perl -wS $0 ${1+"$@"}'
3 if 0;
4#**************************************************************
1:
2eval 'exec perl -wS $0 ${1+"$@"}'
3 if 0;
4#**************************************************************
5#
5#
6# Licensed to the Apache Software Foundation (ASF) under one
7# or more contributor license agreements. See the NOTICE file
8# distributed with this work for additional information
9# regarding copyright ownership. The ASF licenses this file
10# to you under the Apache License, Version 2.0 (the
11# "License"); you may not use this file except in compliance
12# with the License. You may obtain a copy of the License at
6# Licensed to the Apache Software Foundation (ASF) under one
7# or more contributor license agreements. See the NOTICE file
8# distributed with this work for additional information
9# regarding copyright ownership. The ASF licenses this file
10# to you under the Apache License, Version 2.0 (the
11# "License"); you may not use this file except in compliance
12# with the License. You may obtain a copy of the License at
13#
13#
14# http://www.apache.org/licenses/LICENSE-2.0
14# http://www.apache.org/licenses/LICENSE-2.0
15#
15#
16# Unless required by applicable law or agreed to in writing,
17# software distributed under the License is distributed on an
18# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19# KIND, either express or implied. See the License for the
20# specific language governing permissions and limitations
21# under the License.
16# Unless required by applicable law or agreed to in writing,
17# software distributed under the License is distributed on an
18# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19# KIND, either express or implied. See the License for the
20# specific language governing permissions and limitations
21# under the License.
22#
22#
23#**************************************************************
24
25
26#
27#
28# checkdeliver.pl - compare delivered files on solver with those on SRC_ROOT
29#
30

--- 34 unchanged lines hidden (view full) ---

65
66#### subroutines ####
67
68sub get_globals
69# set global variables using environment variables and command line options
70{
71 my $help;
72
23#**************************************************************
24
25
26#
27#
28# checkdeliver.pl - compare delivered files on solver with those on SRC_ROOT
29#
30

--- 34 unchanged lines hidden (view full) ---

65
66#### subroutines ####
67
68sub get_globals
69# set global variables using environment variables and command line options
70{
71 my $help;
72
73 # set global variables according to environnment
73 # set global variables according to environment
74 $platform = $ENV{INPATH};
75 $srcrootdir = $ENV{SOURCE_ROOT_DIR};
76 $solverdir = $ENV{SOLARVERSION};
77 $milestoneext = $ENV{UPDMINOREXT};
78
79 # override environment with command line options
80 GetOptions('help' => \$help,
81 'l=s' => \$logfile,

--- 99 unchanged lines hidden (view full) ---

181 if ( ! $repository ) {
182 print_logged( "Error parsing \'$listname\': cannot determine repository. Module '$module' not delivered correctly?\n\n" );
183 $error ++;
184 return $error;
185 }
186
187 my $path = "$srcrootdir/$repository/$module";
188 # is module physically accessible?
74 $platform = $ENV{INPATH};
75 $srcrootdir = $ENV{SOURCE_ROOT_DIR};
76 $solverdir = $ENV{SOLARVERSION};
77 $milestoneext = $ENV{UPDMINOREXT};
78
79 # override environment with command line options
80 GetOptions('help' => \$help,
81 'l=s' => \$logfile,

--- 99 unchanged lines hidden (view full) ---

181 if ( ! $repository ) {
182 print_logged( "Error parsing \'$listname\': cannot determine repository. Module '$module' not delivered correctly?\n\n" );
183 $error ++;
184 return $error;
185 }
186
187 my $path = "$srcrootdir/$repository/$module";
188 # is module physically accessible?
189 # there are valid use cases where we build against a prebuild solver whithout having
189 # there are valid use cases where we build against a prebuild solver without having
190 # all modules at disk
191 my $canread = is_moduledirectory( $path );
192 if ( ! $canread ) {
193 # do not bother about non existing modules in local environment
194 # or on childworkspaces
195 if (( $local_env ) || ( $ENV{CWS_WORK_STAMP} )) {
196 return $error;
197 }
198 # in a master build it is considered an error to have deliver leftovers
190 # all modules at disk
191 my $canread = is_moduledirectory( $path );
192 if ( ! $canread ) {
193 # do not bother about non existing modules in local environment
194 # or on childworkspaces
195 if (( $local_env ) || ( $ENV{CWS_WORK_STAMP} )) {
196 return $error;
197 }
198 # in a master build it is considered an error to have deliver leftovers
199 # from non exising (removed) modules
199 # from non existing (removed) modules
200 print_logged( "Error: module '$module' not found.\n" );
201 $error++;
202 return $error;
203 }
204 if ( $canread == 2 ) {
205 # module is linked and not built, no need for checking
206 # should not happen any more nowadays ...
207 return $error;

--- 8 unchanged lines hidden (view full) ---

216 # deliver log files do not contain milestone extension on solver
217 $sfile =~ s/\/$platform\/(...)\//\/$platform\/$1$milestoneext\//;
218 }
219 my $orgfile_stats = stat($ofile);
220 next if ( -d _ ); # compare files, not directories
221 my $delivered_stats = lstat($sfile);
222 next if ( -d _ ); # compare files, not directories
223 if ( $^O !~ /^MSWin/ ) {
200 print_logged( "Error: module '$module' not found.\n" );
201 $error++;
202 return $error;
203 }
204 if ( $canread == 2 ) {
205 # module is linked and not built, no need for checking
206 # should not happen any more nowadays ...
207 return $error;

--- 8 unchanged lines hidden (view full) ---

216 # deliver log files do not contain milestone extension on solver
217 $sfile =~ s/\/$platform\/(...)\//\/$platform\/$1$milestoneext\//;
218 }
219 my $orgfile_stats = stat($ofile);
220 next if ( -d _ ); # compare files, not directories
221 my $delivered_stats = lstat($sfile);
222 next if ( -d _ ); # compare files, not directories
223 if ( $^O !~ /^MSWin/ ) {
224 # windows does not know about links.
224 # Windows does not know about links.
225 # Therefore lstat() is not a lstat, and the following check would break
226 next if ( -l _ ); # compare files, not links
227 }
228
229 if ( $orgfile_stats && $delivered_stats ) {
225 # Therefore lstat() is not a lstat, and the following check would break
226 next if ( -l _ ); # compare files, not links
227 }
228
229 if ( $orgfile_stats && $delivered_stats ) {
230 # Stripping (on unix like platforms) and signing (for windows)
230 # Stripping (on unix like platforms) and signing (for Windows)
231 # changes file size. Therefore we have to compare for file dates.
232 # File modification time also can change after deliver, f.e. by
233 # rebasing, but only increase. It must not happen that a file on
231 # changes file size. Therefore we have to compare for file dates.
232 # File modification time also can change after deliver, f.e. by
233 # rebasing, but only increase. It must not happen that a file on
234 # solver is older than it's source.
234 # solver is older than its source.
235 if ( ( $orgfile_stats->mtime - $delivered_stats->mtime ) gt 1 ) {
236 print_logged( "Error: " );
235 if ( ( $orgfile_stats->mtime - $delivered_stats->mtime ) gt 1 ) {
236 print_logged( "Error: " );
237 print_logged( "delivered file is older than it's source '$ofile' '$sfile'\n" );
237 print_logged( "delivered file is older than its source '$ofile' '$sfile'\n" );
238 $error ++;
239 }
240 } elsif ( !$orgfile_stats && $delivered_stats ) {
241 # This is not an error if we have a solver and did not build the
242 # module!
243 } elsif ( !$orgfile_stats && !$delivered_stats ) {
244 # This is not necessarily an error.
245 # Instead, this seems to be an error of the deliver.log file.

--- 23 unchanged lines hidden (view full) ---

269 return 2
270 } else {
271 return 0;
272 }
273}
274
275sub print_logged
276# Print routine.
238 $error ++;
239 }
240 } elsif ( !$orgfile_stats && $delivered_stats ) {
241 # This is not an error if we have a solver and did not build the
242 # module!
243 } elsif ( !$orgfile_stats && !$delivered_stats ) {
244 # This is not necessarily an error.
245 # Instead, this seems to be an error of the deliver.log file.

--- 23 unchanged lines hidden (view full) ---

269 return 2
270 } else {
271 return 0;
272 }
273}
274
275sub print_logged
276# Print routine.
277# If a log file name is specified with '-l' option, print_logged() prints to that file
277# If a log file name is specified with '-l' option, print_logged() prints to that file
278# as well as to STDOUT. If '-l' option is not set, print_logged() just writes to STDOUT
279{
280 my $message = shift;
281 print "$message";
282 if ( $logfile ) {
283 open ( LOGFILE, ">> $logfile" ) or die "Can't open logfile '$logfile'\n";
284 print LOGFILE "$message";
285 close ( LOGFILE) ;

--- 8 unchanged lines hidden (view full) ---

294 print STDERR "Usage: checkdeliver.pl [-h] [-p <platform>]\n";
295 print STDERR "Compares delivered files on solver with original ones in build tree\n";
296 print STDERR "Options:\n";
297 print STDERR " -h print this usage message\n";
298 print STDERR " -p platform specify platform\n";
299
300 exit $retval;
301}
278# as well as to STDOUT. If '-l' option is not set, print_logged() just writes to STDOUT
279{
280 my $message = shift;
281 print "$message";
282 if ( $logfile ) {
283 open ( LOGFILE, ">> $logfile" ) or die "Can't open logfile '$logfile'\n";
284 print LOGFILE "$message";
285 close ( LOGFILE) ;

--- 8 unchanged lines hidden (view full) ---

294 print STDERR "Usage: checkdeliver.pl [-h] [-p <platform>]\n";
295 print STDERR "Compares delivered files on solver with original ones in build tree\n";
296 print STDERR "Options:\n";
297 print STDERR " -h print this usage message\n";
298 print STDERR " -p platform specify platform\n";
299
300 exit $retval;
301}
302