diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2022-11-02 21:47:41 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2022-11-02 21:49:26 +0100 |
commit | 89022d5b6dc51e592e22bb8ff94c430ec14de17c (patch) | |
tree | 5138b04878787a5530b557cffedad10d4cbaeaa6 /solenv | |
parent | 698e56cf1fd453c4e175c762c3d427c52e68920a (diff) |
Try to fix "ERROR: Directory with flag ISINSTALLLOCATION not set!"
This is a regression after my recent changes to Perl code in installer,
most likely commit 8c6467a785037309d2a2cec56c8e38cf52da0aee, like seen
at https://ci.libreoffice.org/job/lo_daily_tb_win/1213/consoleFull:
> ERROR: Failure in installer.pm
> ERROR: ERROR: Directory with flag ISINSTALLLOCATION not set! at C:/cygwin/home/tdf/jenkins/daily_workspace/tb/src_master/solenv/bin/modules/installer/windows/directory.pm line 334.
I can't repro this problem locally; but as Stephan Bergmann noted,
the mentioned commit changed logic so that a piece of code started
to only execute for CREATE style, where previously it run always.
This tries to re-create the logic prior to the mentioned commit.
Change-Id: I01af06d58b26222bee6220cb9be61cf71940930f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142152
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'solenv')
-rw-r--r-- | solenv/bin/modules/installer/scriptitems.pm | 117 |
1 files changed, 74 insertions, 43 deletions
diff --git a/solenv/bin/modules/installer/scriptitems.pm b/solenv/bin/modules/installer/scriptitems.pm index 0057d47c82e8..97b76a503f6a 100644 --- a/solenv/bin/modules/installer/scriptitems.pm +++ b/solenv/bin/modules/installer/scriptitems.pm @@ -1575,54 +1575,92 @@ sub optimize_list return join(",", sort keys %tmpHash); } -#################################################### -# Recursively add a directory with CREATE flag -#################################################### +############################################################################### +# Add a directory with CREATE flag; save styles for already added directories +############################################################################### -sub recursive_add_directory_with_create_flag_hash +sub add_directory_with_create_flag_hash { my ($alldirectoryhash, $directoryname, $specificlanguage, $gid, $styles, $modules) = @_; - if ( ! $directoryname ) { installer::exiter::exit_program("No directory name (HostName) set for specified language in gid $gid", "recursive_add_directory_with_create_flag_hash"); } - if ( ! $modules ) { installer::exiter::exit_program("No assigned modules found for directory $directoryname", "recursive_add_directory_with_create_flag_hash"); } - - if (!exists($alldirectoryhash->{$directoryname})) + if ( ! $directoryname ) { installer::exiter::exit_program("No directory name (HostName) set for specified language in gid $gid", "add_directory_with_create_flag_hash"); } + my $origdirectoryname = $directoryname; + my $newdirincluded = 0; + if ( $styles =~ /\bCREATE\b/ ) { - my %directoryhash = (); - $directoryhash{'HostName'} = $directoryname; - $directoryhash{'specificlanguage'} = $specificlanguage; - $directoryhash{'Dir'} = $gid; - $directoryhash{'Styles'} = $styles; + if ( ! $modules ) { installer::exiter::exit_program("No assigned modules found for directory $directoryname", "add_directory_with_create_flag_hash"); } + if (!(exists($alldirectoryhash->{$directoryname}))) + { + my %directoryhash = (); + $directoryhash{'HostName'} = $directoryname; + $directoryhash{'specificlanguage'} = $specificlanguage; + $directoryhash{'Dir'} = $gid; + $directoryhash{'Styles'} = $styles; + + # saving also the modules + $directoryhash{'modules'} = $modules; + + $alldirectoryhash->{$directoryname} = \%directoryhash; + $newdirincluded = 1; + + # Problem: The $destinationpath can be share/registry/schema/org/openoffice + # but not all directories contain files and will be added to this list. + # Therefore the path has to be analyzed. + + while ( $directoryname =~ /(^.*\S)\Q$installer::globals::separator\E(\S.*?)\s*$/ ) # as long as the path contains slashes + { + $directoryname = $1; + + if (!(exists($alldirectoryhash->{$directoryname}))) + { + my %directoryhash = (); + + $directoryhash{'HostName'} = $directoryname; + $directoryhash{'specificlanguage'} = $specificlanguage; + $directoryhash{'Dir'} = $gid; + if ( ! $installer::globals::iswindowsbuild ) { $directoryhash{'Styles'} = "(CREATE)"; } # Exception for Windows? - # saving also the modules - $directoryhash{'modules'} = $modules; + # saving also the modules + $directoryhash{'modules'} = $modules; - $alldirectoryhash->{$directoryname} = \%directoryhash; + $alldirectoryhash->{$directoryname} = \%directoryhash; + } + else + { + # Adding the modules to the module list! + $alldirectoryhash->{$directoryname}->{'modules'} = $alldirectoryhash->{$directoryname}->{'modules'} . "," . $modules; + } + } + } + else + { + # Adding the modules to the module list! + $alldirectoryhash->{$directoryname}->{'modules'} = $alldirectoryhash->{$directoryname}->{'modules'} . "," . $modules; + + while ( $directoryname =~ /(^.*\S)\Q$installer::globals::separator\E(\S.*?)\s*$/ ) # as long as the path contains slashes + { + $directoryname = $1; + # Adding the modules to the module list! + $alldirectoryhash->{$directoryname}->{'modules'} = $alldirectoryhash->{$directoryname}->{'modules'} . "," . $modules; + } + } } - else + + # Saving the styles for already added directories in function collect_directories_from_filesarray + + if (( ! $newdirincluded ) && ( $styles ne "" )) { - # Saving the styles for already added directories in function collect_directories_from_filesarray $styles =~ s/\bWORKSTATION\b//; $styles =~ s/\bCREATE\b//; if (( ! ( $styles =~ /^\s*\(\s*\)\s*$/ )) && ( ! ( $styles =~ /^\s*\(\s*\,\s*\)\s*$/ )) && ( ! ( $styles =~ /^\s*$/ ))) # checking, if there are styles left { - $alldirectoryhash->{$directoryname}->{'Styles'} = $styles; - } - - # Adding the modules to the module list! - $alldirectoryhash->{$directoryname}->{'modules'} = $alldirectoryhash->{$directoryname}->{'modules'} . "," . $modules; - } - - # Problem: The $destinationpath can be share/registry/schema/org/openoffice - # but not all directories contain files and will be added to this list. - # Therefore the path has to be analyzed. + $directoryname = $origdirectoryname; - if ( $directoryname =~ /(^.*\S)\Q$installer::globals::separator\E(\S.*?)\s*$/ ) # if the path contains slashes - { - $directoryname = $1; - my $innerstyles; - if ( ! $installer::globals::iswindowsbuild ) { $innerstyles = "(CREATE)"; } # Exception for Windows? - $alldirectoryhash = recursive_add_directory_with_create_flag_hash($alldirectoryhash, $directoryname, $specificlanguage, $gid, $innerstyles, $modules); + if ( exists($alldirectoryhash->{$directoryname}) ) + { + $alldirectoryhash->{$directoryname}->{'Styles'} = $styles; + } + } } return $alldirectoryhash; @@ -1663,7 +1701,7 @@ sub collect_directories_from_filesarray { my $sourcepath = $onefile->{'sourcepath'}; # Do the same as collect_directories_with_create_flag_from_directoryarray does - %alldirectoryhash = %{recursive_add_directory_with_create_flag_hash(\%alldirectoryhash, $onefile->{'destination'}, $onefile->{'specificlanguage'}, $onefile->{'gid'}, "(CREATE)", $onefile->{'modules'})}; + %alldirectoryhash = %{add_directory_with_create_flag_hash(\%alldirectoryhash, $onefile->{'destination'}, $onefile->{'specificlanguage'}, $onefile->{'gid'}, "(CREATE)", $onefile->{'modules'})}; next; } @@ -1726,14 +1764,7 @@ sub collect_directories_with_create_flag_from_directoryarray for ( my $i = 0; $i <= $#{$directoryarrayref}; $i++ ) { my $onedir = ${$directoryarrayref}[$i]; - my $styles = ""; - - if ( $onedir->{'Styles'} ) { $styles = $onedir->{'Styles'}; } - - if ( $styles =~ /\bCREATE\b/ ) - { - $alldirectoryhash = recursive_add_directory_with_create_flag_hash($alldirectoryhash, $onedir->{'HostName'}, $onedir->{'specificlanguage'}, $onedir->{'gid'}, $onedir->{'Styles'}, $onedir->{'modules'}); - } + $alldirectoryhash = add_directory_with_create_flag_hash($alldirectoryhash, $onedir->{'HostName'}, $onedir->{'specificlanguage'}, $onedir->{'gid'}, $onedir->{'Styles'}, $onedir->{'modules'}); } # Creating directory array |