Hello community, here is the log from the commit of package yast2 for openSUSE:Factory checked in at 2014-06-02 07:00:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2 (Old) and /work/SRC/openSUSE:Factory/.yast2.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "yast2" Changes: -------- --- /work/SRC/openSUSE:Factory/yast2/yast2.changes 2014-05-13 20:46:30.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.yast2.new/yast2.changes 2014-06-02 07:00:36.000000000 +0200 @@ -1,0 +2,75 @@ +Fri May 30 11:06:47 UTC 2014 - vmoravec@suse.com + +- Add Service.call method to make available all systemctl commands +- 3.1.74 + +------------------------------------------------------------------- +Fri May 30 08:55:45 UTC 2014 - lslezak@suse.cz + +- DonePackage callback: remove invalid UTF-8 characters to avoid + crash (bnc#876459) +- 3.1.73 + +------------------------------------------------------------------- +Fri May 30 10:41:14 CEST 2014 - locilka@suse.com + +- Fixed network backend handling during upgrade - unified with + installation (bnc#879594) +- 3.1.72 + +------------------------------------------------------------------- +Wed May 28 10:55:02 UTC 2014 - locilka@suse.com + +- Removed warning message when starting Yast in Qt instead of GTK + and vice versa (bnc#861807) +- 3.1.71 + +------------------------------------------------------------------- +Wed May 28 10:39:00 UTC 2014 - jreidinger@suse.com + +- split too wide urls for accepting GnuGP key (bnc#870822) +- 3.1.70 + +------------------------------------------------------------------- +Wed May 28 10:00:17 UTC 2014 - lslezak@suse.cz + +- removed system verification check when yast module installs + required packages (bnc#866256) +- 3.1.69 + +------------------------------------------------------------------- +Wed May 28 07:56:29 UTC 2014 - jreidinger@suse.com + +- save_y2logs: store also pbl.log from target system, if bootloader + installation failed (bnc#879622) +- 3.1.68 + +------------------------------------------------------------------- +Fri May 23 12:35:42 CEST 2014 - locilka@suse.com + +- Added check for existence of /etc/modules.d/ directory in Kernel + library, the directory is created when missing (bnc#879428) +- 3.1.67 + +------------------------------------------------------------------- +Fri May 23 09:06:28 UTC 2014 - mfilka@suse.com + +- bnc#879399 + - offer /var/log/boot.log in SysLog module for view +- 3.1.66 + +------------------------------------------------------------------- +Mon May 19 15:42:28 CEST 2014 - locilka@suse.com + +- Always using special InstallationProperties for systemd_unit + while called in first stage (bnc#878560) +- 3.1.65 + +------------------------------------------------------------------- +Mon May 19 15:07:50 CEST 2014 - locilka@suse.com + +- Changed dialog label for updating/installing in SlideShow + depending on the selected method (bnc#874995) +- 3.1.64 + +------------------------------------------------------------------- Old: ---- yast2-3.1.63.tar.bz2 New: ---- yast2-3.1.74.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2.spec ++++++ --- /var/tmp/diff_new_pack.2ODn50/_old 2014-06-02 07:00:38.000000000 +0200 +++ /var/tmp/diff_new_pack.2ODn50/_new 2014-06-02 07:00:38.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2 -Version: 3.1.63 +Version: 3.1.74 Release: 0 Url: https://github.com/yast/yast-yast2 ++++++ yast2-3.1.63.tar.bz2 -> yast2-3.1.74.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.63/library/network/src/modules/NetworkService.rb new/yast2-3.1.74/library/network/src/modules/NetworkService.rb --- old/yast2-3.1.63/library/network/src/modules/NetworkService.rb 2014-05-13 12:52:44.000000000 +0200 +++ new/yast2-3.1.74/library/network/src/modules/NetworkService.rb 2014-05-30 13:12:46.000000000 +0200 @@ -71,11 +71,16 @@ WICKED = "/usr/sbin/wicked" + DEFAULT_BACKEND = :wicked + + include Yast::Logger + def main Yast.import "Service" Yast.import "NetworkConfig" Yast.import "Popup" Yast.import "Mode" + Yast.import "Stage" Yast.import "PackageSystem" textdomain "base" @@ -179,18 +184,21 @@ when "wicked" @current_name = :wicked else - if running_installer? - Builtins.y2milestone("Running in installer, use default: wicked") - @current_name = :wicked + if Stage.initial + @current_name = DEFAULT_BACKEND + log.info "Running in installer, use default: #{@current_name}" + elsif Mode.config + @current_name = DEFAULT_BACKEND + log.info "Running in AutoYast config, use default: #{@current_name}" else - Builtins.y2error("Cannot determine used network service.") + log.info "Cannot determine used network service." raise "Cannot detect used network service" end end @cached_name = @current_name - Builtins.y2milestone("Current backend: #{@current_name}") + log.info "Current backend: #{@current_name}" end @initialized = true @@ -247,7 +255,7 @@ # Reload or restars the network service. def ReloadOrRestart - if Mode.installation + if Stage.initial # inst-sys is not running systemd nor sysV init, so systemctl call # is not available and service has to be restarted directly wicked_restart @@ -258,7 +266,7 @@ # Restarts the network service def Restart - if Mode.installation + if Stage.initial wicked_restart else systemctl_restart @@ -342,25 +350,33 @@ end # If there is network running, return true. - # Otherwise show error popup depending on Mode and return false + # Otherwise show error popup depending on Stage and return false # @return true if network running def RunningNetworkPopup - Builtins.y2internal("RunningNetworkPopup %1", isNetworkRunning) - if isNetworkRunning + network_running = isNetworkRunning + + log.info "RunningNetworkPopup #{network_running}" + + if network_running return true else - error_text = Builtins.sformat( - "%1\n%2 %3", - _("No running network detected."), - Mode.installation ? - _("Restart installation and configure network in Linuxrc") : - _( - "Configure network with YaST or Network Manager plug-in\nand start this module again" - ), - _("or continue without network.") - ) + error_text = Stage.initial ? + _( + "No running network detected.\n" + + "Restart installation and configure network in Linuxrc\n" + + "or continue without network." + ) + : + _( + "No running network detected.\n" + + "Configure network with YaST or Network Manager plug-in\n" + + "and start this module again\n" + + "or continue without network." + ) + ret = Popup.ContinueCancel(error_text) - Builtins.y2error("Network not runing!") + + log.error "Network not runing!" return ret end end @@ -420,11 +436,6 @@ nil end - # Check if currently runs in installer - def running_installer? - Mode.installation || Mode.config || Mode.update - end - publish :function => :Read, :type => "void ()" publish :function => :Modified, :type => "boolean ()" publish :function => :is_backend_available, :type => "boolean (symbol)" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.63/library/packages/src/modules/PackageCallbacks.rb new/yast2-3.1.74/library/packages/src/modules/PackageCallbacks.rb --- old/yast2-3.1.63/library/packages/src/modules/PackageCallbacks.rb 2014-05-13 12:52:44.000000000 +0200 +++ new/yast2-3.1.74/library/packages/src/modules/PackageCallbacks.rb 2014-05-30 13:12:46.000000000 +0200 @@ -35,6 +35,8 @@ module Yast class PackageCallbacksClass < Module + include Yast::Logger + def main Yast.import "Pkg" Yast.import "UI" @@ -567,6 +569,14 @@ # return "R" for retry # return "C" for abort (not implemented !) def DonePackage(error, reason) + + # remove invalid characters (bnc#876459) + if !reason.valid_encoding? + reason.encode!('UTF-16', :undef => :replace, :invalid => :replace, :replace => "?") + reason.encode!('UTF-8') + log.warn "Invalid byte sequence found, fixed text: #{reason}" + end + UI.CloseDialog if @_package_popup @_package_popup = false diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.63/library/packages/src/modules/PackageSystem.rb new/yast2-3.1.74/library/packages/src/modules/PackageSystem.rb --- old/yast2-3.1.63/library/packages/src/modules/PackageSystem.rb 2014-05-13 12:52:44.000000000 +0200 +++ new/yast2-3.1.74/library/packages/src/modules/PackageSystem.rb 2014-05-30 13:12:46.000000000 +0200 @@ -213,111 +213,9 @@ @last_op_canceled = false end - - # check if the database is consistent before packages are added - packages_consistent = Pkg.PkgSolveCheckTargetOnly - transact = Pkg.IsAnyResolvable(:any, :to_install) || - Pkg.IsAnyResolvable(:any, :to_remove) - - Builtins.y2internal( - "Target solved: %1, something to transact: %2", - packages_consistent, - transact - ) - return false if !SelectPackages(toinstall, toremove) - packager_displayed = false - - # display an error message and advice to manually fix the system - if !packages_consistent || transact - Builtins.y2warning("The current system is not consistent") - - message = _( - "The current system is not consistent,\nsome packages have unresolved dependencies." - ) - - if !packages_consistent - message = Ops.add( - Ops.add(message, "\n\n"), - _( - "Automatic resolving failed, manual dependency resolving is needed." - ) - ) - end - - if transact - message = Ops.add( - Ops.add(message, "\n\n"), - _( - "Yast has automatically added or removed some packages,\n" + - "check the changes scheduled to fix the system\n" + - "in the software manager." - ) - ) - end - - - message = Ops.add( - Ops.add(message, "\n\n"), - _( - "Start the software manager and fix the problems\nor skip fixing and install the already confirmed packages only?" - ) - ) - - fixsystem = Popup.AnyQuestion3( - Label.WarningMsg, - message, - Label.ContinueButton, - Label.SkipButton, - Label.AbortButton, - :focus_yes - ) - - Builtins.y2milestone("Fixsystem answer: %1", fixsystem) - - # the 3rd button ("Abort" label in this case) - if fixsystem == :retry - Builtins.y2milestone("Aborting package installation") - # do not install anything, abort - return false - elsif fixsystem == :yes - # disable repomanagement during installation - repomgmt = !Mode.installation - # start the package selector - ret = PackagesUI.RunPackageSelector( - { "enable_repo_mgr" => repomgmt, "mode" => :summaryMode } - ) - - Builtins.y2internal("Package selector returned: %1", ret) - - # do not install anything - if ret == :cancel || ret == :close - Builtins.y2milestone("Aborting package installation") - return false - end - - packager_displayed = true - # `no = do not fix the system, install the required packages only - # and ignore the inconsistencies - elsif fixsystem == :no - Builtins.y2milestone("Resetting the preselected packages") - # reset the solver - disable the fixsystem solver mode (bnc#439373) - Pkg.SetSolverFlags({ "reset" => true }) - # reset the preselected transactions to fix the problems - Pkg.PkgApplReset - - # reselect the packages again after the reset - return false if !SelectPackages(toinstall, toremove) - else - Builtins.y2internal("Unknown result %1, aborting", fixsystem) - return false - end - end - - solved = Pkg.PkgSolve(false) - - if solved != true + if !Pkg.PkgSolve(false) Builtins.y2error("Package solve failed: %1", Pkg.LastError) # error message, after pressing [OK] the package manager is displayed @@ -338,8 +236,6 @@ # do not fix the system return false if ret == :cancel || ret == :close - - packager_displayed = true end # is a package or a patch selected for installation? @@ -379,8 +275,7 @@ end # check if the required packages have been installed - # (user could deselect or uninstall them in the packager widget) - if packager_displayed && !InstalledAll(toinstall) + if !InstalledAll(toinstall) Builtins.y2error("Required packages have not been installed") return false end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.63/library/packages/src/modules/SignatureCheckDialogs.rb new/yast2-3.1.74/library/packages/src/modules/SignatureCheckDialogs.rb --- old/yast2-3.1.63/library/packages/src/modules/SignatureCheckDialogs.rb 2014-05-13 12:52:44.000000000 +0200 +++ new/yast2-3.1.74/library/packages/src/modules/SignatureCheckDialogs.rb 2014-05-30 13:12:46.000000000 +0200 @@ -974,7 +974,8 @@ "(%2):" ), Ops.get_locale(repo, "name", _("Unknown")), - Ops.get_locale(repo, "url", _("Unknown")) + repo["url"] ? repo["url"].scan(/.{1,59}/).join("\n") : + _("Unknown") ) # popup message - label, part 2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.63/library/packages/src/modules/SlideShow.rb new/yast2-3.1.74/library/packages/src/modules/SlideShow.rb --- old/yast2-3.1.63/library/packages/src/modules/SlideShow.rb 2014-05-13 12:52:44.000000000 +0200 +++ new/yast2-3.1.74/library/packages/src/modules/SlideShow.rb 2014-05-30 13:12:46.000000000 +0200 @@ -109,6 +109,13 @@ module Yast class SlideShowClass < Module + include Yast::Logger + + module UI_ID + TOTAL_PROGRESS = :progressTotal + CURRENT_PACKAGE = :progressCurrentPackage + end + def main Yast.import "UI" @@ -142,6 +149,7 @@ @user_abort = false # we need to remember the values for tab switching + # these are the initial values @total_progress_label = _("Installing...") @sub_progress_label = _("Installing...") @total_progress_value = 0 @@ -245,66 +253,67 @@ end # Restart the subprogress of the slideshow. This means the - # label will be set to \param text, value to 0. + # label will be set to given text, value to 0. # @param [String] text new label for the subprogress def SubProgressStart(text) - if UI.WidgetExists(:progressCurrentPackage) - UI.ChangeWidget(:progressCurrentPackage, :Value, 0) - UI.ChangeWidget(:progressCurrentPackage, :Label, text) - end - - @sub_progress_label = text - - nil + SubProgress(0, text) end - # Update status of subprogress of the slideshow. The new value will be set - # to \param value, if the \text is not nil, the label will be updated - # to this text as well. Otherwise label will not change. + # Updates status of the sub-progress in slide show. The new value and label + # will be set to values given as parametes. If a given parameter contains *nil*, + # respective value/label will not be updated. + # # @param [Fixnum] value new value for the subprogress - # @param [String] text new label for the subprogress - def SubProgress(value, text) - if UI.WidgetExists(:progressCurrentPackage) - UI.ChangeWidget(:progressCurrentPackage, :Value, value) - UI.ChangeWidget(:progressCurrentPackage, :Label, text) if text != nil - end + # @param [String] label new label for the subprogress + def SubProgress(value, label) + value ||= @sub_progress_value + label ||= @sub_progress_label + + if UI.WidgetExists(UI_ID::CURRENT_PACKAGE) + if @sub_progress_value != value + @sub_progress_value = value + UI.ChangeWidget(UI_ID::CURRENT_PACKAGE, :Value, value) + end - @sub_progress_value = value - @sub_progress_label = text if text != nil + if @sub_progress_label != label + @sub_progress_label = label + UI.ChangeWidget(UI_ID::CURRENT_PACKAGE, :Label, label) + end + end nil end # Restart the global progress of the slideshow. This means the - # label will be set to \param text, value to 0. + # label will be set to given text, value to 0. + # # @param [String] text new label for the global progress def GlobalProgressStart(text) - @total_progress_label = text - if UI.WidgetExists(:progressTotal) - UI.ChangeWidget(:progressTotal, :Value, 0) - UI.ChangeWidget(:progressTotal, :Label, text) - end - - @total_progress_label = text - @total_progress_value = 0 - - nil + UpdateGlobalProgress(0, text) end - # Update status of global progress of the slideshow. The new value will be set - # to \param value, if the \text is not nil, the label will be updated - # to this text as well. Otherwise label will not change. + # Updates status of the global progress in slide show. The new value and label + # will be set to values given as parametes. If a given parameter contains *nil*, + # respective value/label will not be updated. + # # @param [Fixnum] value new value for the global progress - # @param text new label for the global progress - def UpdateGlobalProgress(value, new_text) - @total_progress_label = new_text if new_text != nil - @total_progress_value = value - - if UI.WidgetExists(:progressTotal) - UI.ChangeWidget(:progressTotal, :Value, value) - UI.ChangeWidget(:progressTotal, :Label, new_text) if new_text != nil + # @param [String] label new label for the global progress + def UpdateGlobalProgress(value, label) + value ||= @total_progress_value + label ||= @total_progress_label + + if UI.WidgetExists(UI_ID::TOTAL_PROGRESS) + if @total_progress_value != value + @total_progress_value = value + UI.ChangeWidget(UI_ID::TOTAL_PROGRESS, :Value, value) + end + + if @total_progress_label != label + @total_progress_label = label + UI.ChangeWidget(UI_ID::TOTAL_PROGRESS, :Label, label) + end else - Builtins.y2milestone("progressTotal widget missing") + log.warn "progressTotal widget missing" end # update slide @@ -371,13 +380,11 @@ nil end - # Return the current global progress label. - # @return [String] current label + # Sets the current global progress label. + # + # @param [String] new label def SetGlobalProgressLabel(text) - @total_progress_label = text - if UI.WidgetExists(:progressTotal) - UI.ChangeWidget(:progressTotal, :Label, text) - end + UpdateGlobalProgress(nil, text) nil end @@ -385,13 +392,12 @@ # Append message to the installation log. # @param [String] msg message to be added, without trailing eoln def AppendMessageToInstLog(msg) - log_line = Ops.add(msg, "\n") - @inst_log = Ops.add(@inst_log, log_line) + log_line = "#{msg}\n" - if ShowingDetails() - if UI.WidgetExists(:instLog) - UI.ChangeWidget(:instLog, :LastLine, log_line) - end + @inst_log << log_line + + if ShowingDetails() && UI.WidgetExists(:instLog) + UI.ChangeWidget(:instLog, :LastLine, log_line) end nil @@ -508,7 +514,7 @@ # too much flicker upon update (UI::RecalcLayout() ) on NCurses # Progress bar for overall progress of software package installation ProgressBar( - Id(:progressTotal), + Id(UI_ID::TOTAL_PROGRESS), @total_progress_label, 100, @total_progress_value @@ -565,7 +571,7 @@ @_show_table ? DetailsTableWidget() : Empty(), VWeight(1, LogView(Id(:instLog), _("Actions performed:"), 6, 0)), ProgressBar( - Id(:progressCurrentPackage), + Id(UI_ID::CURRENT_PACKAGE), @sub_progress_label, 100, @sub_progress_value @@ -717,13 +723,18 @@ Builtins.y2milestone("SlideShow contents: %1", contents) Wizard.SetContents( - # Dialog heading while software packages are being installed - _("Performing Installation"), + (Mode.update ? + # Dialog heading - software packages are being upgraded + _("Performing Upgrade") + : + # Dialog heading - software packages are being installed + _("Performing Installation") + ), contents, HelpText(), - false, - false - ) # has_back, has_next + false, # no back button + false # no next button + ) @widgets_created = true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.63/library/packages/test/Makefile.am new/yast2-3.1.74/library/packages/test/Makefile.am --- old/yast2-3.1.63/library/packages/test/Makefile.am 2014-05-13 12:52:44.000000000 +0200 +++ new/yast2-3.1.74/library/packages/test/Makefile.am 2014-05-30 13:12:46.000000000 +0200 @@ -1,5 +1,6 @@ TESTS = \ - product_test.rb + product_test.rb \ + slide_show_test.rb TEST_EXTENSIONS = .rb RB_LOG_COMPILER = rspec diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.63/library/packages/test/slide_show_test.rb new/yast2-3.1.74/library/packages/test/slide_show_test.rb --- old/yast2-3.1.63/library/packages/test/slide_show_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-3.1.74/library/packages/test/slide_show_test.rb 2014-05-30 13:12:46.000000000 +0200 @@ -0,0 +1,139 @@ +#! /usr/bin/rspec + +top_srcdir = File.expand_path("../../../..", __FILE__) +inc_dirs = Dir.glob("#{top_srcdir}/library/*/src") +ENV["Y2DIR"] = inc_dirs.join(":") + +require "yast" + +Yast.import "SlideShow" +Yast.import "UI" + +include Yast::Logger + +describe "Yast::SlideShow" do + before(:each) do + log.info "--------- Running test ---------" + end + + TOTAL_PROGRESS_ID = Yast::SlideShowClass::UI_ID::TOTAL_PROGRESS + + describe "#UpdateGlobalProgress" do + before(:each) do + allow(Yast::SlideShow).to receive(:ShowingSlide).and_return(false) + + # reseting total progress before each test + Yast::SlideShow.UpdateGlobalProgress(0, "") + end + + describe "when total progress widget is missing" do + it "does not update the total progress" do + expect(Yast::UI).to receive(:WidgetExists).with(TOTAL_PROGRESS_ID).and_return(false) + expect(Yast::UI).not_to receive(:ChangeWidget).with(TOTAL_PROGRESS_ID, anything(), anything()) + + Yast::SlideShow.UpdateGlobalProgress(1, "new label -1") + end + end + + describe "when total progress widget exists" do + before(:each) do + allow(Yast::UI).to receive(:WidgetExists).and_return(false) + expect(Yast::UI).to receive(:WidgetExists).with(TOTAL_PROGRESS_ID).and_return(true) + end + + it "updates the progress value and label" do + expect(Yast::UI).to receive(:ChangeWidget).with(TOTAL_PROGRESS_ID, :Value, 100) + expect(Yast::UI).to receive(:ChangeWidget).with(TOTAL_PROGRESS_ID, :Label, "finished") + + Yast::SlideShow.UpdateGlobalProgress(100, "finished") + end + + it "updates slides if using slides" do + allow(Yast::SlideShow).to receive(:ShowingSlide).and_return(true) + expect(Yast::SlideShow).to receive(:ChangeSlideIfNecessary) + + Yast::SlideShow.UpdateGlobalProgress(9, "new label 0") + end + + it "does not update progress label when setting it to nil" do + expect(Yast::UI).to receive(:ChangeWidget).with(TOTAL_PROGRESS_ID, :Value, 25) + expect(Yast::UI).not_to receive(:ChangeWidget).with(TOTAL_PROGRESS_ID, :Label, anything()) + + Yast::SlideShow.UpdateGlobalProgress(25, nil) + end + + it "does not update progress value when setting it to nil" do + expect(Yast::UI).not_to receive(:ChangeWidget).with(TOTAL_PROGRESS_ID, :Value, anything()) + expect(Yast::UI).to receive(:ChangeWidget).with(TOTAL_PROGRESS_ID, :Label, "new label 1") + + Yast::SlideShow.UpdateGlobalProgress(nil, "new label 1") + end + + # optimizes doing useless UI changes + it "does not update progress value or label if setting them to their current value" do + expect(Yast::UI).to receive(:ChangeWidget).with(TOTAL_PROGRESS_ID, :Value, 31).once + expect(Yast::UI).to receive(:ChangeWidget).with(TOTAL_PROGRESS_ID, :Label, "new label 5").once + + # updates UI only once + 3.times { Yast::SlideShow.UpdateGlobalProgress(31, "new label 5") } + end + end + end + + PACKAGES_PROGRESS_ID = Yast::SlideShowClass::UI_ID::CURRENT_PACKAGE + + describe "#SubProgress" do + before(:each) do + allow(Yast::UI).to receive(:WidgetExists).and_return(false) + + # reseting sub-progress before each test + Yast::SlideShow.SubProgress(0, "") + end + + describe "when total progress widget does not exists" do + it "does not update the total progress" do + expect(Yast::UI).to receive(:WidgetExists).with(PACKAGES_PROGRESS_ID).and_return(false) + expect(Yast::UI).not_to receive(:ChangeWidget).with(PACKAGES_PROGRESS_ID, anything(), anything()) + + Yast::SlideShow.SubProgress(9, "some label") + end + end + + describe "when total progress widget exists" do + before(:each) do + expect(Yast::UI).to receive(:WidgetExists).with(PACKAGES_PROGRESS_ID).and_return(true) + end + + it "updates packages progress value and label" do + expect(Yast::UI).to receive(:ChangeWidget).with(PACKAGES_PROGRESS_ID, :Value, 100) + expect(Yast::UI).to receive(:ChangeWidget).with(PACKAGES_PROGRESS_ID, :Label, "finished") + + Yast::SlideShow.SubProgress(100, "finished") + end + + it "does not update progress label when setting it to nil" do + expect(Yast::UI).to receive(:ChangeWidget).with(PACKAGES_PROGRESS_ID, :Value, 13) + expect(Yast::UI).not_to receive(:ChangeWidget).with(PACKAGES_PROGRESS_ID, :Label, anything()) + + Yast::SlideShow.SubProgress(13, nil) + end + + it "does not update progress value when setting it to nil" do + expect(Yast::UI).not_to receive(:ChangeWidget).with(PACKAGES_PROGRESS_ID, :Value, anything()) + expect(Yast::UI).to receive(:ChangeWidget).with(PACKAGES_PROGRESS_ID, :Label, "package test 1") + + Yast::SlideShow.SubProgress(nil, "package test 1") + end + + # optimizes doing useless UI changes + it "does not update progress value or label if setting them to their current value" do + expect(Yast::UI).to receive(:ChangeWidget).with(PACKAGES_PROGRESS_ID, :Value, 67).once + expect(Yast::UI).to receive(:ChangeWidget).with(PACKAGES_PROGRESS_ID, :Label, "package test 2").once + + # updates UI only once + 3.times { Yast::SlideShow.SubProgress(67, "package test 2") } + end + end + end + +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.63/library/runlevel/src/modules/Service.rb new/yast2-3.1.74/library/runlevel/src/modules/Service.rb --- old/yast2-3.1.63/library/runlevel/src/modules/Service.rb 2014-05-13 12:52:44.000000000 +0200 +++ new/yast2-3.1.74/library/runlevel/src/modules/Service.rb 2014-05-30 13:12:46.000000000 +0200 @@ -50,6 +50,35 @@ @error = "" end + # Send whatever systemd command you need to call for a specific service + # If the command fails, log entry with output from systemctl is created in y2log + # @param [String,String] Command name and service name + # @return [Boolean] Result of the action, true means success + def call command_name, service_name + service = SystemdService.find(service_name) + return failure(:not_found, service_name) unless service + + systemd_command = + case command_name + when 'show' then :show + when 'status' then :status + when 'start' then :start + when 'stop' then :stop + when 'enable' then :enable + when 'disable' then :disable + when 'restart' then :restart + when 'reload' then :reload + when 'try-restart' then :try_restart + when 'reload-or-restart' then :reload_or_restart + when 'reload-or-try-restart' then :reload_or_try_restart + else + raise "Command '#{command_name}' not supported" + end + result = service.send(systemd_command) + failure(command_name, service_name, service.error) unless result + result + end + # Check if service is active/running # # @param [String] name service name @@ -75,6 +104,7 @@ alias_method :enabled?, :Enabled # Enable service + # Logs error with output from systemctl if the command fails # @param [String] service service to be enabled # @return true if operation is successful def Enable service_name @@ -88,6 +118,7 @@ alias_method :enable, :Enable # Disable service + # Logs error with output from systemctl if the command fails # @param [String] service service to be disabled # @return true if operation is successful def Disable service_name @@ -101,6 +132,7 @@ alias_method :disable, :Disable # Start service + # Logs error with output from systemctl if the command fails # @param [String] service service to be started # @return true if operation is successful def Start service_name @@ -114,6 +146,7 @@ alias_method :start, :Start # Restart service + # Logs error with output from systemctl if the command fails # @param [String] service service to be restarted # @return true if operation is successful def Restart service_name @@ -127,6 +160,7 @@ alias_method :restart, :Restart # Reload service + # Logs error with output from systemctl if the command fails # @param [String] service service to be reloaded # @return true if operation is successful def Reload service_name @@ -140,6 +174,7 @@ alias_method :reload, :Reload # Stop service + # Logs error with output from systemctl if the command fails # @param [String] service service to be stopped # @return true if operation is successful def Stop service_name diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.63/library/runlevel/test/service_test.rb new/yast2-3.1.74/library/runlevel/test/service_test.rb --- old/yast2-3.1.63/library/runlevel/test/service_test.rb 2014-05-13 12:52:44.000000000 +0200 +++ new/yast2-3.1.74/library/runlevel/test/service_test.rb 2014-05-30 13:12:46.000000000 +0200 @@ -20,6 +20,28 @@ stub_services end + describe ".call" do + it "executes the command for the specified service" do + expect(Service.call('reload', 'sshd')).to be_true + end + + it "returns false if the service has not been found" do + stub_services(:service=>'unknown') + expect(Service.call('restart', 'unknown')).to be_false + end + + it "raises error if the command is not recognized" do + expect { Service.call('make-coffee', 'sshd') }.to raise_error + end + + it "returns the result of the original result of the command call" do + expect(Service.call('status', 'sshd')).to be_kind_of(String) + + stub_service_with(:"try_restart", false) + expect(Service.call('try-restart', "sshd")).to be_false + end + end + describe ".Active" do it "returns true if a service is active" do expect(Service.Active('sshd')).to be_true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.63/library/system/src/clients/view_anymsg.rb new/yast2-3.1.74/library/system/src/clients/view_anymsg.rb --- old/yast2-3.1.63/library/system/src/clients/view_anymsg.rb 2014-05-13 12:52:44.000000000 +0200 +++ new/yast2-3.1.74/library/system/src/clients/view_anymsg.rb 2014-05-30 13:12:46.000000000 +0200 @@ -73,8 +73,10 @@ @filenames = Convert.to_string( SCR.Read(path(".target.string"), Ops.add(@vardir, "/filenames")) ) - if @filenames == nil || Ops.less_or_equal(Builtins.size(@filenames), 0) - @filenames = "/var/log/boot.msg\n/var/log/messages\n" + if !@filenames || @filenames.empty? + @filenames = "" + @filenames << "/var/log/boot.log\n" + @filenames << "/var/log/messages\n" end # convert \n separated string to ycp list. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.63/library/system/src/modules/Kernel.rb new/yast2-3.1.74/library/system/src/modules/Kernel.rb --- old/yast2-3.1.63/library/system/src/modules/Kernel.rb 2014-05-13 12:52:44.000000000 +0200 +++ new/yast2-3.1.74/library/system/src/modules/Kernel.rb 2014-05-30 13:12:46.000000000 +0200 @@ -57,6 +57,7 @@ Yast.import "PackagesProposal" Yast.import "Popup" Yast.import "Stage" + Yast.import "FileUtils" textdomain "base" @@ -608,6 +609,16 @@ # @return [Boolean] true on success def SaveModulesToLoad modules_to_load + + unless FileUtils.Exists(MODULES_DIR) + log.warn "Directory #{MODULES_DIR} does not exist, creating" + + unless SCR::Execute(path(".target.mkdir"), MODULES_DIR) + log.error "Cannot create directory #{MODULES_DIR}" + return false + end + end + success = true @modules_to_load.each do |file, modules| @@ -693,11 +704,22 @@ def read_modules_to_load @modules_to_load = {MODULES_CONF_FILE => []} - SCR::Read(path(".target.dir"), MODULES_DIR).each do |file_name| + if FileUtils.Exists(MODULES_DIR) + config_files = SCR::Read(path(".target.dir"), MODULES_DIR) + else + log.error "Cannot read modules to load on boot, directory #{MODULES_DIR} does not exist" + end + + if config_files.nil? + log.error "Cannot read config files from #{MODULES_DIR}" + config_files = [] + end + + config_files.each do |file_name| next unless file_name =~ /^.+\.conf$/ if !register_modules_agent(file_name) - Builtins.y2error("Cannot register new SCR agent for #{file_path} file") + log.error "Cannot register new SCR agent for #{file_path} file" next end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.63/library/system/test/kernel_test.rb new/yast2-3.1.74/library/system/test/kernel_test.rb --- old/yast2-3.1.63/library/system/test/kernel_test.rb 2014-05-13 12:52:44.000000000 +0200 +++ new/yast2-3.1.74/library/system/test/kernel_test.rb 2014-05-30 13:12:46.000000000 +0200 @@ -1,18 +1,23 @@ #! /usr/bin/rspec -ENV["Y2DIR"] = File.expand_path("../../src", __FILE__) +top_srcdir = File.expand_path("../../../..", __FILE__) +inc_dirs = Dir.glob("#{top_srcdir}/library/*/src") +ENV["Y2DIR"] = inc_dirs.join(":") require "yast" require "tmpdir" -include Yast +include Yast::Logger Yast.import "Kernel" +Yast.import "FileUtils" +Yast.import "SCR" DEFAULT_DATA_DIR = File.join(File.expand_path(File.dirname(__FILE__)), "data/modules.d") describe "Kernel" do before (:each) do + log.info "--- test ---" stub_const("Yast::KernelClass::MODULES_DIR", DEFAULT_DATA_DIR) @default_modules = { Yast::KernelClass::MODULES_CONF_FILE => [], @@ -21,11 +26,21 @@ "user-added-2.conf"=>["user-module-4"], } Yast::Kernel.reset_modules_to_load + allow(Yast::FileUtils).to receive(:Exists).and_return(true) end describe "#modules_to_load" do - it "returns hash of modules to load" do - expect(Yast::Kernel.modules_to_load).to eq(@default_modules) + describe "when modules.d directory exists" do + it "returns hash of modules to load" do + expect(Yast::Kernel.modules_to_load).to eq(@default_modules) + end + end + + describe "when modules.d directory is missing" do + it "returns empty list of modules for modules.d directory" do + expect(Yast::FileUtils).to receive(:Exists).with(Yast::KernelClass::MODULES_DIR).and_return(false) + expect(Yast::Kernel.modules_to_load).to eq({Yast::KernelClass::MODULES_CONF_FILE => []}) + end end end @@ -74,41 +89,54 @@ end describe "#SaveModulesToLoad" do - it "stores all modules to be loaded to configuration files" do - Dir.mktmpdir do |tmpdir| - FileUtils.cp_r(DEFAULT_DATA_DIR + "/.", tmpdir) - - stub_const("Yast::KernelClass::MODULES_DIR", tmpdir) - Yast::Kernel.reset_modules_to_load - - # Tests on the default data - ["module-a", "module-b", "user-module-1", "user-module-2", "user-module-3", "user-module-4"].each do |kernel_module| - expect(Yast::Kernel.module_to_be_loaded?(kernel_module)).to be_true - end + describe "when modules.d directory does not exist" do + it "tries to create the missing directory and returns false if it fails" do + expect(Yast::FileUtils).to receive(:Exists).twice().and_return(false) + expect(Yast::SCR).to receive(:Execute).with( + Yast::Path.new(".target.mkdir"), + anything() + ).and_return(false) + expect(Yast::Kernel.SaveModulesToLoad).to eq(false) + end + end - new_module = "new-kernel-module" - remove_module = "user-module-2" + describe "when modules.d directory exists" do + it "stores all modules to be loaded to configuration files and returns true" do + Dir.mktmpdir do |tmpdir| + FileUtils.cp_r(DEFAULT_DATA_DIR + "/.", tmpdir) + + stub_const("Yast::KernelClass::MODULES_DIR", tmpdir) + Yast::Kernel.reset_modules_to_load + + # Tests on the default data + ["module-a", "module-b", "user-module-1", "user-module-2", "user-module-3", "user-module-4"].each do |kernel_module| + expect(Yast::Kernel.module_to_be_loaded?(kernel_module)).to be_true + end + + new_module = "new-kernel-module" + remove_module = "user-module-2" + + # Modifying data + Yast::Kernel.AddModuleToLoad new_module + Yast::Kernel.RemoveModuleToLoad remove_module + + expect(Yast::Kernel.SaveModulesToLoad).to be_true + + # Tests on the stored modified data + Yast::Kernel.reset_modules_to_load + ["module-a", "module-b", "user-module-1", "user-module-3", "user-module-4", new_module].each do |kernel_module| + expect(Yast::Kernel.module_to_be_loaded?(kernel_module)).to be_true + end + + expect(Yast::Kernel.module_to_be_loaded?(remove_module)).to be_false + + # Tests directly on the system + number_of_nkm = `grep --count --no-filename #{new_module} #{tmpdir}/*` + expect(number_of_nkm.split.map(&:to_i).inject(:+)).to eq(1) - # Modifying data - Yast::Kernel.AddModuleToLoad new_module - Yast::Kernel.RemoveModuleToLoad remove_module - - expect(Yast::Kernel.SaveModulesToLoad).to be_true - - # Tests on the stored modified data - Yast::Kernel.reset_modules_to_load - ["module-a", "module-b", "user-module-1", "user-module-3", "user-module-4", new_module].each do |kernel_module| - expect(Yast::Kernel.module_to_be_loaded?(kernel_module)).to be_true + number_of_rkm = `grep --count --no-filename #{remove_module} #{tmpdir}/*` + expect(number_of_rkm.split.map(&:to_i).inject(:+)).to eq(0) end - - expect(Yast::Kernel.module_to_be_loaded?(remove_module)).to be_false - - # Tests directly on the system - number_of_nkm = `grep --count --no-filename #{new_module} #{tmpdir}/*` - expect(number_of_nkm.split.map(&:to_i).inject(:+)).to eq(1) - - number_of_rkm = `grep --count --no-filename #{remove_module} #{tmpdir}/*` - expect(number_of_rkm.split.map(&:to_i).inject(:+)).to eq(0) end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.63/library/systemd/src/lib/yast2/systemd_unit.rb new/yast2-3.1.74/library/systemd/src/lib/yast2/systemd_unit.rb --- old/yast2-3.1.63/library/systemd/src/lib/yast2/systemd_unit.rb 2014-05-13 12:52:44.000000000 +0200 +++ new/yast2-3.1.74/library/systemd/src/lib/yast2/systemd_unit.rb 2014-05-30 13:12:46.000000000 +0200 @@ -4,7 +4,7 @@ require 'forwardable' module Yast - import 'Mode' + import 'Stage' ### # Use this class always as a parent class for implementing various systemd units. @@ -76,7 +76,8 @@ end def show - Mode.installation ? InstallationProperties.new(self) : Properties.new(self) + # Using different handler during first stage (installation, update, ...) + Stage.initial ? InstallationProperties.new(self) : Properties.new(self) end def status @@ -218,7 +219,7 @@ # the error message mentioned above in this comment. # # Once the inst-sys has running dbus/systemd, this class definition can be removed - # together with the condition for Mode.installation in the SystemdUnit#show. + # together with the condition for Stage.initial in the SystemdUnit#show. class InstallationProperties < OpenStruct include Yast::Logger diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.63/library/systemd/src/modules/systemd_service.rb new/yast2-3.1.74/library/systemd/src/modules/systemd_service.rb --- old/yast2-3.1.63/library/systemd/src/modules/systemd_service.rb 2014-05-13 12:52:44.000000000 +0200 +++ new/yast2-3.1.74/library/systemd/src/modules/systemd_service.rb 2014-05-30 13:12:46.000000000 +0200 @@ -116,6 +116,9 @@ end def restart + # Delegate to SystemdUnit#restart if not within installation + return super unless installation_system? + stop sleep(1) start diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.63/library/systemd/test/systemd_unit_test.rb new/yast2-3.1.74/library/systemd/test/systemd_unit_test.rb --- old/yast2-3.1.63/library/systemd/test/systemd_unit_test.rb 2014-05-13 12:52:44.000000000 +0200 +++ new/yast2-3.1.74/library/systemd/test/systemd_unit_test.rb 2014-05-30 13:12:46.000000000 +0200 @@ -21,7 +21,7 @@ context "Installation system without full support of systemd" do before do - Yast::Mode.stub(:installation).and_return(true) + Yast::Stage.stub(:initial).and_return(true) end describe "#properties" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.63/package/yast2.changes new/yast2-3.1.74/package/yast2.changes --- old/yast2-3.1.63/package/yast2.changes 2014-05-13 12:52:44.000000000 +0200 +++ new/yast2-3.1.74/package/yast2.changes 2014-05-30 13:12:46.000000000 +0200 @@ -1,4 +1,79 @@ ------------------------------------------------------------------- +Fri May 30 11:06:47 UTC 2014 - vmoravec@suse.com + +- Add Service.call method to make available all systemctl commands +- 3.1.74 + +------------------------------------------------------------------- +Fri May 30 08:55:45 UTC 2014 - lslezak@suse.cz + +- DonePackage callback: remove invalid UTF-8 characters to avoid + crash (bnc#876459) +- 3.1.73 + +------------------------------------------------------------------- +Fri May 30 10:41:14 CEST 2014 - locilka@suse.com + +- Fixed network backend handling during upgrade - unified with + installation (bnc#879594) +- 3.1.72 + +------------------------------------------------------------------- +Wed May 28 10:55:02 UTC 2014 - locilka@suse.com + +- Removed warning message when starting Yast in Qt instead of GTK + and vice versa (bnc#861807) +- 3.1.71 + +------------------------------------------------------------------- +Wed May 28 10:39:00 UTC 2014 - jreidinger@suse.com + +- split too wide urls for accepting GnuGP key (bnc#870822) +- 3.1.70 + +------------------------------------------------------------------- +Wed May 28 10:00:17 UTC 2014 - lslezak@suse.cz + +- removed system verification check when yast module installs + required packages (bnc#866256) +- 3.1.69 + +------------------------------------------------------------------- +Wed May 28 07:56:29 UTC 2014 - jreidinger@suse.com + +- save_y2logs: store also pbl.log from target system, if bootloader + installation failed (bnc#879622) +- 3.1.68 + +------------------------------------------------------------------- +Fri May 23 12:35:42 CEST 2014 - locilka@suse.com + +- Added check for existence of /etc/modules.d/ directory in Kernel + library, the directory is created when missing (bnc#879428) +- 3.1.67 + +------------------------------------------------------------------- +Fri May 23 09:06:28 UTC 2014 - mfilka@suse.com + +- bnc#879399 + - offer /var/log/boot.log in SysLog module for view +- 3.1.66 + +------------------------------------------------------------------- +Mon May 19 15:42:28 CEST 2014 - locilka@suse.com + +- Always using special InstallationProperties for systemd_unit + while called in first stage (bnc#878560) +- 3.1.65 + +------------------------------------------------------------------- +Mon May 19 15:07:50 CEST 2014 - locilka@suse.com + +- Changed dialog label for updating/installing in SlideShow + depending on the selected method (bnc#874995) +- 3.1.64 + +------------------------------------------------------------------- Tue May 13 12:03:12 CEST 2014 - aschnell@suse.de - added error handing for viewing log files (bnc#876895) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.63/package/yast2.spec new/yast2-3.1.74/package/yast2.spec --- old/yast2-3.1.63/package/yast2.spec 2014-05-13 12:52:44.000000000 +0200 +++ new/yast2-3.1.74/package/yast2.spec 2014-05-30 13:12:46.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2 -Version: 3.1.63 +Version: 3.1.74 Release: 0 URL: https://github.com/yast/yast-yast2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.63/scripts/save_y2logs new/yast2-3.1.74/scripts/save_y2logs --- old/yast2-3.1.63/scripts/save_y2logs 2014-05-13 12:52:44.000000000 +0200 +++ new/yast2-3.1.74/scripts/save_y2logs 2014-05-30 13:12:46.000000000 +0200 @@ -90,6 +90,10 @@ if [ -f /var/log/pbl.log ]; then LIST="$LIST /var/log/pbl.log" fi +# if storing logs at the end of installation after bootloader fail, try to store pbl log from target system +if [ -f /mnt/var/log/pbl.log ]; then + LIST="$LIST /mnt/var/log/pbl.log" +fi if [ -f /.packages.root ]; then LIST="$LIST /.packages.root" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.63/scripts/yast2 new/yast2-3.1.74/scripts/yast2 --- old/yast2-3.1.63/scripts/yast2 2014-05-13 12:52:44.000000000 +0200 +++ new/yast2-3.1.74/scripts/yast2 2014-05-30 13:12:46.000000000 +0200 @@ -135,6 +135,7 @@ if [ "$WANTED_GUI" = "auto" ]; then probe_desktop_gui WANTED_GUI=$DESKTOP_GUI + GUI_SELECTION=auto fi if [ "$WANTED_GUI" = "gtk" ]; then @@ -144,7 +145,9 @@ if check_qt; then SELECTED_GUI=qt WANTED_GUI=qt - echo >&2 "GTK GUI wanted but not found, falling back to Qt." + if [ "$GUI_SELECTION" != "auto" ]; then + echo >&2 "GTK GUI wanted but not found, falling back to Qt." + fi else echo >&2 "GTK GUI wanted but not found, falling back to ncurses." fi @@ -156,7 +159,9 @@ if check_gtk; then SELECTED_GUI=gtk WANTED_GUI=gtk - echo >&2 "Qt GUI wanted but not found, falling back to GTK." + if [ "$GUI_SELECTION" != "auto" ]; then + echo >&2 "Qt GUI wanted but not found, falling back to GTK." + fi else echo >&2 "Qt GUI wanted but not found, falling back to ncurses." fi -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org