Hello community, here is the log from the commit of package yast2-bootloader for openSUSE:Factory checked in at 2016-10-10 17:34:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-bootloader (Old) and /work/SRC/openSUSE:Factory/.yast2-bootloader.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-bootloader" Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-bootloader/yast2-bootloader.changes 2016-08-31 00:03:09.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-bootloader.new/yast2-bootloader.changes 2016-10-10 17:35:00.000000000 +0200 @@ -1,0 +2,31 @@ +Fri Oct 7 12:46:18 UTC 2016 - [email protected] + +- Warn user if the packages needed for booting are deselected + (bsc#885496) +- 3.2.3 + +------------------------------------------------------------------- +Thu Oct 6 08:24:51 UTC 2016 - [email protected] + +- allow user to repropose configuration if unknown udev link found + (bnc#931291) +- 3.2.2 + +------------------------------------------------------------------- +Tue Oct 4 12:51:04 UTC 2016 - [email protected] + +- Do not crash when the user tries to enable serial console with + blank arguments (bsc#1000629) +- 3.2.1 + +------------------------------------------------------------------- +Fri Sep 30 15:25:29 UTC 2016 - [email protected] + +- show popup when unsupported bootloader used on system, allowing + user to exit yast2-bootloader or propose supported bootloader + there (bnc#923458) +- Version bumped to 3.2.X to ease coordination of Tumbleweed, + Leap 42.2 and SLE-12-SP2 development. +- 3.2.0 + +------------------------------------------------------------------- Old: ---- yast2-bootloader-3.1.203.tar.bz2 New: ---- yast2-bootloader-3.2.3.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-bootloader.spec ++++++ --- /var/tmp/diff_new_pack.muBmnN/_old 2016-10-10 17:35:01.000000000 +0200 +++ /var/tmp/diff_new_pack.muBmnN/_new 2016-10-10 17:35:01.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-bootloader -Version: 3.1.203 +Version: 3.2.3 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ yast2-bootloader-3.1.203.tar.bz2 -> yast2-bootloader-3.2.3.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.203/package/yast2-bootloader.changes new/yast2-bootloader-3.2.3/package/yast2-bootloader.changes --- old/yast2-bootloader-3.1.203/package/yast2-bootloader.changes 2016-08-30 15:58:39.000000000 +0200 +++ new/yast2-bootloader-3.2.3/package/yast2-bootloader.changes 2016-10-07 16:13:47.000000000 +0200 @@ -1,4 +1,35 @@ ------------------------------------------------------------------- +Fri Oct 7 12:46:18 UTC 2016 - [email protected] + +- Warn user if the packages needed for booting are deselected + (bsc#885496) +- 3.2.3 + +------------------------------------------------------------------- +Thu Oct 6 08:24:51 UTC 2016 - [email protected] + +- allow user to repropose configuration if unknown udev link found + (bnc#931291) +- 3.2.2 + +------------------------------------------------------------------- +Tue Oct 4 12:51:04 UTC 2016 - [email protected] + +- Do not crash when the user tries to enable serial console with + blank arguments (bsc#1000629) +- 3.2.1 + +------------------------------------------------------------------- +Fri Sep 30 15:25:29 UTC 2016 - [email protected] + +- show popup when unsupported bootloader used on system, allowing + user to exit yast2-bootloader or propose supported bootloader + there (bnc#923458) +- Version bumped to 3.2.X to ease coordination of Tumbleweed, + Leap 42.2 and SLE-12-SP2 development. +- 3.2.0 + +------------------------------------------------------------------- Tue Aug 30 13:31:14 UTC 2016 - [email protected] - import properly device map in autoyast profile (found during diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.203/package/yast2-bootloader.spec new/yast2-bootloader-3.2.3/package/yast2-bootloader.spec --- old/yast2-bootloader-3.1.203/package/yast2-bootloader.spec 2016-08-30 15:58:39.000000000 +0200 +++ new/yast2-bootloader-3.2.3/package/yast2-bootloader.spec 2016-10-07 16:13:47.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-bootloader -Version: 3.1.203 +Version: 3.2.3 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.203/src/lib/bootloader/bootloader_factory.rb new/yast2-bootloader-3.2.3/src/lib/bootloader/bootloader_factory.rb --- old/yast2-bootloader-3.1.203/src/lib/bootloader/bootloader_factory.rb 2016-08-30 15:58:39.000000000 +0200 +++ new/yast2-bootloader-3.2.3/src/lib/bootloader/bootloader_factory.rb 2016-10-07 16:13:47.000000000 +0200 @@ -3,6 +3,7 @@ require "bootloader/none_bootloader" require "bootloader/grub2" require "bootloader/grub2efi" +require "bootloader/exceptions" Yast.import "Arch" Yast.import "Mode" @@ -69,6 +70,10 @@ @cached_bootloaders["grub2-efi"] ||= Grub2EFI.new when "none" @cached_bootloaders["none"] ||= NoneBootloader.new + when String + raise UnsupportedBootloader, name + else + return nil # in other cases it means that read failed end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.203/src/lib/bootloader/config_dialog.rb new/yast2-bootloader-3.2.3/src/lib/bootloader/config_dialog.rb --- old/yast2-bootloader-3.1.203/src/lib/bootloader/config_dialog.rb 2016-08-30 15:58:39.000000000 +0200 +++ new/yast2-bootloader-3.2.3/src/lib/bootloader/config_dialog.rb 2016-10-07 16:13:47.000000000 +0200 @@ -18,6 +18,26 @@ include Yast::UIShortcuts def run + guarded_run + rescue ::Bootloader::BrokenConfiguration => e + ret = Yast::Report.AnyQuestion(_("Broken Configuration"), + # TRANSLATORS: %s stands for readon why yast cannot process it + _("YaST cannot process current bootloader configuration (%s). " \ + "Propose new configuration from scratch?") % e.reason, + _("Propose"), + _("Quit"), + :yes) # focus proposing new one + return :abort unless ret + + ::Bootloader::BootloaderFactory.current = ::Bootloader::BootloaderFactory.proposed + ::Bootloader::BootloaderFactory.current.propose + + retry + end + + private + + def guarded_run textdomain "bootloader" log.info "Running Main Dialog" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.203/src/lib/bootloader/exceptions.rb new/yast2-bootloader-3.2.3/src/lib/bootloader/exceptions.rb --- old/yast2-bootloader-3.1.203/src/lib/bootloader/exceptions.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-bootloader-3.2.3/src/lib/bootloader/exceptions.rb 2016-10-07 16:13:47.000000000 +0200 @@ -0,0 +1,28 @@ +require "yast" + +module Bootloader + # Represents error when during read it found bootloader name that is not supported. + class UnsupportedBootloader < RuntimeError + attr_reader :bootloader_name + def initialize(bootloader_name) + super "Uninitialized bootlader '#{bootloader_name}'" + @bootloader_name = bootloader_name + end + end + + # universal exception when unrecoverable error found during parsing configuration + # holds in {#reason} translated message what exactly is broken. + class BrokenConfiguration < RuntimeError + include Yast::I18n + attr_reader :reason + + def initialize(msg) + @reason = msg + textdomain "bootloader" + + # TRANSLATORS: %s is translated description of error + super _("Error reading the bootloader configuration files. " \ + "Please use YaST2 bootloader to fix it. Details: %s") % msg + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.203/src/lib/bootloader/grub2_widgets.rb new/yast2-bootloader-3.2.3/src/lib/bootloader/grub2_widgets.rb --- old/yast2-bootloader-3.1.203/src/lib/bootloader/grub2_widgets.rb 2016-08-30 15:58:39.000000000 +0200 +++ new/yast2-bootloader-3.2.3/src/lib/bootloader/grub2_widgets.rb 2016-10-07 16:13:47.000000000 +0200 @@ -472,6 +472,20 @@ Yast::UI.ChangeWidget(Id(:theme), :Value, grub_default.theme || "") end + def validate + if Yast::UI.QueryWidget(Id(:console_frame), :Value) + console_value = Yast::UI.QueryWidget(Id(:console_args), :Value) + if console_value.strip.empty? + Yast::Report.Error( + _("To enable serial console you must provide the corresponding arguments.") + ) + Yast::UI.SetFocus(Id(:console_args)) + return false + end + end + true + end + def store use_serial = Yast::UI.QueryWidget(Id(:console_frame), :Value) use_gfxterm = Yast::UI.QueryWidget(Id(:gfxterm_frame), :Value) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.203/src/lib/bootloader/proposal_client.rb new/yast2-bootloader-3.2.3/src/lib/bootloader/proposal_client.rb --- old/yast2-bootloader-3.1.203/src/lib/bootloader/proposal_client.rb 2016-08-30 15:58:39.000000000 +0200 +++ new/yast2-bootloader-3.2.3/src/lib/bootloader/proposal_client.rb 2016-10-07 16:13:47.000000000 +0200 @@ -21,6 +21,7 @@ Yast.import "BootSupportCheck" Yast.import "Product" Yast.import "PackagesProposal" + Yast.import "Pkg" end PROPOSAL_LINKS = [ @@ -172,13 +173,15 @@ # Add to argument proposal map all errors detected by proposal # @return modified parameter def handle_errors(ret) - if ::Bootloader::BootloaderFactory.current.name == "none" + current_bl = ::Bootloader::BootloaderFactory.current + if current_bl.name == "none" log.error "No bootloader selected" ret["warning_level"] = :warning # warning text in the summary richtext ret["warning"] = _( "No boot loader is selected for installation. Your system might not be bootable." ) + return end if !Yast::BootStorage.bootloader_installable? @@ -186,14 +189,34 @@ ret["warning"] = _( "Because of the partitioning, the bootloader cannot be installed properly" ) + return end if !Yast::BootSupportCheck.SystemSupported ret["warning_level"] = :error ret["warning"] = Yast::BootSupportCheck.StringProblems + return end - ret + pkgs = current_bl.packages.map { |p| [p, Yast::Pkg.ResolvableProperties(p, :package, "")] } + log.info "packages info #{pkgs.inspect}" + pkgs.select! { |_n, p| unselected?(p) } + return if pkgs.empty? + + ret["warning_level"] = :error + ret["warning"] = n_("A package required for booting is deselected (%s). " \ + "Please select it for installation again.", "Packages required for booting are " \ + "deselected (%s). Please select them for installation again.", + pkgs.size) % pkgs.map(&:first).join(", ") + end + + def unselected?(packages) + # if all transactions are done by solver, then it is selected by it + unselected = packages.any? { |p| p["transact_by"] == :user && p["status"] == :available } + not_selected = packages.none? { |p| p["status"] == :selected } + return true if unselected && not_selected + + false end def single_click_action(option, value) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.203/src/lib/bootloader/udev_mapping.rb new/yast2-bootloader-3.2.3/src/lib/bootloader/udev_mapping.rb --- old/yast2-bootloader-3.1.203/src/lib/bootloader/udev_mapping.rb 2016-08-30 15:58:39.000000000 +0200 +++ new/yast2-bootloader-3.2.3/src/lib/bootloader/udev_mapping.rb 2016-10-07 16:13:47.000000000 +0200 @@ -1,6 +1,8 @@ require "yast" require "singleton" +require "bootloader/exceptions" + Yast.import "Storage" Yast.import "Mode" Yast.import "Arch" @@ -10,6 +12,7 @@ class UdevMapping include Singleton include Yast::Logger + include Yast::I18n # make more comfortable to work with singleton class << self @@ -24,23 +27,15 @@ # @raise when device have udev format but do not exists # @return [String,nil] kernel device or nil when running AutoYaST configuration. def to_kernel_device(dev) + textdomain "bootloader" log.info "call to_kernel_device for #{dev}" raise "invalid device nil" unless dev # for non-udev devices try to see specific raid names (bnc#944041) if dev =~ /^\/dev\/disk\/by-/ - # in mode config if not found, then return itself - all_devices[dev] or Yast::Mode.config ? dev : raise("Unknown udev device #{dev}") + udev_to_kernel(dev) else - param = Yast::ArgRef.new({}) - result = Yast::Storage.GetContVolInfo(dev, param) - return dev unless result # not raid with funny name - - info = param.value - return info["vdevice"] unless info["vdevice"].empty? - return info["cdevice"] unless info["cdevice"].empty? - - raise "unknown value for raid device '#{info.inspect}'" + alternative_raid_to_kernel(dev) end end @@ -79,6 +74,28 @@ private + def udev_to_kernel(dev) + return all_devices[dev] if all_devices[dev] + + # in mode config if not found, then return itself + return dev if Yast::Mode.config + + # TRANSLATORS: error message, %s stands for problematic device. + raise(Bootloader::BrokenConfiguration, _("Unknown udev device '%s'") % dev) + end + + def alternative_raid_to_kernel(dev) + param = Yast::ArgRef.new({}) + result = Yast::Storage.GetContVolInfo(dev, param) + return dev unless result # not raid with funny name + + info = param.value + return info["vdevice"] unless info["vdevice"].empty? + return info["cdevice"] unless info["cdevice"].empty? + + raise "unknown value for raid device '#{info.inspect}'" + end + def storage_data_for(kernel_dev) # we do not know if it is partition or disk, but target map help us target_map = Yast::Storage.GetTargetMap diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.203/src/modules/Bootloader.rb new/yast2-bootloader-3.2.3/src/modules/Bootloader.rb --- old/yast2-bootloader-3.1.203/src/modules/Bootloader.rb 2016-08-30 15:58:39.000000000 +0200 +++ new/yast2-bootloader-3.2.3/src/modules/Bootloader.rb 2016-10-07 16:13:47.000000000 +0200 @@ -16,6 +16,7 @@ # $Id$ # require "yast" +require "bootloader/exceptions" require "bootloader/sysconfig" require "bootloader/bootloader_factory" require "bootloader/autoyast_converter" @@ -27,6 +28,7 @@ Yast.import "Initrd" Yast.import "Mode" Yast.import "Progress" +Yast.import "Report" Yast.import "Stage" Yast.import "Storage" Yast.import "StorageDevices" @@ -150,7 +152,32 @@ Progress.NextStage return false if testAbort - ::Bootloader::BootloaderFactory.current.read + begin + ::Bootloader::BootloaderFactory.current.read + rescue ::Bootloader::UnsupportedBootloader => e + ret = Yast::Report.AnyQuestion(_("Unsupported Bootloader"), + _("Unsupported bootloader '%s' detected. Use proposal of supported configuration instead?") % + e.bootloader_name, + _("Use"), + _("Quit"), + :yes) # focus proposing new one + return false unless ret + + ::Bootloader::BootloaderFactory.current = ::Bootloader::BootloaderFactory.proposed + ::Bootloader::BootloaderFactory.current.propose + rescue ::Bootloader::BrokenConfiguration => e + ret = Yast::Report.AnyQuestion(_("Broken Configuration"), + # TRANSLATORS: %s stands for readon why yast cannot process it + _("YaST cannot process current bootloader configuration (%s). " \ + "Propose new configuration from scratch?") % e.reason, + _("Propose"), + _("Quit"), + :yes) # focus proposing new one + return false unless ret + + ::Bootloader::BootloaderFactory.current = ::Bootloader::BootloaderFactory.proposed + ::Bootloader::BootloaderFactory.current.propose + end Progress.Finish diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.203/test/bootloader_factory_test.rb new/yast2-bootloader-3.2.3/test/bootloader_factory_test.rb --- old/yast2-bootloader-3.1.203/test/bootloader_factory_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-bootloader-3.2.3/test/bootloader_factory_test.rb 2016-10-07 16:13:47.000000000 +0200 @@ -0,0 +1,28 @@ +require_relative "test_helper" + +require "bootloader/bootloader_factory" + +describe Bootloader::BootloaderFactory do + describe "#system" do + it "returns BootloaderBase instance according to name in system sysconfig" do + allow(Bootloader::Sysconfig).to receive(:from_system) + .and_return(Bootloader::Sysconfig.new(bootloader: "grub2")) + + expect(Bootloader::BootloaderFactory.system).to be_a(Bootloader::BootloaderBase) + end + + it "raises exception if specified bootloader is not supported" do + allow(Bootloader::Sysconfig).to receive(:from_system) + .and_return(Bootloader::Sysconfig.new(bootloader: "grub")) + + expect { Bootloader::BootloaderFactory.system }.to raise_error(Bootloader::UnsupportedBootloader) + end + + it "returns nil if sysconfig do not specify bootloader" do + allow(Bootloader::Sysconfig).to receive(:from_system) + .and_return(Bootloader::Sysconfig.new) + + expect(Bootloader::BootloaderFactory.system).to eq nil + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.203/test/grub2_widgets_test.rb new/yast2-bootloader-3.2.3/test/grub2_widgets_test.rb --- old/yast2-bootloader-3.1.203/test/grub2_widgets_test.rb 2016-08-30 15:58:39.000000000 +0200 +++ new/yast2-bootloader-3.2.3/test/grub2_widgets_test.rb 2016-10-07 16:13:47.000000000 +0200 @@ -458,6 +458,30 @@ expect(subject.contents).to be_a Yast::Term end + context "validation" do + it "is valid if serial console is not used" do + stub_widget_value(:console_frame, false) + + expect(subject.validate).to eq true + end + + it "is valid if serial console arguments are provided" do + stub_widget_value(:console_frame, true) + stub_widget_value(:console_args, "console=ttyS0,9600n8") + + expect(subject.validate).to eq true + end + + it "reports an error if serial console is used without arguments" do + stub_widget_value(:console_frame, true) + stub_widget_value(:console_args, "") + + expect(Yast::Report).to receive(:Error) + expect(Yast::UI).to receive(:SetFocus).with(Id(:console_args)) + expect(subject.validate).to eq false + end + end + context "initialization" do before do allow(Yast::UI).to receive(:ChangeWidget)
