downloadsigner.pm (9780544f) downloadsigner.pm (b274bc22)
1#**************************************************************
2#
3# Licensed to the Apache Software Foundation (ASF) under one
4# or more contributor license agreements. See the NOTICE file
5# distributed with this work for additional information
6# regarding copyright ownership. The ASF licenses this file
7# to you under the Apache License, Version 2.0 (the
8# "License"); you may not use this file except in compliance

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

82}
83
84#####################################
85# Reading parameter
86#####################################
87
88sub getparameter
89{
1#**************************************************************
2#
3# Licensed to the Apache Software Foundation (ASF) under one
4# or more contributor license agreements. See the NOTICE file
5# distributed with this work for additional information
6# regarding copyright ownership. The ASF licenses this file
7# to you under the Apache License, Version 2.0 (the
8# "License"); you may not use this file except in compliance

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

82}
83
84#####################################
85# Reading parameter
86#####################################
87
88sub getparameter
89{
90 # installer::logger::print_message("Checking parameter");
91
92 while ( $#ARGV >= 0 )
93 {
94 my $param = shift(@ARGV);
95
96 if ($param eq "-d") { $installer::globals::followmeinfofilename = shift(@ARGV); }
97 elsif ($param eq "-pw") { $installer::globals::pwfile = shift(@ARGV); }
98 elsif ($param eq "-pfx") { $installer::globals::pfxfile = shift(@ARGV); }
99 elsif ($param eq "-sign") { $installer::globals::dosign = 1; }

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

187 installer::systemactions::create_directory_structure($temppath);
188 }
189 else
190 {
191 installer::logger::print_error( "Error: TMP and TEMP not defined. This is required for this process.\n" );
192 usage();
193 exit(-1);
194 }
90 while ( $#ARGV >= 0 )
91 {
92 my $param = shift(@ARGV);
93
94 if ($param eq "-d") { $installer::globals::followmeinfofilename = shift(@ARGV); }
95 elsif ($param eq "-pw") { $installer::globals::pwfile = shift(@ARGV); }
96 elsif ($param eq "-pfx") { $installer::globals::pfxfile = shift(@ARGV); }
97 elsif ($param eq "-sign") { $installer::globals::dosign = 1; }

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

185 installer::systemactions::create_directory_structure($temppath);
186 }
187 else
188 {
189 installer::logger::print_error( "Error: TMP and TEMP not defined. This is required for this process.\n" );
190 usage();
191 exit(-1);
192 }
193
194 $installer::logger::Info->print("\n");
195 $installer::logger::Info->printf("\n... using output path: %s ...\n", $temppath);
195
196
196 installer::logger::print_message( "\n... using output path: $temppath ...\n" );
197
198 push(@installer::globals::removedirs, $temppath);
199
200 return $temppath;
201}
202
203#############################################
204# Setting output pathes to temp directory
205# This are the:

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

221# Value is always saved in
222# $installer::globals::lastminor
223# which is saved in the follow_me file
224#############################################
225
226sub set_minor_into_pathes
227{
228 my ($followmeinfohash, $temppath) = @_;
197 push(@installer::globals::removedirs, $temppath);
198
199 return $temppath;
200}
201
202#############################################
203# Setting output pathes to temp directory
204# This are the:

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

220# Value is always saved in
221# $installer::globals::lastminor
222# which is saved in the follow_me file
223#############################################
224
225sub set_minor_into_pathes
226{
227 my ($followmeinfohash, $temppath) = @_;
228
229 $installer::logger::Info->print("\n");
230 $installer::logger::Info->printf("... forcing into minor: %s ...\n", $installer::globals::lastminor);
229
231
230 installer::logger::print_message( "\n... forcing into minor: $installer::globals::lastminor ...\n" );
231
232 my @pathnames = ("bin", "doc", "inc", "lib", "pck", "res", "xml");
233 my $sourcename = "src";
234 my $srcpath = $installer::globals::separator . $sourcename . $installer::globals::separator;
235
236 if ( $installer::globals::minor ne "" )
237 {
232 my @pathnames = ("bin", "doc", "inc", "lib", "pck", "res", "xml");
233 my $sourcename = "src";
234 my $srcpath = $installer::globals::separator . $sourcename . $installer::globals::separator;
235
236 if ( $installer::globals::minor ne "" )
237 {
238 installer::logger::print_message( "\n... already defined minor: $installer::globals::minor -> ignoring parameter \"-useminor\" ...\n" );
238 $installer::logger::Info->print("\n");
239 $installer::logger::Info->printf("... already defined minor: %s -> ignoring parameter \"-useminor\" ...\n" , $installer::globals::minor);
239 return;
240 }
241
242 # Affected pathes:
243 # $contenthash{'installlogdir'}
244 # $contenthash{'includepatharray'}
245 # $installer::globals::unpackpath
246 # $installer::globals::idttemplatepath
247 # $installer::globals::idtlanguagepath
248
249 installer::logger::include_header_into_logfile("Changing saved pathes to add the minor");
240 return;
241 }
242
243 # Affected pathes:
244 # $contenthash{'installlogdir'}
245 # $contenthash{'includepatharray'}
246 # $installer::globals::unpackpath
247 # $installer::globals::idttemplatepath
248 # $installer::globals::idtlanguagepath
249
250 installer::logger::include_header_into_logfile("Changing saved pathes to add the minor");
250 my $infoline = "Old pathes:\n";
251 push( @installer::globals::logfileinfo, $infoline);
252 $infoline = "\$followmeinfohash->{'installlogdir'}: $followmeinfohash->{'installlogdir'}\n";
253 push( @installer::globals::logfileinfo, $infoline);
254 $infoline = "\$installer::globals::unpackpath: $installer::globals::unpackpath\n";
255 push( @installer::globals::logfileinfo, $infoline);
256 $infoline = "\$installer::globals::idttemplatepath: $installer::globals::idttemplatepath\n";
257 push( @installer::globals::logfileinfo, $infoline);
258 $infoline = "\$installer::globals::idtlanguagepath: $installer::globals::idtlanguagepath\n";
259 push( @installer::globals::logfileinfo, $infoline);
260 $infoline = "Include pathes:\n";
261 push( @installer::globals::logfileinfo, $infoline);
262 foreach my $path ( @{$followmeinfohash->{'includepatharray'}} ) { push( @installer::globals::logfileinfo, $path); }
251 $installer::logger::Lang->print("Old pathes:\n");
252 $installer::logger::Lang->printf("\$followmeinfohash->{'installlogdir'}: %s\n", $followmeinfohash->{'installlogdir'});
253 $installer::logger::Lang->printf("\$installer::globals::unpackpath: %s\n", $installer::globals::unpackpath);
254 $installer::logger::Lang->printf("\$installer::globals::idttemplatepath: %s\n", $installer::globals::idttemplatepath);
255 $installer::logger::Lang->printf("\$installer::globals::idtlanguagepath: %s\n", $installer::globals::idtlanguagepath);
256 $installer::logger::Lang->printf("Include pathes:\n");
257 foreach my $path ( @{$followmeinfohash->{'includepatharray'}} )
258 {
259 $installer::logger::Lang->print($path);
260 }
263
264 foreach $onepath ( @pathnames )
265 {
266 my $oldvalue = $installer::globals::separator . $onepath . $installer::globals::separator;
267 my $newvalue = $installer::globals::separator . $onepath . "\." . $installer::globals::lastminor . $installer::globals::separator;
268
269 if (( $followmeinfohash->{'installlogdir'} =~ /\Q$oldvalue\E/ ) && ( ! ( $followmeinfohash->{'installlogdir'} =~ /\Q$srcpath\E/ ))) { $followmeinfohash->{'installlogdir'} =~ s/\Q$oldvalue\E/$newvalue/; }
270 if (( $installer::globals::unpackpath =~ /\Q$oldvalue\E/ ) && ( ! ( $installer::globals::unpackpath =~ /\Q$srcpath\E/ ))) { $installer::globals::unpackpath =~ s/\Q$oldvalue\E/$newvalue/; }

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

297 my $newsrcpath = $installer::globals::separator . $sourcename . "\." . $installer::globals::lastminor . $installer::globals::separator;
298
299 if ( $followmeinfohash->{'installlogdir'} =~ /\Q$srcpath\E/ ) { $followmeinfohash->{'installlogdir'} =~ s/\Q$srcpath\E/$newsrcpath/; }
300 if ( $installer::globals::unpackpath =~ /\Q$srcpath\E/ ) { $installer::globals::unpackpath =~ s/\Q$srcpath\E/$newsrcpath/; }
301 if ( $installer::globals::idttemplatepath =~ /\Q$srcpath\E/ ) { $installer::globals::idttemplatepath =~ s/\Q$srcpath\E/$newsrcpath/; }
302 if ( $installer::globals::idtlanguagepath =~ /\Q$srcpath\E/ ) { $installer::globals::idtlanguagepath =~ s/\Q$srcpath\E/$newsrcpath/; }
303 foreach my $path ( @{$followmeinfohash->{'includepatharray'}} ) { if ( $path =~ /\Q$srcpath\E/ ) { $path =~ s/\Q$srcpath\E/$newsrcpath/; } }
304
261
262 foreach $onepath ( @pathnames )
263 {
264 my $oldvalue = $installer::globals::separator . $onepath . $installer::globals::separator;
265 my $newvalue = $installer::globals::separator . $onepath . "\." . $installer::globals::lastminor . $installer::globals::separator;
266
267 if (( $followmeinfohash->{'installlogdir'} =~ /\Q$oldvalue\E/ ) && ( ! ( $followmeinfohash->{'installlogdir'} =~ /\Q$srcpath\E/ ))) { $followmeinfohash->{'installlogdir'} =~ s/\Q$oldvalue\E/$newvalue/; }
268 if (( $installer::globals::unpackpath =~ /\Q$oldvalue\E/ ) && ( ! ( $installer::globals::unpackpath =~ /\Q$srcpath\E/ ))) { $installer::globals::unpackpath =~ s/\Q$oldvalue\E/$newvalue/; }

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

295 my $newsrcpath = $installer::globals::separator . $sourcename . "\." . $installer::globals::lastminor . $installer::globals::separator;
296
297 if ( $followmeinfohash->{'installlogdir'} =~ /\Q$srcpath\E/ ) { $followmeinfohash->{'installlogdir'} =~ s/\Q$srcpath\E/$newsrcpath/; }
298 if ( $installer::globals::unpackpath =~ /\Q$srcpath\E/ ) { $installer::globals::unpackpath =~ s/\Q$srcpath\E/$newsrcpath/; }
299 if ( $installer::globals::idttemplatepath =~ /\Q$srcpath\E/ ) { $installer::globals::idttemplatepath =~ s/\Q$srcpath\E/$newsrcpath/; }
300 if ( $installer::globals::idtlanguagepath =~ /\Q$srcpath\E/ ) { $installer::globals::idtlanguagepath =~ s/\Q$srcpath\E/$newsrcpath/; }
301 foreach my $path ( @{$followmeinfohash->{'includepatharray'}} ) { if ( $path =~ /\Q$srcpath\E/ ) { $path =~ s/\Q$srcpath\E/$newsrcpath/; } }
302
305 $infoline = "\nNew pathes:\n";
306 push( @installer::globals::logfileinfo, $infoline);
307 $infoline = "\$followmeinfohash->{'installlogdir'}: $followmeinfohash->{'installlogdir'}\n";
308 push( @installer::globals::logfileinfo, $infoline);
309 $infoline = "\$installer::globals::unpackpath: $installer::globals::unpackpath\n";
310 push( @installer::globals::logfileinfo, $infoline);
311 $infoline = "\$installer::globals::idttemplatepath: $installer::globals::idttemplatepath\n";
312 push( @installer::globals::logfileinfo, $infoline);
313 $infoline = "\$installer::globals::idtlanguagepath: $installer::globals::idtlanguagepath\n";
314 push( @installer::globals::logfileinfo, $infoline);
315 $infoline = "Include pathes:\n";
316 push( @installer::globals::logfileinfo, $infoline);
317 foreach my $path ( @{$followmeinfohash->{'includepatharray'}} ) { push( @installer::globals::logfileinfo, $path); }
303 $installer::logger::Lang->print("\n");
304 $installer::logger::Lang->print("New pathes:\n");
305 $installer::logger::Lang->printf("\$followmeinfohash->{'installlogdir'}: %s\n", $followmeinfohash->{'installlogdir'});
306 $installer::logger::Lang->printf("\$installer::globals::unpackpath: %s\n", $installer::globals::unpackpath);
307 $installer::logger::Lang->printf("\$installer::globals::idttemplatepath: %s\n", $installer::globals::idttemplatepath);
308 $installer::logger::Lang->printf("\$installer::globals::idtlanguagepath: %s\n", $installer::globals::idtlanguagepath);
309 $installer::logger::Lang->printf("Include pathes:\n");
310 foreach my $path ( @{$followmeinfohash->{'includepatharray'}} )
311 {
312 $installer::logger::Lang->print($path);
313 }
318}
319
320#############################################
321# Setting the name of the log file
322#############################################
323
324sub setlogfilename
325{

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

375#########################################################
376# Publishing the content of the product list
377#########################################################
378
379sub publishproductlist
380{
381 my ($infofilelist) = @_;
382
314}
315
316#############################################
317# Setting the name of the log file
318#############################################
319
320sub setlogfilename
321{

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

371#########################################################
372# Publishing the content of the product list
373#########################################################
374
375sub publishproductlist
376{
377 my ($infofilelist) = @_;
378
383 installer::logger::print_message( "\n... found products: ...\n" );
379 $installer::logger::Info->print("\n");
380 $installer::logger::Info->printf("... found products: ...\n");
384
385 for ( my $i = 0; $i <= $#{$infofilelist}; $i++ )
386 {
387 my $onefile = ${$infofilelist}[$i];
388 installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$onefile);
381
382 for ( my $i = 0; $i <= $#{$infofilelist}; $i++ )
383 {
384 my $onefile = ${$infofilelist}[$i];
385 installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$onefile);
389 installer::logger::print_message( "...... $onefile ...\n" );
386 $installer::logger::Info->printf("...... $onefile ...\n");
390 }
391
387 }
388
392 installer::logger::print_message( "\n" );
389 $installer::logger::Info->printf("\n");
393}
394
395#########################################################
396# Filtering all files, that have correct minor
397# and work stamp.
398# Master: follow_me_4_DEV300_m40_en-US.log
399#########################################################
400

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

464 if ( -f $installer::globals::followmeinfofilename )
465 {
466 push(@infofilelist, $installer::globals::followmeinfofilename);
467 # Saving info, that this is a file
468 $installer::globals::followme_from_directory = 0;
469 }
470 elsif ( -d $installer::globals::followmeinfofilename )
471 {
390}
391
392#########################################################
393# Filtering all files, that have correct minor
394# and work stamp.
395# Master: follow_me_4_DEV300_m40_en-US.log
396#########################################################
397

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

461 if ( -f $installer::globals::followmeinfofilename )
462 {
463 push(@infofilelist, $installer::globals::followmeinfofilename);
464 # Saving info, that this is a file
465 $installer::globals::followme_from_directory = 0;
466 }
467 elsif ( -d $installer::globals::followmeinfofilename )
468 {
472 installer::logger::print_message( "\n... reading directory: $installer::globals::followmeinfofilename ...\n" );
469 $installer::logger::Info->printf("\n");
470 $installer::logger::Info->printf("... reading directory: %s ...\n", $installer::globals::followmeinfofilename);
473 $installer::globals::followmeinfofilename =~ s/$installer::globals::separator\s*$//;
474 my $allfollowmefiles = installer::systemactions::find_file_with_file_extension("log", $installer::globals::followmeinfofilename);
475
476 if ( ! ( $#{$allfollowmefiles} > -1 ))
477 {
478 installer::logger::print_error( "Error: Nothing to do! No follow-me file in directory \"$installer::globals::followmeinfofilename\"!.\n" );
479 usage();
480 exit(-1);

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

541#############################################
542# Logging the content of the download hash
543#############################################
544
545sub logfollowmeinfohash
546{
547 my ( $followmehash ) = @_;
548
471 $installer::globals::followmeinfofilename =~ s/$installer::globals::separator\s*$//;
472 my $allfollowmefiles = installer::systemactions::find_file_with_file_extension("log", $installer::globals::followmeinfofilename);
473
474 if ( ! ( $#{$allfollowmefiles} > -1 ))
475 {
476 installer::logger::print_error( "Error: Nothing to do! No follow-me file in directory \"$installer::globals::followmeinfofilename\"!.\n" );
477 usage();
478 exit(-1);

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

539#############################################
540# Logging the content of the download hash
541#############################################
542
543sub logfollowmeinfohash
544{
545 my ( $followmehash ) = @_;
546
549 print "\n*****************************************\n";
550 print "Content of follow-me info file:\n";
551 print "finalinstalldir: $followmehash->{'finalinstalldir'}\n";
552 print "downloadname: $followmehash->{'downloadname'}\n";
553 print "languagestring: $followmehash->{'languagestring'}\n";
554 foreach my $lang ( @{$followmehash->{'languagesarray'}} ) { print "languagesarray: $lang\n"; }
555 foreach my $path ( @{$followmehash->{'includepatharray'}} ) { print "includepatharray: $path"; }
556 foreach my $key ( sort keys %{$followmehash->{'allvariableshash'}} ) { print "allvariableshash: $key : $followmehash->{'allvariableshash'}->{$key}\n"; }
547 $installer::logger::Info->printf("\n");
548 $installer::logger::Info->printf("*****************************************\n");
549 $installer::logger::Info->printf("Content of follow-me info file:\n");
550 $installer::logger::Info->printf("finalinstalldir: %s\n", $followmehash->{'finalinstalldir'});
551 $installer::logger::Info->printf("downloadname: %s\n", $followmehash->{'downloadname'});
552 $installer::logger::Info->printf("languagestring: %s\n", $followmehash->{'languagestring'});
553 foreach my $lang ( @{$followmehash->{'languagesarray'}} )
554 {
555 $installer::logger::Info->printf("languagesarray: %s\n", $lang);
556 }
557 foreach my $path ( @{$followmehash->{'includepatharray'}} )
558 {
559 $installer::logger::Info->printf("includepatharray: %s\n", $path);
560 }
561 foreach my $key ( sort keys %{$followmehash->{'allvariableshash'}} )
562 {
563 $installer::logger::Info->printf("allvariableshash: %s : %s\n",
564 $key,
565 $followmehash->{'allvariableshash'}->{$key});
566 }
557}
558
559########################################################################
560# Renaming the follow me info file, if it was successfully used.
561# This can only be done, if the parameter "-d" was used with a
562# directory, not a name. In this case the repeated use of parameter
563# "-d" with this directory has to ignore this already successfully
564# used file.

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

569 my ( $filename ) = @_;
570
571 my $newfilename = $filename;
572 $newfilename =~ s/follow_me_/follow_me_success_/; # including "_success" after "follow_me"
573
574 if ( $filename ne $newfilename )
575 {
576 my $returnvalue = rename($filename, $newfilename);
567}
568
569########################################################################
570# Renaming the follow me info file, if it was successfully used.
571# This can only be done, if the parameter "-d" was used with a
572# directory, not a name. In this case the repeated use of parameter
573# "-d" with this directory has to ignore this already successfully
574# used file.

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

579 my ( $filename ) = @_;
580
581 my $newfilename = $filename;
582 $newfilename =~ s/follow_me_/follow_me_success_/; # including "_success" after "follow_me"
583
584 if ( $filename ne $newfilename )
585 {
586 my $returnvalue = rename($filename, $newfilename);
577 if ( $returnvalue ) { installer::logger::print_message( "\n... renamed file \"$filename\" to \"$newfilename\" ...\n" ); }
587 if ( $returnvalue )
588 {
589 $installer::logger::Info->printf("\n");
590 $installer::logger::Info->printf("... renamed file \"%s\" to \"%s\" ...\n", $filename, $newfilename);
591 }
578 }
579}
580
5811;
592 }
593}
594
5951;