Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package yast2-http-server for openSUSE:Factory checked in at 2022-09-17 20:10:10 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-http-server (Old) and /work/SRC/openSUSE:Factory/.yast2-http-server.new.2083 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-http-server" Sat Sep 17 20:10:10 2022 rev:99 rq:1004078 version:4.5.1 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-http-server/yast2-http-server.changes 2022-04-14 17:25:24.931259886 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-http-server.new.2083/yast2-http-server.changes 2022-09-17 20:10:11.353130771 +0200 @@ -1,0 +2,7 @@ +Wed Jul 27 09:43:03 UTC 2022 - Michal Filka <mfi...@suse.com> + +- bsc#1200016 + - find out php version dynamically to avoid hardcoded version +- 4.5.1 + +------------------------------------------------------------------- Old: ---- yast2-http-server-4.5.0.tar.bz2 New: ---- yast2-http-server-4.5.1.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-http-server.spec ++++++ --- /var/tmp/diff_new_pack.5dGaAI/_old 2022-09-17 20:10:11.817132110 +0200 +++ /var/tmp/diff_new_pack.5dGaAI/_new 2022-09-17 20:10:11.829132144 +0200 @@ -17,7 +17,7 @@ Name: yast2-http-server -Version: 4.5.0 +Version: 4.5.1 Release: 0 Summary: YaST2 - HTTP Server Configuration License: GPL-2.0-only ++++++ yast2-http-server-4.5.0.tar.bz2 -> yast2-http-server-4.5.1.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-http-server-4.5.0/package/yast2-http-server.changes new/yast2-http-server-4.5.1/package/yast2-http-server.changes --- old/yast2-http-server-4.5.0/package/yast2-http-server.changes 2022-04-12 13:34:34.000000000 +0200 +++ new/yast2-http-server-4.5.1/package/yast2-http-server.changes 2022-09-16 12:09:46.000000000 +0200 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Wed Jul 27 09:43:03 UTC 2022 - Michal Filka <mfi...@suse.com> + +- bsc#1200016 + - find out php version dynamically to avoid hardcoded version +- 4.5.1 + +------------------------------------------------------------------- Wed Apr 06 13:24:58 UTC 2022 - Ladislav Slez??k <lsle...@suse.cz> - Bump version to 4.5.0 (bsc#1198109) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-http-server-4.5.0/package/yast2-http-server.spec new/yast2-http-server-4.5.1/package/yast2-http-server.spec --- old/yast2-http-server-4.5.0/package/yast2-http-server.spec 2022-04-12 13:34:34.000000000 +0200 +++ new/yast2-http-server-4.5.1/package/yast2-http-server.spec 2022-09-16 12:09:46.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-http-server -Version: 4.5.0 +Version: 4.5.1 Release: 0 Summary: YaST2 - HTTP Server Configuration License: GPL-2.0-only diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-http-server-4.5.0/src/Makefile.am new/yast2-http-server-4.5.1/src/Makefile.am --- old/yast2-http-server-4.5.0/src/Makefile.am 2022-04-12 13:34:34.000000000 +0200 +++ new/yast2-http-server-4.5.1/src/Makefile.am 2022-09-16 12:09:46.000000000 +0200 @@ -2,7 +2,8 @@ module_DATA = \ modules/HttpServer.rb \ - modules/HttpServerWidgets.rb + modules/HttpServerWidgets.rb \ + modules/HttpServerPackages.rb module1dir = @moduledir@/YaPI module1_DATA = \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-http-server-4.5.0/src/modules/HttpServer.rb new/yast2-http-server-4.5.1/src/modules/HttpServer.rb --- old/yast2-http-server-4.5.0/src/modules/HttpServer.rb 2022-04-12 13:34:34.000000000 +0200 +++ new/yast2-http-server-4.5.1/src/modules/HttpServer.rb 2022-09-16 12:09:46.000000000 +0200 @@ -41,6 +41,7 @@ Yast.import "FileChanges" Yast.import "Label" Yast.import "Mode" + Yast.import "PackageSystem" # Abort function # return boolean return true if abort @@ -181,6 +182,7 @@ return false if !NetworkService.ConfirmNetworkManager Progress.NextStep + init_packager # check rpms required = deep_copy(@required_packages) @@ -226,8 +228,6 @@ return false end - - Progress.NextStep @@ -845,6 +845,12 @@ private + # Makes sure the package database is initialized. + def init_packager + PackageSystem.EnsureTargetInit + PackageSystem.EnsureSourceInit + end + def backup_vhost_config return if @vhost_files_to_backup.empty? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-http-server-4.5.0/src/modules/HttpServerPackages.rb new/yast2-http-server-4.5.1/src/modules/HttpServerPackages.rb --- old/yast2-http-server-4.5.0/src/modules/HttpServerPackages.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-http-server-4.5.1/src/modules/HttpServerPackages.rb 2022-09-16 12:09:46.000000000 +0200 @@ -0,0 +1,55 @@ +# *************************************************************************** +# +# Copyright (c) 2002 - 2012 Novell, Inc. +# All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of version 2 of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, contact Novell, Inc. +# +# To contact Novell about this file by physical or electronic mail, +# you may find current contact information at www.novell.com +# +# *************************************************************************** +require "yast" +require "y2packager/resolvable" + +module Yast + class HttpServerPackagesClass < Module + include Yast::Logger + + def main + textdomain "base" + end + + # Tries to find a package according to the pattern + # + # @param pattern [String] a regex pattern to match, no escaping done + # @return list of matching package names + def by_provides_regexp(pattern) + raise ArgumentError, "Missing search pattern" if pattern.nil? || pattern.empty? + + # NOTE: - Resolvable.find takes POSIX regexp, later select uses Ruby regexp + # - Resolvable.find supports regexps only for dependencies, so we need to + # filter result according to package name + Y2Packager::Resolvable.find( kind: :package, provides_regexp: "^#{pattern}$") + .select { |p| p.name =~ /\A#{pattern}\z/ } + .map(&:name) + .uniq + end + + publish function: :by_provides_regexp, type: "list <string> (string)" + + end + + HttpServerPackages = HttpServerPackagesClass.new + HttpServerPackages.main +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-http-server-4.5.0/src/modules/YaPI/HTTPD.pm new/yast2-http-server-4.5.1/src/modules/YaPI/HTTPD.pm --- old/yast2-http-server-4.5.0/src/modules/YaPI/HTTPD.pm 2022-04-12 13:34:34.000000000 +0200 +++ new/yast2-http-server-4.5.1/src/modules/YaPI/HTTPD.pm 2022-09-16 12:09:46.000000000 +0200 @@ -747,8 +747,8 @@ # VirtualByName and SSL get dropped/replaced if( $key->{KEY} eq 'VirtualByName' ) { $VirtualByName = $key->{VALUE}; - } -if( $key->{KEY} =~ /ServerTokens|TimeOut|ExtendedStatus/ ) { + } + if( $key->{KEY} =~ /ServerTokens|TimeOut|ExtendedStatus/ ) { # illegal keys in vhost return $self->SetError( summary => sprintf(__("Illegal key in virtual host '%s'."), $key->{KEY}), code => "CHECK_PARAM_FAILED" ); @@ -955,8 +955,9 @@ sub GetKnownModules { my $self = shift; my @ret = (); - foreach my $mod ( keys(%YaPI::HTTPDModules::modules) ) { - push( @ret, { name => $mod, %{$YaPI::HTTPDModules::modules{$mod}} } ); + my %modules = YaPI::HTTPDModules::ServerModules(); + foreach my $mod ( keys(%modules) ) { + push( @ret, { name => $mod, %{$modules{$mod}} } ); @ret = sort( { $a->{position} <=> $b->{position} } @ret ); } return \@ret; @@ -984,6 +985,7 @@ my $self = shift; my $newModules = shift; my $enable = shift; + my %modules = YaPI::HTTPDModules::ServerModules(); my @newList = (); if( not $enable ) { @@ -1001,8 +1003,8 @@ push( @oldList, $mod ); } @newList = sort( { - my $aa = (exists($YaPI::HTTPDModules::modules{$a}))?($YaPI::HTTPDModules::modules{$a}->{position}):(10000000); - my $bb = (exists($YaPI::HTTPDModules::modules{$b}))?($YaPI::HTTPDModules::modules{$b}->{position}):(10000000); + my $aa = (exists($modules{$a}))?($modules{$a}->{position}):(10000000); + my $bb = (exists($modules{$b}))?($modules{$b}->{position}):(10000000); $aa <=> $bb; } @oldList ); } @@ -1012,7 +1014,7 @@ my @known=(); my @unknown=(); foreach my $module (@newList){ - if (grep (/^$module$/, (keys %YaPI::HTTPDModules::modules))){ + if (grep (/^$module$/, (keys %modules))){ push(@known, $module); } else { push(@unknown, $module); @@ -1024,8 +1026,6 @@ foreach my $module (@newList){ SCR->Execute('.target.bash', "a2enmod $module"); } -# SCR->Write('.sysconfig.apache2.APACHE_MODULES', join(' ',@newList)); -# SCR->Write('.sysconfig.apache2', undef); return 1; } @@ -1062,67 +1062,6 @@ return \@ret; } -=item * -C<$selList = GetModuleSelectionsList()> - -this function returns a reference to an array that -contains strings with the names of the active module -selections. - -EXAMPLE - - my $selList = GetModuleSelectionsList(); - print "active selections: ".join(',', @$selList)."\n"; - -=cut - -#BEGIN { $TYPEINFO{GetModuleSelectionsList} = ["function", ["list","string"] ]; } -#sub GetModuleSelectionsList { -# my $self = shift; -# return (SCR->Read('.http_server.moduleselection'))[0]; -#} - -=item * -C<ModifyModuleSelectionList($selList, $status)> - -this function modifies the module selection list. -You can turn on and off module selections with the -boolean $status. -Changing the selections will directly influence the -module list. - -EXAMPLE - - ModifyModuleSelectionList( ['perl-scripting', 'debug'],1 ); - ModifyModuleSelectionList( ['php4-scripting'], 0 ); - -=cut - -#BEGIN { $TYPEINFO{ModifyModuleSelectionList} = ["function", "boolean", ["list","string"], "boolean" ]; } -#sub ModifyModuleSelectionList { -# my $self = shift; -# my $newSelection = shift; -# my $enable = shift; -# my %uniq = (); - -# @uniq{@{$self->GetModuleSelectionsList()}} = (); -# if( $enable ) { -# @uniq{@$newSelection} = (); -# foreach my $ns ( @$newSelection ) { -# $self->ModifyModuleList( $HTTPModules::selection{$ns}->{modules}, 1 ); -# $self->ModifyModuleList( [], 1 ); -# } -# } else { -# delete(@uniq{@$newSelection}); -# foreach my $ns ( @$newSelection ) { -# $self->ModifyModuleList( $HTTPModules::selection{$ns}->{modules}, 0 ); -# $self->ModifyModuleList( [], 1 ); -# } -# } - -# SCR->Write('.http_server.moduleselection', [keys(%uniq)]); -#} - ####################################################### # apache2 modules API end ####################################################### @@ -1442,12 +1381,12 @@ BEGIN { $TYPEINFO{GetModulePackages} = ["function", ["list", "string"] ]; } sub GetModulePackages { my $self = shift; -# my $mods = $self->GetModuleList(); my $mods = YaST::HTTPDData->GetModuleList(); my %uniq; + my %modules = YaPI::HTTPDModules::ServerModules(); foreach my $mod ( @$mods ) { - if ( exists($YaPI::HTTPDModules::modules{$mod}) ) { - @uniq{@{$YaPI::HTTPDModules::modules{$mod}->{packages}}} = (); + if ( exists($modules{$mod}) ) { + @uniq{@{$modules{$mod}->{packages}}} = (); } } return [ keys(%uniq) ]; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-http-server-4.5.0/src/modules/YaPI/HTTPDModules.pm new/yast2-http-server-4.5.1/src/modules/YaPI/HTTPDModules.pm --- old/yast2-http-server-4.5.0/src/modules/YaPI/HTTPDModules.pm 2022-04-12 13:34:34.000000000 +0200 +++ new/yast2-http-server-4.5.1/src/modules/YaPI/HTTPDModules.pm 2022-09-16 12:09:46.000000000 +0200 @@ -3,6 +3,7 @@ use YaST::HTTPDPhpModule; textdomain "http-server"; + %modules = ( # (without_leading mod_) module name = { # summary => __("Translatable text with module description - will be shown in YaST table"), @@ -708,12 +709,6 @@ { option =>"VirtualScriptAliasIP", "context" => [ "Server", "Virtual", "Directory" ] } ] }, - 'php' . YaST::HTTPDPhpModule->Version() => { - summary => __("Provides support for PHP dynamically generated pages"), - packages => ["apache2-mod_php" . YaST::HTTPDPhpModule->Version()], - default => 0, - position => 490 - }, 'perl' => { summary => __("Provides support for Perl dynamically generated pages"), packages => ["apache2-mod_perl"], @@ -768,6 +763,7 @@ } ); + %selection = ( TestSel => { summary => 'A test selection', @@ -775,3 +771,19 @@ default => 0 } ); + +BEGIN { $TYPEINFO{ServerModules} = ["function", ["map","string","any"] ]; } +sub ServerModules { + $php_version = YaST::HTTPDPhpModule->Version(); + if($php_version) + { + %modules = ( %modules, + 'php' . $php_version => { + summary => __("Provides support for PHP dynamically generated pages"), + packages => ["apache2-mod_php" . $php_version], + default => 0, + position => 490 + } + ); + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-http-server-4.5.0/src/modules/YaST/HTTPDData.pm new/yast2-http-server-4.5.1/src/modules/YaST/HTTPDData.pm --- old/yast2-http-server-4.5.0/src/modules/YaST/HTTPDData.pm 2022-04-12 13:34:34.000000000 +0200 +++ new/yast2-http-server-4.5.1/src/modules/YaST/HTTPDData.pm 2022-09-16 12:09:46.000000000 +0200 @@ -609,9 +609,10 @@ my $self = shift; my $mod = shift; my %uniq; + my %modules = YaPI::HTTPDModules::ServerModules(); - if ( exists($YaPI::HTTPDModules::modules{$mod}) ) { - @uniq{@{$YaPI::HTTPDModules::modules{$mod}->{packages}}} = (); + if ( exists($modules{$mod}) ) { + @uniq{@{$modules{$mod}->{packages}}} = (); } return [ keys(%uniq) ]; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-http-server-4.5.0/src/modules/YaST/HTTPDPhpModule.pm new/yast2-http-server-4.5.1/src/modules/YaST/HTTPDPhpModule.pm --- old/yast2-http-server-4.5.0/src/modules/YaST/HTTPDPhpModule.pm 2022-04-12 13:34:34.000000000 +0200 +++ new/yast2-http-server-4.5.1/src/modules/YaST/HTTPDPhpModule.pm 2022-09-16 12:09:46.000000000 +0200 @@ -1,11 +1,26 @@ package YaST::HTTPDPhpModule; +use YaST::YCP; + +YaST::YCP::Import "HttpServerPackages"; + our %TYPEINFO; # Define globally the current PHP version BEGIN { $TYPEINFO{Version} = ["function", "string" ]; } sub Version { - return "7"; + # when function returns an array, we get reference to it + $l = HttpServerPackages->by_provides_regexp("php[0-9]{1,2}"); + + return if(!$l); + + # there can be multiple versions of php and + # package name is php<version>. We're interested in <version> only + # Take highest available version + @s = map { int($_ =~ s/php([0-9]{1,2})$/$1/r) } @{$l}; + @s = sort {$a <=> $b} @s; + + return $s[-1]; } 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-http-server-4.5.0/test/routines_test.rb new/yast2-http-server-4.5.1/test/routines_test.rb --- old/yast2-http-server-4.5.0/test/routines_test.rb 2022-04-12 13:34:34.000000000 +0200 +++ new/yast2-http-server-4.5.1/test/routines_test.rb 2022-09-16 12:09:46.000000000 +0200 @@ -3,9 +3,18 @@ require_relative "test_helper" require "yast" -Yast.import "HttpServer" +describe "Yast::HttpServerRoutinesInclude" do + before(:each) do + # deep in HttpServer module is buried code which builds list of modules + # and it uses Package module to query available packages + Yast.import "HttpServerPackages" + Yast.import "HttpServer" + + allow(Yast::HttpServerPackages) + .to receive(:by_provides_regexp) + .and_return(["php8"]) + end -describe Yast::HttpServerRoutinesInclude do # it is included in http server module subject { Yast::HttpServer } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-http-server-4.5.0/test/test_helper.rb new/yast2-http-server-4.5.1/test/test_helper.rb --- old/yast2-http-server-4.5.0/test/test_helper.rb 2022-04-12 13:34:34.000000000 +0200 +++ new/yast2-http-server-4.5.1/test/test_helper.rb 2022-09-16 12:09:46.000000000 +0200 @@ -46,10 +46,10 @@ c.single_report_path = "coverage/lcov.info" end - SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ + SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([ SimpleCov::Formatter::HTMLFormatter, SimpleCov::Formatter::LcovFormatter - ] + ]) end end