diff options
author | Petr Mladek <pmladek@suse.cz> | 2013-01-08 14:46:27 +0100 |
---|---|---|
committer | Petr Mladek <pmladek@suse.cz> | 2013-01-08 14:48:54 +0100 |
commit | cf24316f4b07b0a4a0ae3c1a7e8214e1630982f8 (patch) | |
tree | f38882b1fe595abe433ebbafa969f4695be1786b /solenv | |
parent | ba558a26bc93c0200d7d8bcc19a6e201d69792e4 (diff) |
clean up of the code that defines the download file names
Change-Id: I3241801d49673cac33eb923fb986c6ceb2c39503
Diffstat (limited to 'solenv')
-rw-r--r-- | solenv/bin/modules/installer/download.pm | 53 |
1 files changed, 32 insertions, 21 deletions
diff --git a/solenv/bin/modules/installer/download.pm b/solenv/bin/modules/installer/download.pm index 9a8ae381efb7..21bd62ff0b75 100644 --- a/solenv/bin/modules/installer/download.pm +++ b/solenv/bin/modules/installer/download.pm @@ -431,57 +431,64 @@ sub get_download_architecture } ######################################################### -# Setting the installation type for the download name +# Setting the content type for the download name ######################################################### -sub get_install_type +sub get_download_content { my ($allvariables) = @_; - my $type = ""; + my $content = ""; # content type included in the installer if ( $installer::globals::isrpmbuild ) { - $type .= "rpm"; + $content = "rpm"; } elsif ( $installer::globals::isdebbuild ) { - $type .= "deb"; + $content = "deb"; } elsif ( $installer::globals::packageformat eq "archive" ) { - $type .= "archive"; + $content = "archive"; } - $type .= "_" if ($type); + return $content; +} + +######################################################### +# Setting the functionality type for the download name +######################################################### + +sub get_download_functionality +{ + my ($allvariables) = @_; + + my $functionality = ""; - # functionality type if ( $installer::globals::languagepack ) { - $type .= "langpack"; + $functionality = "langpack"; } elsif ( $installer::globals::helppack ) { - $type .= "helppack"; + $functionality = "helppack"; } elsif ( $allvariables->{'POSTVERSIONEXTENSION'} eq "SDK" ) { - $type .= "sdk"; + $functionality = "sdk"; } elsif ( $allvariables->{'POSTVERSIONEXTENSION'} eq "TEST" ) { - $type .= "test"; + $functionality = "test"; } elsif ( $allvariables->{'PRODUCTNAME'} eq "URE" ) { - $type .= "ure"; + $functionality = "ure"; } - # get rid of trailing _ if functionality type was not set - $type =~ s/\_$//; - - return $type; + return $functionality; } ############################################################################################### @@ -498,21 +505,25 @@ sub set_download_filename my $versionstring = get_download_version($allvariables); my $platform = get_download_platformname(); my $architecture = get_download_architecture(); - my $type = get_install_type($allvariables); + my $content = get_download_content($allvariables); + my $functionality = get_download_functionality($allvariables); my $language = get_downloadname_language($languagestringref); # Setting the extension happens automatically - my $filename = $start . "_" . $versionstring . "_" . "_" . $platform . "_" . $architecture . "_" . $type . "_" . $language; + my $filename = $start . "_" . $versionstring . "_" . $platform . "_" . $architecture . "_" . $content . "_" . $functionality . "_" . $language; - $filename =~ s/\_\_/\_/g; # necessary, if $versionstring or $platform or $language are empty - $filename =~ s/\_\s*$//; # necessary, if $language and $addon are empty + # get rid of duplicit "_" delimiters when some strings are empty + $filename =~ s/\_\_\_/\_/g; + $filename =~ s/\_\_/\_/g; + $filename =~ s/\_\s*$//; $installer::globals::ooodownloadfilename = $filename; return $filename; } + ######################################################### # Creating a tar.gz file ######################################################### |