Hello community, here is the log from the commit of package yast2-bootloader for openSUSE:Factory checked in at 2016-07-16 22:12:42 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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-07-12 23:45:25.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-bootloader.new/yast2-bootloader.changes 2016-07-16 22:12:44.000000000 +0200 @@ -1,0 +2,7 @@ +Wed Jul 13 08:49:50 UTC 2016 - [email protected] + +- fix writing default boot entry when it is located in grub2 + submenu (bnc#986005) +- 3.1.198 + +------------------------------------------------------------------- Old: ---- yast2-bootloader-3.1.197.tar.bz2 New: ---- yast2-bootloader-3.1.198.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-bootloader.spec ++++++ --- /var/tmp/diff_new_pack.yvpKrf/_old 2016-07-16 22:12:45.000000000 +0200 +++ /var/tmp/diff_new_pack.yvpKrf/_new 2016-07-16 22:12:45.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-bootloader -Version: 3.1.197 +Version: 3.1.198 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -28,7 +28,7 @@ BuildRequires: yast2-devtools >= 3.1.10 BuildRequires: yast2-ruby-bindings >= 1.0.0 BuildRequires: yast2-storage -BuildRequires: rubygem(%rb_default_ruby_abi:cfa_grub2) >= 0.4.1 +BuildRequires: rubygem(%rb_default_ruby_abi:cfa_grub2) >= 0.5.1 BuildRequires: rubygem(%rb_default_ruby_abi:rspec) BuildRequires: rubygem(%rb_default_ruby_abi:yast-rake) PreReq: /bin/sed %fillup_prereq @@ -40,8 +40,8 @@ Requires: yast2-packager >= 2.17.24 Requires: yast2-pkg-bindings >= 2.17.25 Requires: yast2-storage >= 2.18.18 -# GRUB_DEFAULT attribute -Requires: rubygem(%rb_default_ruby_abi:cfa_grub2) >= 0.4.1 +# GrubCfg with boot_entries that filter out unbootable entries +Requires: rubygem(%rb_default_ruby_abi:cfa_grub2) >= 0.5.1 # lenses are needed as cfa_grub2 depends only on augeas bindings, but also # lenses are needed here Requires: augeas-lenses ++++++ yast2-bootloader-3.1.197.tar.bz2 -> yast2-bootloader-3.1.198.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/.rubocop.yml new/yast2-bootloader-3.1.198/.rubocop.yml --- old/yast2-bootloader-3.1.197/.rubocop.yml 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/.rubocop.yml 2016-07-15 12:18:52.000000000 +0200 @@ -120,3 +120,7 @@ Style/VariableName: Include: - 'src/lib/**/*.rb' # force known variables only for new code + +# alias method is more convenient method for method aliasing +Style/Alias: + EnforcedStyle: prefer_alias_method diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/.travis.yml new/yast2-bootloader-3.1.198/.travis.yml --- old/yast2-bootloader-3.1.197/.travis.yml 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/.travis.yml 2016-07-15 12:18:52.000000000 +0200 @@ -5,7 +5,7 @@ # disable rvm, use system Ruby - rvm reset - wget https://raw.githubusercontent.com/yast/yast-devtools/master/travis-tools/travis_setup.sh - - sh ./travis_setup.sh -p "yast2-devtools yast2 yast2-storage rake ruby2.1-dev libaugeas-dev pkg-config" -g "gettext yast-rake yard rspec:3.3.0 simplecov coveralls rubocop:0.29.1 cfa_grub2 cheetah" + - sh ./travis_setup.sh -p "yast2-devtools yast2 yast2-storage rake ruby2.1-dev libaugeas-dev pkg-config" -g "gettext yast-rake yard rspec:3.3.0 simplecov coveralls rubocop:0.41.2 cfa_grub2 cheetah" script: - rake check:syntax - rake check:pot diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/package/yast2-bootloader.changes new/yast2-bootloader-3.1.198/package/yast2-bootloader.changes --- old/yast2-bootloader-3.1.197/package/yast2-bootloader.changes 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/package/yast2-bootloader.changes 2016-07-15 12:18:52.000000000 +0200 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Wed Jul 13 08:49:50 UTC 2016 - [email protected] + +- fix writing default boot entry when it is located in grub2 + submenu (bnc#986005) +- 3.1.198 + +------------------------------------------------------------------- Mon Jul 11 12:18:29 UTC 2016 - [email protected] - do not crash after configuration in autoyast bootloader section diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/package/yast2-bootloader.spec new/yast2-bootloader-3.1.198/package/yast2-bootloader.spec --- old/yast2-bootloader-3.1.197/package/yast2-bootloader.spec 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/package/yast2-bootloader.spec 2016-07-15 12:18:52.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-bootloader -Version: 3.1.197 +Version: 3.1.198 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -28,7 +28,7 @@ BuildRequires: yast2-devtools >= 3.1.10 BuildRequires: yast2-ruby-bindings >= 1.0.0 BuildRequires: yast2-storage -BuildRequires: rubygem(%rb_default_ruby_abi:cfa_grub2) >= 0.4.1 +BuildRequires: rubygem(%rb_default_ruby_abi:cfa_grub2) >= 0.5.1 BuildRequires: rubygem(%rb_default_ruby_abi:rspec) BuildRequires: rubygem(%rb_default_ruby_abi:yast-rake) PreReq: /bin/sed %fillup_prereq @@ -40,8 +40,8 @@ Requires: yast2-packager >= 2.17.24 Requires: yast2-pkg-bindings >= 2.17.25 Requires: yast2-storage >= 2.18.18 -# GRUB_DEFAULT attribute -Requires: rubygem(%rb_default_ruby_abi:cfa_grub2) >= 0.4.1 +# GrubCfg with boot_entries that filter out unbootable entries +Requires: rubygem(%rb_default_ruby_abi:cfa_grub2) >= 0.5.1 # lenses are needed as cfa_grub2 depends only on augeas bindings, but also # lenses are needed here Requires: augeas-lenses diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/src/lib/bootloader/autoyast_converter.rb new/yast2-bootloader-3.1.198/src/lib/bootloader/autoyast_converter.rb --- old/yast2-bootloader-3.1.197/src/lib/bootloader/autoyast_converter.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/src/lib/bootloader/autoyast_converter.rb 2016-07-15 12:18:52.000000000 +0200 @@ -111,7 +111,7 @@ "boot_boot" => :BootPartitionDevice, "boot_mbr" => :mbr_disk, "boot_extended" => :ExtendedPartitionDevice - } + }.freeze def import_stage1(data, bootloader) return unless bootloader.name == "grub2" @@ -184,7 +184,7 @@ "boot_boot" => :boot_partition?, "boot_mbr" => :mbr?, "boot_extended" => :extended_partition? - } + }.freeze def export_stage1(res, stage1) STAGE1_MAPPING.each do |key, method| res[key] = stage1.public_send(method) ? "true" : "false" @@ -200,7 +200,7 @@ # only for grub2, not for others GRUB2_BOOLEAN_MAPPING = { "trusted_grub" => :trusted_boot - } + }.freeze def export_grub2(res, bootloader) GRUB2_BOOLEAN_MAPPING.each do |key, method| val = bootloader.public_send(method) @@ -210,23 +210,23 @@ DEFAULT_BOOLEAN_MAPPING = { "os_prober" => :os_prober - } + }.freeze DEFAULT_STRING_MAPPING = { "gfxmode" => :gfxmode, "serial" => :serial_console, "terminal" => :terminal - } + }.freeze DEFAULT_KERNEL_PARAMS_MAPPING = { "append" => :kernel_params, "xen_append" => :xen_kernel_params, "xen_kernel_append" => :xen_hypervisor_params - } + }.freeze SYMBOL_PARAM = [ "terminal" - ] + ].freeze def export_default(res, default) DEFAULT_BOOLEAN_MAPPING.each do |key, method| val = default.public_send(method) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/src/lib/bootloader/boot_record_backup.rb new/yast2-bootloader-3.1.198/src/lib/bootloader/boot_record_backup.rb --- old/yast2-bootloader-3.1.197/src/lib/bootloader/boot_record_backup.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/src/lib/bootloader/boot_record_backup.rb 2016-07-15 12:18:52.000000000 +0200 @@ -9,7 +9,7 @@ BASH_PATH = Yast::Path.new(".target.bash") BASH_OUTPUT_PATH = Yast::Path.new(".target.bash_output") TARGET_SIZE = Yast::Path.new(".target.size") - MAIN_BACKUP_DIR = "/var/lib/YaST2/backup_boot_sectors/" + MAIN_BACKUP_DIR = "/var/lib/YaST2/backup_boot_sectors/".freeze KEPT_BACKUPS = 10 attr_reader :device @@ -120,8 +120,7 @@ Yast::SCR.Execute( BASH_PATH, format("/bin/mv %{path} %{path}-%{date}", - path: device_file_path, date: change_date - ) + path: device_file_path, date: change_date) ) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/src/lib/bootloader/bootloader_factory.rb new/yast2-bootloader-3.1.198/src/lib/bootloader/bootloader_factory.rb --- old/yast2-bootloader-3.1.197/src/lib/bootloader/bootloader_factory.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/src/lib/bootloader/bootloader_factory.rb 2016-07-15 12:18:52.000000000 +0200 @@ -15,7 +15,7 @@ "none", # allows user to manage bootloader itself "grub2", "grub2-efi" - ] + ].freeze class << self attr_writer :current diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/src/lib/bootloader/device_map.rb new/yast2-bootloader-3.1.198/src/lib/bootloader/device_map.rb --- old/yast2-bootloader-3.1.197/src/lib/bootloader/device_map.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/src/lib/bootloader/device_map.rb 2016-07-15 12:18:52.000000000 +0200 @@ -79,7 +79,8 @@ private def sorted_disks - grub_devices.select { |d| d.start_with?("hd") } + grub_devices + .select { |d| d.start_with?("hd") } .sort_by { |dev| dev[2..-1].to_i } end @@ -131,11 +132,11 @@ next if bios_id.empty? index = if Yast::Arch.x86_64 || Yast::Arch.i386 - # it looks like 0x81. It is boot drive unit see http://en.wikipedia.org/wiki/Master_boot_record - bios_id[2..-1].to_i(16) - 0x80 - else - raise "no support for bios id '#{bios_id}' on #{Yast::Arch.architecture}" - end + # it looks like 0x81. It is boot drive unit see http://en.wikipedia.org/wiki/Master_boot_record + bios_id[2..-1].to_i(16) - 0x80 + else + raise "no support for bios id '#{bios_id}' on #{Yast::Arch.architecture}" + end # FATE #303548 - doesn't add disk with same bios_id with different name (multipath machine) if !ids[index] add_mapping("hd#{index}", target_dev) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/src/lib/bootloader/disk_change_detector.rb new/yast2-bootloader-3.1.198/src/lib/bootloader/disk_change_detector.rb --- old/yast2-bootloader-3.1.197/src/lib/bootloader/disk_change_detector.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/src/lib/bootloader/disk_change_detector.rb 2016-07-15 12:18:52.000000000 +0200 @@ -26,9 +26,7 @@ next unless invalid_device?(device) # TRANSLATORS: %s stands for partition - ret << - _("Selected bootloader partition %s is not available any more.") % - device + ret << _("Selected bootloader partition %s is not available any more.") % device end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/src/lib/bootloader/grub2.rb new/yast2-bootloader-3.1.198/src/lib/bootloader/grub2.rb --- old/yast2-bootloader-3.1.197/src/lib/bootloader/grub2.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/src/lib/bootloader/grub2.rb 2016-07-15 12:18:52.000000000 +0200 @@ -204,10 +204,8 @@ if stage1.boot_partition? return Yast::BootStorage.BootPartitionDevice + " (\"/boot\")" end - else - if stage1.root_partition? - return Yast::BootStorage.RootPartitionDevice + " (\"/\")" - end + elsif stage1.root_partition? + return Yast::BootStorage.RootPartitionDevice + " (\"/\")" end "" @@ -239,18 +237,16 @@ "(<a href=\"enable_boot_boot\">install</a>)" ) end + elsif stage1.root_partition? + _( + "Install bootcode into \"/\" partition " \ + "(<a href=\"disable_boot_root\">do not install</a>)" + ) else - if stage1.root_partition? - _( - "Install bootcode into \"/\" partition " \ - "(<a href=\"disable_boot_root\">do not install</a>)" - ) - else - _( - "Do not install bootcode into \"/\" partition " \ - "(<a href=\"enable_boot_root\">install</a>)" - ) - end + _( + "Do not install bootcode into \"/\" partition " \ + "(<a href=\"enable_boot_root\">install</a>)" + ) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/src/lib/bootloader/grub2_widgets.rb new/yast2-bootloader-3.1.198/src/lib/bootloader/grub2_widgets.rb --- old/yast2-bootloader-3.1.197/src/lib/bootloader/grub2_widgets.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/src/lib/bootloader/grub2_widgets.rb 2016-07-15 12:18:52.000000000 +0200 @@ -55,15 +55,14 @@ def help _("<p><b>Timeout in Seconds</b><br>\n" \ - "Specifies the time the bootloader will wait until the default kernel is loaded.</p>\n" - ) + "Specifies the time the bootloader will wait until the default kernel is loaded.</p>\n") end def init - if grub_default.hidden_timeout && grub_default.hidden_timeout.to_i > 0 - self.value = grub_default.hidden_timeout.to_i + self.value = if grub_default.hidden_timeout && grub_default.hidden_timeout.to_i > 0 + grub_default.hidden_timeout.to_i else - self.value = grub_default.timeout.to_i + grub_default.timeout.to_i end end @@ -316,7 +315,7 @@ textdomain "bootloader" end - MASKED_PASSWORD = "**********" + MASKED_PASSWORD = "**********".freeze def contents HBox( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/src/lib/bootloader/grub2base.rb new/yast2-bootloader-3.1.198/src/lib/bootloader/grub2base.rb --- old/yast2-bootloader-3.1.197/src/lib/bootloader/grub2base.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/src/lib/bootloader/grub2base.rb 2016-07-15 12:18:52.000000000 +0200 @@ -61,10 +61,11 @@ return if @pmbr_action == :nothing action_parted = case @pmbr_action - when :add then "on" - when :remove then "off" - else raise "invalid action #{action}" - end + when :add then "on" + when :remove then "off" + else raise "invalid action #{action}" + end + devices.each do |dev| Yast::Execute.locally("parted", "-s", dev, "disk_set", "pmbr_boot", action_parted) end @@ -161,7 +162,7 @@ @password = other.password end - KERNEL_FLAVORS_METHODS = [:kernel_params, :xen_hypervisor_params, :xen_kernel_params] + KERNEL_FLAVORS_METHODS = [:kernel_params, :xen_hypervisor_params, :xen_kernel_params].freeze def merge_grub_default(other) default = grub_default diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/src/lib/bootloader/grub2pwd.rb new/yast2-bootloader-3.1.198/src/lib/bootloader/grub2pwd.rb --- old/yast2-bootloader-3.1.197/src/lib/bootloader/grub2pwd.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/src/lib/bootloader/grub2pwd.rb 2016-07-15 12:18:52.000000000 +0200 @@ -50,7 +50,7 @@ private YAST_BASH_PATH = Yast::Path.new(".local.bash_output") - PWD_ENCRYPTION_FILE = "/etc/grub.d/42_password" + PWD_ENCRYPTION_FILE = "/etc/grub.d/42_password".freeze def propose @used = false @@ -108,7 +108,7 @@ Yast::SCR.Write( Yast::Path.new(".target.string"), - [PWD_ENCRYPTION_FILE, 0700], + [PWD_ENCRYPTION_FILE, 0o700], file_content ) end @@ -125,8 +125,7 @@ quoted_password = Yast::String.Quote(password) result = Yast::WFM.Execute(YAST_BASH_PATH, - "echo '#{quoted_password}\n#{quoted_password}\n' | LANG=C grub2-mkpasswd-pbkdf2" - ) + "echo '#{quoted_password}\n#{quoted_password}\n' | LANG=C grub2-mkpasswd-pbkdf2") if result["exit"] != 0 raise "Failed to create encrypted password for grub2. Command output: #{result["stderr"]}" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/src/lib/bootloader/grub_install.rb new/yast2-bootloader-3.1.198/src/lib/bootloader/grub_install.rb --- old/yast2-bootloader-3.1.197/src/lib/bootloader/grub_install.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/src/lib/bootloader/grub_install.rb 2016-07-15 12:18:52.000000000 +0200 @@ -78,14 +78,14 @@ "s390_64" => "s390x-emu", "ppc" => "powerpc-ieee1275", "ppc64" => "powerpc-ieee1275" - } + }.freeze EFI_TARGETS = { "i386" => "i386-efi", "x86_64" => "x86_64-efi", "arm" => "arm-efi", "aarch64" => "arm64-efi" - } + }.freeze def target return @target if @target diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/src/lib/bootloader/mbr_update.rb new/yast2-bootloader-3.1.198/src/lib/bootloader/mbr_update.rb --- old/yast2-bootloader-3.1.197/src/lib/bootloader/mbr_update.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/src/lib/bootloader/mbr_update.rb 2016-07-15 12:18:52.000000000 +0200 @@ -52,8 +52,8 @@ mbr_type == "gpt" end - GPT_MBR = "/usr/share/syslinux/gptmbr.bin" - DOS_MBR = "/usr/share/syslinux/mbr.bin" + GPT_MBR = "/usr/share/syslinux/gptmbr.bin".freeze + DOS_MBR = "/usr/share/syslinux/mbr.bin".freeze def generic_mbr_file @generic_mbr_file ||= mbr_is_gpt? ? GPT_MBR : DOS_MBR end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/src/lib/bootloader/proposal_client.rb new/yast2-bootloader-3.1.198/src/lib/bootloader/proposal_client.rb --- old/yast2-bootloader-3.1.197/src/lib/bootloader/proposal_client.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/src/lib/bootloader/proposal_client.rb 2016-07-15 12:18:52.000000000 +0200 @@ -30,7 +30,7 @@ "disable_boot_root", "enable_boot_boot", "disable_boot_boot" - ] + ].freeze def make_proposal(attrs) force_reset = attrs["force_reset"] @@ -100,7 +100,7 @@ private - BOOT_SYSCONFIG_PATH = "/etc/sysconfig/bootloader" + BOOT_SYSCONFIG_PATH = "/etc/sysconfig/bootloader".freeze # read bootloader from /mnt as SCR is not yet switched in proposal # phase of update (bnc#874646) def old_bootloader @@ -182,20 +182,15 @@ end if !Yast::BootStorage.bootloader_installable? - ret.merge!( - "warning_level" => :error, - # error in the proposal - "warning" => _( - "Because of the partitioning, the bootloader cannot be installed properly" - ) + ret["warning_level"] = :error + ret["warning"] = _( + "Because of the partitioning, the bootloader cannot be installed properly" ) end if !Yast::BootSupportCheck.SystemSupported - ret.merge!( - "warning_level" => :error, - "warning" => Yast::BootSupportCheck.StringProblems - ) + ret["warning_level"] = :error + ret["warning"] = Yast::BootSupportCheck.StringProblems end ret diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/src/lib/bootloader/sections.rb new/yast2-bootloader-3.1.198/src/lib/bootloader/sections.rb --- old/yast2-bootloader-3.1.197/src/lib/bootloader/sections.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/src/lib/bootloader/sections.rb 2016-07-15 12:18:52.000000000 +0200 @@ -8,29 +8,31 @@ class Sections include Yast::Logger + # @return [Array<String>] list of all available boot titles if initialized + # with grub_cfg otherwise it is empty array attr_reader :all # @param [CFA::Grub2::GrubCfg, nil] grub_cfg - loaded parsed grub cfg tree # or nil if not available yet def initialize(grub_cfg = nil) - @all = grub_cfg ? grub_cfg.sections : [] + @data = grub_cfg ? grub_cfg.boot_entries : [] + @all = @data.map { |e| e[:title] } end - # @return [String] name of default section + # @return [String] title of default boot section. It is not full path, + # so it should be reasonable short def default return @default if @default return @default = "" if Yast::Stage.initial - # Execute.on_target can return nil if call failed. It shows users error popup, but bootloader - # can continue with empty default section - saved = Yast::Execute.on_target("/usr/bin/grub2-editenv", "list", stdout: :capture) || "" - saved_line = saved.lines.grep(/saved_entry=/).first + default_path = read_default_path - @default = saved_line ? saved_line[/saved_entry=(.*)$/, 1] : all.first + @default = default_path ? path_to_title(default_path) : all.first || "" end - # Sets default section internally + # Sets default section internally. + # @param [String] new boot title to boot # @note to write it to system use #write later def default=(value) log.info "set new default to '#{value.inspect}'" @@ -44,7 +46,38 @@ # writes default to system making it persistent def write return if default.empty? - Yast::Execute.on_target("/usr/sbin/grub2-set-default", default) + + Yast::Execute.on_target("/usr/sbin/grub2-set-default", title_to_path(default)) + end + + private + + # @return [String, nil] return default boot path as string or nil if not set + # or something goes wrong + # @note shows error popup if calling grub2-editenv failed + def read_default_path + # Execute.on_target can return nil if call failed. It shows users error popup, but bootloader + # can continue with empty default section + saved = Yast::Execute.on_target("/usr/bin/grub2-editenv", "list", stdout: :capture) || "" + saved_line = saved.lines.grep(/saved_entry=/).first + + saved_line ? saved_line[/saved_entry=(.*)$/, 1] : nil + end + + # @return [String] convert grub boot path to title that can be displayed. If + # entry not found, then return argument + def path_to_title(path) + entry = @data.find { |e| e[:path] == path } + + entry ? entry[:title] : path + end + + # @return [String] convert displayable title to grub boot path. If + # entry not found, then return argument + def title_to_path(title) + entry = @data.find { |e| e[:title] == title } + + entry ? entry[:path] : title end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/src/lib/bootloader/serial_console.rb new/yast2-bootloader-3.1.198/src/lib/bootloader/serial_console.rb --- old/yast2-bootloader-3.1.197/src/lib/bootloader/serial_console.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/src/lib/bootloader/serial_console.rb 2016-07-15 12:18:52.000000000 +0200 @@ -11,10 +11,10 @@ "n" => "no", "o" => "odd", "e" => "even" - } + }.freeze SPEED_DEFAULT = 9600 - PARITY_DEFAULT = "no" - WORD_DEFAULT = "" + PARITY_DEFAULT = "no".freeze + WORD_DEFAULT = "".freeze # REGEXP that separate usefull parts of kernel parameter for serial console # matching groups are: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/src/lib/bootloader/stage1_device.rb new/yast2-bootloader-3.1.198/src/lib/bootloader/stage1_device.rb --- old/yast2-bootloader-3.1.197/src/lib/bootloader/stage1_device.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/src/lib/bootloader/stage1_device.rb 2016-07-15 12:18:52.000000000 +0200 @@ -58,10 +58,9 @@ disk_data = Yast::Storage.GetDiskPartition(dev) if disk?(disk_data) disk = Yast::Storage.GetDisk(tm, dev) - if disk["type"] == :CT_MD - # md disk is just virtual device, so select underlaying device /boot partition - return underlaying_disk_with_boot_partition - elsif disk["type"] == :CT_LVM + # md disk is just virtual device, so select underlaying device /boot partition + return underlaying_disk_with_boot_partition if disk["type"] == :CT_MD + if disk["type"] == :CT_LVM res = lvm_underlaying_devices(disk) return res.map { |r| Yast::Storage.GetDiskPartition(r)["disk"] } end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/src/lib/bootloader/stage1_proposal.rb new/yast2-bootloader-3.1.198/src/lib/bootloader/stage1_proposal.rb --- old/yast2-bootloader-3.1.197/src/lib/bootloader/stage1_proposal.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/src/lib/bootloader/stage1_proposal.rb 2016-07-15 12:18:52.000000000 +0200 @@ -253,7 +253,7 @@ end end - AVAILABLE_PROPOSALS = { + AVAILABLE_PROPOSALS = { # rubocop:disable Style/MutableConstant default_proc conflict "i386" => X64, "x86_64" => X64, "s390_32" => S390, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/src/lib/bootloader/sysconfig.rb new/yast2-bootloader-3.1.198/src/lib/bootloader/sysconfig.rb --- old/yast2-bootloader-3.1.197/src/lib/bootloader/sysconfig.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/src/lib/bootloader/sysconfig.rb 2016-07-15 12:18:52.000000000 +0200 @@ -11,7 +11,7 @@ bootloader: "LOADER_TYPE", secure_boot: "SECURE_BOOT", trusted_boot: "TRUSTED_BOOT" - } + }.freeze # specifies bootloader in sysconfig attr_accessor :bootloader @@ -31,10 +31,10 @@ bootloader = Yast::SCR.Read(AGENT_PATH + "LOADER_TYPE") # propose secure boot always to true (bnc#872054), otherwise respect user choice # but only on architectures that support it (bnc#984895) - if Yast::Arch.x86_64 || Yast::Arch.i386 - secure_boot = Yast::SCR.Read(AGENT_PATH + "SECURE_BOOT") != "no" + secure_boot = if Yast::Arch.x86_64 || Yast::Arch.i386 + Yast::SCR.Read(AGENT_PATH + "SECURE_BOOT") != "no" else - secure_boot = false + false end trusted_boot = Yast::SCR.Read(AGENT_PATH + "TRUSTED_BOOT") == "yes" @@ -85,7 +85,7 @@ "# Enable Trusted Boot support\n" \ "# Only available for legacy (non-UEFI) boot.\n" \ "#\n" - } + }.freeze def write log.info "Saving /etc/sysconfig/bootloader for #{bootloader}" @@ -120,11 +120,9 @@ return if File.exist?(File.join(destdir, "/etc/sysconfig")) Yast::WFM.Execute(Yast::Path.new(".local.mkdir"), - File.join(destdir, "/etc/sysconfig") - ) + File.join(destdir, "/etc/sysconfig")) Yast::WFM.Execute(Yast::Path.new(".local.bash"), - "touch #{destdir}/etc/sysconfig/bootloader" - ) + "touch #{destdir}/etc/sysconfig/bootloader") end def temporary_target_agent(&block) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/src/lib/bootloader/udev_mapping.rb new/yast2-bootloader-3.1.198/src/lib/bootloader/udev_mapping.rb --- old/yast2-bootloader-3.1.197/src/lib/bootloader/udev_mapping.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/src/lib/bootloader/udev_mapping.rb 2016-07-15 12:18:52.000000000 +0200 @@ -128,7 +128,7 @@ id: "udev_id", path: "udev_path", label: "label" - } + }.freeze # Maps udev key in Storage target map to device prefix UDEV_MAPPING = { @@ -136,7 +136,7 @@ "udev_id" => "/dev/disk/by-id/", "udev_path" => "/dev/disk/by-path/", "label" => "/dev/disk/by-label/" - } + }.freeze # Maps udev names to kernel names with given mapping from data to device # @private internall use only diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/src/modules/BootArch.rb new/yast2-bootloader-3.1.198/src/modules/BootArch.rb --- old/yast2-bootloader-3.1.197/src/modules/BootArch.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/src/modules/BootArch.rb 2016-07-15 12:18:52.000000000 +0200 @@ -51,10 +51,10 @@ ret << " splash=silent quiet showopts" return ret elsif Arch.s390 - if ENV["TERM"] == "linux" - termparm = "TERM=linux console=ttyS0 console=ttyS1" + termparm = if ENV["TERM"] == "linux" + "TERM=linux console=ttyS0 console=ttyS1" else - termparm = "hvc_iucv=8 TERM=dumb" + "hvc_iucv=8 TERM=dumb" end parameters = "#{features} #{termparm}" parameters << " resume=#{resume}" unless resume.empty? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/src/modules/BootStorage.rb new/yast2-bootloader-3.1.198/src/modules/BootStorage.rb --- old/yast2-bootloader-3.1.197/src/modules/BootStorage.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/src/modules/BootStorage.rb 2016-07-15 12:18:52.000000000 +0200 @@ -264,10 +264,10 @@ end partitions.each do |s| # bnc#577127 - Encrypted swap is not properly set up as resume device - if s["crypt_device"] && !s["crypt_device"].empty? - dev = s["crypt_device"] + dev = if s["crypt_device"] && !s["crypt_device"].empty? + s["crypt_device"] else - dev = s["device"] + s["device"] end ret[dev] = s["size_k"] || 0 end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/src/modules/BootSupportCheck.rb new/yast2-bootloader-3.1.198/src/modules/BootSupportCheck.rb --- old/yast2-bootloader-3.1.197/src/modules/BootSupportCheck.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/src/modules/BootSupportCheck.rb 2016-07-15 12:18:52.000000000 +0200 @@ -185,12 +185,12 @@ boot_part = Storage.GetEntryForMountpoint("/boot") if boot_part.empty? boot_part = Storage.GetEntryForMountpoint("/") if boot_part.empty? - if [:ext2, :ext3, :ext4].include? boot_part["used_fs"] - return true - else + if ![:ext2, :ext3, :ext4].include? boot_part["used_fs"] add_new_problem(_("Missing ext partition for booting. Cannot install boot code.")) return false end + + true end def check_activate_partition diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/src/modules/Bootloader.rb new/yast2-bootloader-3.1.198/src/modules/Bootloader.rb --- old/yast2-bootloader-3.1.197/src/modules/Bootloader.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/src/modules/Bootloader.rb 2016-07-15 12:18:52.000000000 +0200 @@ -35,7 +35,7 @@ class BootloaderClass < Module include Yast::Logger - BOOLEAN_MAPPING = { true => :present, false => :missing } + BOOLEAN_MAPPING = { true => :present, false => :missing }.freeze def main textdomain "bootloader" @@ -93,16 +93,17 @@ # AutoYaST configuration mode. There is no access to the system Yast::BootStorage.detect_disks + factory = ::Bootloader::BootloaderFactory + imported_configuration = ::Bootloader::AutoyastConverter.import(data) - ::Bootloader::BootloaderFactory.clear_cache + factory.clear_cache - proposed_configuration = ::Bootloader::BootloaderFactory - .bootloader_by_name(imported_configuration.name) + proposed_configuration = factory.bootloader_by_name(imported_configuration.name) unless Mode.config # no AutoYaST configuration mode proposed_configuration.propose proposed_configuration.merge(imported_configuration) end - ::Bootloader::BootloaderFactory.current = proposed_configuration + factory.current = proposed_configuration true end @@ -267,7 +268,7 @@ :common => "append", :xen_guest => "xen_append", :xen_host => "xen_kernel_append" - } + }.freeze # Gets value for given parameter in kernel parameters for given flavor. # @param [Symbol] flavor flavor of kernel, for possible values see #modify_kernel_param @@ -301,11 +302,11 @@ return :missing unless current_bl.respond_to?(:grub_default) grub_default = current_bl.grub_default params = case flavor - when :common then grub_default.kernel_params - when :xen_guest then grub_default.xen_kernel_params - when :xen_host then grub_default.xen_hypervisor_params - else raise ArgumentError, "Unknown flavor #{flavor}" - end + when :common then grub_default.kernel_params + when :xen_guest then grub_default.xen_kernel_params + when :xen_host then grub_default.xen_hypervisor_params + else raise ArgumentError, "Unknown flavor #{flavor}" + end res = params.parameter(key) @@ -427,7 +428,7 @@ Initrd.changed = true if Arch.s390 && Stage.initial end - NONSPLASH_VGA_VALUES = ["", "false", "ask"] + NONSPLASH_VGA_VALUES = ["", "false", "ask"].freeze # store new vgamode if needed and regenerate initrd in such case # @param params_to_save used to store predefined vgamode value diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/test/boot_storage_test.rb new/yast2-bootloader-3.1.198/test/boot_storage_test.rb --- old/yast2-bootloader-3.1.197/test/boot_storage_test.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/test/boot_storage_test.rb 2016-07-15 12:18:52.000000000 +0200 @@ -9,7 +9,7 @@ let(:possible_locations) { subject.possible_locations_for_stage1 } before do target_map_stub("storage_mdraid.yaml") - allow(Yast::Arch).to receive(:s390).and_return(false) # be arch agnostic + allow(Yast::Arch).to receive(:architecture).and_return("x86_64") # be arch agnostic allow(Yast::Storage).to receive(:GetDefaultMountBy).and_return(:device) allow(Yast::Storage).to receive(:GetContVolInfo).and_return(false) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/test/bootloader_finish_client_test.rb new/yast2-bootloader-3.1.198/test/bootloader_finish_client_test.rb --- old/yast2-bootloader-3.1.197/test/bootloader_finish_client_test.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/test/bootloader_finish_client_test.rb 2016-07-15 12:18:52.000000000 +0200 @@ -9,7 +9,7 @@ before do Yast.import "Arch" - allow(Yast::Arch).to receive(:s390).and_return(false) + allow(Yast::Arch).to receive(:architecture).and_return("x86_64") Bootloader::BootloaderFactory.current_name = "grub2" @current_bl = Bootloader::BootloaderFactory.current @@ -33,7 +33,7 @@ end it "sets on s390 systems reboot message if reipl return not different" do - allow(Yast::Arch).to receive(:s390).and_return(true) + allow(Yast::Arch).to receive(:architecture).and_return("s390_64") expect(Yast::WFM).to receive(:ClientExists).and_return(true) expect(Yast::WFM).to receive(:call).and_return( @@ -49,7 +49,7 @@ end it "sets on s390 systems shut down message if reipl return different as true" do - allow(Yast::Arch).to receive(:s390).and_return(true) + allow(Yast::Arch).to receive(:architecture).and_return("s390_64") expect(Yast::WFM).to receive(:ClientExists).and_return(true) expect(Yast::WFM).to receive(:call).and_return( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/test/bootloader_proposal_client_test.rb new/yast2-bootloader-3.1.198/test/bootloader_proposal_client_test.rb --- old/yast2-bootloader-3.1.197/test/bootloader_proposal_client_test.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/test/bootloader_proposal_client_test.rb 2016-07-15 12:18:52.000000000 +0200 @@ -110,7 +110,7 @@ allow(Yast::BootStorage).to receive(:bootloader_installable?).and_return(true) Yast.import "Arch" - allow(Yast::Arch).to receive(:s390) + allow(Yast::Arch).to receive(:architecture).and_return("x86_64") end it "returns map with links set to single click actions" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/test/grub2_test.rb new/yast2-bootloader-3.1.198/test/grub2_test.rb --- old/yast2-bootloader-3.1.197/test/grub2_test.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/test/grub2_test.rb 2016-07-15 12:18:52.000000000 +0200 @@ -185,7 +185,7 @@ context "when arch is not s390" do before do - allow(Yast::Arch).to receive(:s390).and_return(false) + allow(Yast::Arch).to receive(:architecture).and_return("x86_64") end it "includes order of hard disks if there are more than 1" do @@ -204,7 +204,7 @@ context "when arch is s390" do before do - allow(Yast::Arch).to receive(:s390).and_return(true) + allow(Yast::Arch).to receive(:architecture).and_return("s390_64") end it "does not includes order of hard disks" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/test/grub2_widgets_test.rb new/yast2-bootloader-3.1.198/test/grub2_widgets_test.rb --- old/yast2-bootloader-3.1.197/test/grub2_widgets_test.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/test/grub2_widgets_test.rb 2016-07-15 12:18:52.000000000 +0200 @@ -594,7 +594,11 @@ describe Bootloader::DefaultSectionWidget do before do - grub_cfg = double(sections: ["openSUSE", "windows"]) + sections = [ + { title: "openSUSE", path: "openSUSE" }, + { title: "windows", path: "windows" } + ] + grub_cfg = double(boot_entries: sections) assign_bootloader sections = Bootloader::Sections.new(grub_cfg) # fake section list @@ -618,10 +622,9 @@ end it "enlists all available sections" do - expect(subject.items).to eq([ - ["openSUSE", "openSUSE"], - ["windows", "windows"] - ]) + sections = [["openSUSE", "openSUSE"], ["windows", "windows"]] + + expect(subject.items).to eq(sections) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/test/grub2pwd_test.rb new/yast2-bootloader-3.1.198/test/grub2pwd_test.rb --- old/yast2-bootloader-3.1.197/test/grub2pwd_test.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/test/grub2pwd_test.rb 2016-07-15 12:18:52.000000000 +0200 @@ -17,14 +17,14 @@ .and_return(exists) end - ENCRYPTED_PASSWORD = "grub.pbkdf2.sha512.10000.774E325959D6D7BCFB7384A0245674D83D0D540A89C02FEA81E35489F8DE7ADFD93988190AD9857A0FFF363825DDF97C8F4E658D8CC49FC4A22C053B08AB3EFE.6FB19FF26FD03D85C40A33D8BA7C04E72EDE3DD5D7080C177553A4FED370F71C579AF0B15B3B93ECECEA355469A4B6D0560BFB53ED35DDA0B80F5363BFBD54E4" + ENCRYPTED_PASSWORD = "grub.pbkdf2.sha512.10000.774E325959D6D7BCFB7384A0245674D83D0D540A89C02FEA81E35489F8DE7ADFD93988190AD9857A0FFF363825DDF97C8F4E658D8CC49FC4A22C053B08AB3EFE.6FB19FF26FD03D85C40A33D8BA7C04E72EDE3DD5D7080C177553A4FED370F71C579AF0B15B3B93ECECEA355469A4B6D0560BFB53ED35DDA0B80F5363BFBD54E4".freeze FILE_CONTENT_RESTRICTED = "#! /bin/sh\n" \ "exec tail -n +3 $0\n" \ "# File created by YaST and next YaST run probably overwrite it\n" \ "set superusers=\"root\"\n" \ "password_pbkdf2 root #{ENCRYPTED_PASSWORD}\n" \ - "export superusers\n" + "export superusers\n".freeze FILE_CONTENT_UNRESTRICTED = FILE_CONTENT_RESTRICTED + "set unrestricted_menu=\"y\"\n" \ @@ -32,7 +32,7 @@ FILE_CONTENT_WRONG = "#! /bin/sh\n" \ "exec tail -n +3 $0\n" \ - "# File created by YaST and next YaST run probably overwrite it\n" \ + "# File created by YaST and next YaST run probably overwrite it\n".freeze \ describe ".new" do @@ -165,7 +165,7 @@ expect(Yast::SCR).to receive(:Write) .with( path(".target.string"), - [described_class::PWD_ENCRYPTION_FILE, 0700], + [described_class::PWD_ENCRYPTION_FILE, 0o700], FILE_CONTENT_RESTRICTED ) @@ -177,7 +177,7 @@ expect(Yast::SCR).to receive(:Write) .with( path(".target.string"), - [described_class::PWD_ENCRYPTION_FILE, 0700], + [described_class::PWD_ENCRYPTION_FILE, 0o700], FILE_CONTENT_UNRESTRICTED ) @@ -189,7 +189,7 @@ expect(Yast::SCR).to receive(:Write) .with( path(".target.string"), - [described_class::PWD_ENCRYPTION_FILE, 0700], + [described_class::PWD_ENCRYPTION_FILE, 0o700], FILE_CONTENT_RESTRICTED ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/test/kexec_test.rb new/yast2-bootloader-3.1.198/test/kexec_test.rb --- old/yast2-bootloader-3.1.197/test/kexec_test.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/test/kexec_test.rb 2016-07-15 12:18:52.000000000 +0200 @@ -13,8 +13,7 @@ allow(Yast::ProductFeatures).to receive(:GetBooleanFeature) .with("globals", "kexec_reboot").and_return(true) Yast.import "Arch" - allow(Yast::Arch).to receive(:ppc).and_return(false) - allow(Yast::Arch).to receive(:s390).and_return(false) + allow(Yast::Arch).to receive(:architecture).and_return("x86_64") Yast.import "Mode" allow(Yast::Mode).to receive(:live_installation).and_return(false) allow(Yast::SCR).to receive(:Read) @@ -37,15 +36,13 @@ end it "returns false if running on s390" do - Yast.import "Arch" - allow(Yast::Arch).to receive(:s390).and_return(true) + allow(Yast::Arch).to receive(:architecture).and_return("s390_64") expect(subject.prepare_environment).to be false end it "returns false if running on ppc" do - Yast.import "Arch" - allow(Yast::Arch).to receive(:ppc).and_return(true) + allow(Yast::Arch).to receive(:architecture).and_return("ppc64") expect(subject.prepare_environment).to be false end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/test/mbr_update_test.rb new/yast2-bootloader-3.1.198/test/mbr_update_test.rb --- old/yast2-bootloader-3.1.197/test/mbr_update_test.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/test/mbr_update_test.rb 2016-07-15 12:18:52.000000000 +0200 @@ -34,8 +34,7 @@ # fake query for gpt label allow(Yast::Storage).to receive(:GetTargetMap).and_return( double(:fetch => { "label" => "msdos" }, - :[] => { "label" => "msdos" } - ) + :[] => { "label" => "msdos" }) ) end @@ -157,8 +156,7 @@ before do allow(Yast::Storage).to receive(:GetTargetMap).and_return( double(:fetch => { "label" => "msdos" }, - :[] => { "label" => "msdos" } - ) + :[] => { "label" => "msdos" }) ) end @@ -196,8 +194,7 @@ before do allow(Yast::Storage).to receive(:GetTargetMap).and_return( double(:fetch => { "label" => "gpt" }, - :[] => { "label" => "gpt" } - ) + :[] => { "label" => "gpt" }) ) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/test/sections_test.rb new/yast2-bootloader-3.1.198/test/sections_test.rb --- old/yast2-bootloader-3.1.197/test/sections_test.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/test/sections_test.rb 2016-07-15 12:18:52.000000000 +0200 @@ -6,7 +6,11 @@ describe Bootloader::Sections do subject do - grub_cfg = double("CFA::Grub2::GrubCfg", sections: ["linux", "windows"]) + sections = [ + { title: "linux", path: "linux" }, + { title: "windows", path: "alien>windows" } + ] + grub_cfg = double("CFA::Grub2::GrubCfg", boot_entries: sections) Bootloader::Sections.new(grub_cfg) end @@ -20,7 +24,7 @@ it "gets name of default section stored in grub2" do expect(Yast::Execute).to receive(:on_target) .with("/usr/bin/grub2-editenv", "list", stdout: :capture) - .and_return("saved_entry=windows\nbla_bla=no\n") + .and_return("saved_entry=alien>windows\nbla_bla=no\n") expect(subject.default).to eq "windows" end @@ -57,5 +61,14 @@ subject.write end + + it "converts default value to its path" do + subject.default = "windows" + + expect(Yast::Execute).to receive(:on_target) + .with("/usr/sbin/grub2-set-default", "alien>windows") + + subject.write + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.197/test/sysconfig_test.rb new/yast2-bootloader-3.1.198/test/sysconfig_test.rb --- old/yast2-bootloader-3.1.197/test/sysconfig_test.rb 2016-07-11 15:22:46.000000000 +0200 +++ new/yast2-bootloader-3.1.198/test/sysconfig_test.rb 2016-07-15 12:18:52.000000000 +0200 @@ -69,7 +69,8 @@ it "write comments for attributes if it is not already written" do sysconfig = Bootloader::Sysconfig.new(bootloader: "grub2", secure_boot: true) allow(Yast::SCR).to receive(:Read).with( - Yast::Path.new(".sysconfig.bootloader.SECURE_BOOT.comment")) + Yast::Path.new(".sysconfig.bootloader.SECURE_BOOT.comment") + ) .and_return("comment ABC") expect(Yast::SCR).to receive(:Write).with( Yast::Path.new(".sysconfig.bootloader.LOADER_TYPE.comment"), anything
