Hello community,

here is the log from the commit of package yast2-bootloader for 
openSUSE:Factory checked in at 2019-02-28 21:47:31
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-bootloader (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-bootloader.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-bootloader"

Thu Feb 28 21:47:31 2019 rev:273 rq:679802 version:4.1.19

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-bootloader/yast2-bootloader.changes        
2019-02-15 09:54:06.823784400 +0100
+++ 
/work/SRC/openSUSE:Factory/.yast2-bootloader.new.28833/yast2-bootloader.changes 
    2019-02-28 21:47:33.157418785 +0100
@@ -1,0 +2,16 @@
+Wed Feb 27 10:07:40 UTC 2019 - [email protected]
+
+- Use the correct path for /usr/bin/mkdir (bsc#1127138).
+- 4.1.19
+
+-------------------------------------------------------------------
+Thu Feb 21 16:27:37 UTC 2019 - [email protected]
+
+- Relax check for bios_boot when logical device over more disks is
+  used to check that at least one disk can be bootable.
+  (bsc#1125792)
+- Also relax installation of grub2. When at least one location
+  success then do not complain, just log it.
+- 4.1.18
+
+-------------------------------------------------------------------

Old:
----
  yast2-bootloader-4.1.17.tar.bz2

New:
----
  yast2-bootloader-4.1.19.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ yast2-bootloader.spec ++++++
--- /var/tmp/diff_new_pack.6vqmr3/_old  2019-02-28 21:47:33.673418565 +0100
+++ /var/tmp/diff_new_pack.6vqmr3/_new  2019-02-28 21:47:33.673418565 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-bootloader
-Version:        4.1.17
+Version:        4.1.19
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build

++++++ yast2-bootloader-4.1.17.tar.bz2 -> yast2-bootloader-4.1.19.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-bootloader-4.1.17/package/yast2-bootloader.changes 
new/yast2-bootloader-4.1.19/package/yast2-bootloader.changes
--- old/yast2-bootloader-4.1.17/package/yast2-bootloader.changes        
2019-02-14 09:43:59.000000000 +0100
+++ new/yast2-bootloader-4.1.19/package/yast2-bootloader.changes        
2019-02-27 13:40:20.000000000 +0100
@@ -1,4 +1,20 @@
 -------------------------------------------------------------------
+Wed Feb 27 10:07:40 UTC 2019 - [email protected]
+
+- Use the correct path for /usr/bin/mkdir (bsc#1127138).
+- 4.1.19
+
+-------------------------------------------------------------------
+Thu Feb 21 16:27:37 UTC 2019 - [email protected]
+
+- Relax check for bios_boot when logical device over more disks is
+  used to check that at least one disk can be bootable.
+  (bsc#1125792)
+- Also relax installation of grub2. When at least one location
+  success then do not complain, just log it.
+- 4.1.18
+
+-------------------------------------------------------------------
 Thu Feb 14 07:56:05 UTC 2019 - [email protected]
 
 - Do not crash if generated grub.cfg is missing (bsc#1124064)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-bootloader-4.1.17/package/yast2-bootloader.spec 
new/yast2-bootloader-4.1.19/package/yast2-bootloader.spec
--- old/yast2-bootloader-4.1.17/package/yast2-bootloader.spec   2019-02-14 
09:43:59.000000000 +0100
+++ new/yast2-bootloader-4.1.19/package/yast2-bootloader.spec   2019-02-27 
13:40:20.000000000 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-bootloader
-Version:        4.1.17
+Version:        4.1.19
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-bootloader-4.1.17/src/lib/bootloader/boot_record_backup.rb 
new/yast2-bootloader-4.1.19/src/lib/bootloader/boot_record_backup.rb
--- old/yast2-bootloader-4.1.17/src/lib/bootloader/boot_record_backup.rb        
2019-02-14 09:43:59.000000000 +0100
+++ new/yast2-bootloader-4.1.19/src/lib/bootloader/boot_record_backup.rb        
2019-02-27 13:40:20.000000000 +0100
@@ -36,7 +36,7 @@
     # Backup is stored in /var/lib/YaST2/backup_boot_sectors, in logs
     # directory and if it is MBR of primary disk, then also in /boot/backup_mbr
     def write
-      Yast::SCR.Execute(BASH_PATH, "/usr/sbin/mkdir -p 
#{MAIN_BACKUP_DIR.shellescape}")
+      Yast::SCR.Execute(BASH_PATH, "/usr/bin/mkdir -p 
#{MAIN_BACKUP_DIR.shellescape}")
 
       if exists?
         rotate
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-bootloader-4.1.17/src/lib/bootloader/grub2.rb 
new/yast2-bootloader-4.1.19/src/lib/bootloader/grub2.rb
--- old/yast2-bootloader-4.1.17/src/lib/bootloader/grub2.rb     2019-02-14 
09:43:59.000000000 +0100
+++ new/yast2-bootloader-4.1.19/src/lib/bootloader/grub2.rb     2019-02-27 
13:40:20.000000000 +0100
@@ -58,7 +58,6 @@
       super
 
       device_map.write if Yast::Arch.x86_64 || Yast::Arch.i386
-      stage1.write
 
       # TODO: own class handling PBMR
       # set it only for gpt disk bsc#1008092
@@ -66,7 +65,9 @@
 
       # powernv must not call grub2-install (bnc#970582)
       unless Yast::Arch.board_powernv
-        @grub_install.execute(devices: stage1.devices, trusted_boot: 
trusted_boot)
+        failed = @grub_install.execute(devices: stage1.devices, trusted_boot: 
trusted_boot)
+        failed.each { |f| stage1.remove_device(f) }
+        stage1.write
       end
       # Do some mbr activations ( s390 do not have mbr nor boot flag on its 
disks )
       # powernv do not have prep partition, so we do not have any partition to 
activate (bnc#970582)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-bootloader-4.1.17/src/lib/bootloader/grub_install.rb 
new/yast2-bootloader-4.1.19/src/lib/bootloader/grub_install.rb
--- old/yast2-bootloader-4.1.17/src/lib/bootloader/grub_install.rb      
2019-02-14 09:43:59.000000000 +0100
+++ new/yast2-bootloader-4.1.19/src/lib/bootloader/grub_install.rb      
2019-02-27 13:40:20.000000000 +0100
@@ -2,14 +2,26 @@
 require "yast2/execute"
 
 Yast.import "Arch"
+Yast.import "Report"
 
 module Bootloader
   # Wraps grub install script for easier usage.
   class GrubInstall
+    include Yast::Logger
+    include Yast::I18n
+
     def initialize(efi: false)
       @efi = efi
+      textdomain "bootloader"
     end
 
+    # Runs grub2 install command.
+    #
+    # @param devices[Array<String>] list of devices where grub2 should be 
installed.
+    #   Ignored when grub2 does not need device.
+    # @param secure_boot [Boolean] if secure boot variant should be used
+    # @param trusted_boot [Boolean] if trusted boot variant should be used
+    # @return [Array<String>] list of devices for which install failed
     def execute(devices: [], secure_boot: false, trusted_boot: false)
       raise "cannot have secure boot without efi" if secure_boot && !efi
 
@@ -17,8 +29,26 @@
 
       if no_device_install?
         Yast::Execute.on_target(cmd)
+        []
       else
-        devices.each { |d| Yast::Execute.on_target(cmd + [d]) }
+        return [] if devices.empty?
+
+        last_failure = nil
+        res = devices.select do |device|
+          begin
+            Yast::Execute.on_target!(cmd + [device])
+            false
+          rescue Cheetah::ExecutionFailed => e
+            log.warn "Failed to install grub to device #{device}. #{e.inspect}"
+            last_failure = e
+            true
+          end
+        end
+
+        # Failed to install to all devices
+        report_failure(last_failure) if res.size == devices.size
+
+        res
       end
     end
 
@@ -26,6 +56,19 @@
 
     attr_reader :efi
 
+    def report_failure(exception)
+      Yast::Report.Error(
+        _(
+          "Installing GRUB2 to device failed.\n" \
+          "Command `%{command}`.\n" \
+          "Error output: %{stderr}"
+        ) % {
+          command: exception.commands.inspect,
+          stderr:  exception.stderr
+        }
+      )
+    end
+
     # creates basic command for grub2 install without specifying any stage1
     # locations
     def basic_cmd(secure_boot, trusted_boot)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-bootloader-4.1.17/src/modules/BootSupportCheck.rb 
new/yast2-bootloader-4.1.19/src/modules/BootSupportCheck.rb
--- old/yast2-bootloader-4.1.17/src/modules/BootSupportCheck.rb 2019-02-14 
09:43:59.000000000 +0100
+++ new/yast2-bootloader-4.1.19/src/modules/BootSupportCheck.rb 2019-02-27 
13:40:20.000000000 +0100
@@ -105,7 +105,10 @@
       gpt_disks = BootStorage.stage1_disks_for(boot_fs).select(&:gpt?)
       return true if gpt_disks.empty?
       return true if boot_fs.type != ::Y2Storage::Filesystems::Type::BTRFS
-      return true if gpt_disks.all? { |disk| disk.partitions.any? { |p| 
p.id.is?(:bios_boot) } }
+      # more relax check, at least one disk is enough. Let propose more 
advanced stuff like boot
+      # duplicite md raid1 with bios_boot on all disks to storage and user. 
Check there only when
+      # we are sure it is problem (bsc#1125792)
+      return true if gpt_disks.any? { |disk| disk.partitions.any? { |p| 
p.id.is?(:bios_boot) } }
 
       Builtins.y2error("Used together boot from MBR, gpt, btrfs and without 
bios_grub partition.")
       # TRANSLATORS: description of technical problem. Do not translate 
technical terms unless native language have well known translation.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-bootloader-4.1.17/test/grub2_test.rb 
new/yast2-bootloader-4.1.19/test/grub2_test.rb
--- old/yast2-bootloader-4.1.17/test/grub2_test.rb      2019-02-14 
09:43:59.000000000 +0100
+++ new/yast2-bootloader-4.1.19/test/grub2_test.rb      2019-02-27 
13:40:20.000000000 +0100
@@ -73,7 +73,7 @@
 
       grub2_install = double(Bootloader::GrubInstall)
       expect(grub2_install).to receive(:execute)
-        .with(devices: ["/dev/sda", "/dev/sdb1"], trusted_boot: false)
+        .with(devices: ["/dev/sda", "/dev/sdb1"], trusted_boot: 
false).and_return([])
       expect(Bootloader::GrubInstall).to receive(:new).with(efi: 
false).and_return(grub2_install)
 
       subject.trusted_boot = false
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-bootloader-4.1.17/test/grub_install_test.rb 
new/yast2-bootloader-4.1.19/test/grub_install_test.rb
--- old/yast2-bootloader-4.1.17/test/grub_install_test.rb       2019-02-14 
09:43:59.000000000 +0100
+++ new/yast2-bootloader-4.1.19/test/grub_install_test.rb       2019-02-27 
13:40:20.000000000 +0100
@@ -27,8 +27,13 @@
       params << "--no-nvram" << "--removable" if removable
       params << device if device
 
-      expect(Yast::Execute).to receive(:on_target)
-        .with(params)
+      if device
+        expect(Yast::Execute).to receive(:on_target!)
+          .with(params)
+      else
+        expect(Yast::Execute).to receive(:on_target)
+          .with(params)
+      end
     end
 
     context "initialized with efi: true" do
@@ -120,7 +125,6 @@
 
       it "runs for each device passed in devices" do
         stub_arch("x86_64")
-        stub_efivars
         expect_grub2_install("i386-pc", device: "/dev/sda")
         expect_grub2_install("i386-pc", device: "/dev/sdb")
         expect_grub2_install("i386-pc", device: "/dev/sdc")
@@ -128,9 +132,31 @@
         subject.execute(devices: ["/dev/sda", "/dev/sdb", "/dev/sdc"])
       end
 
+      it "returns each device for which grub2-install failed" do
+        stub_arch("x86_64")
+        expect_grub2_install("i386-pc", device: "/dev/sdb")
+
+        allow(Yast::Execute).to receive(:on_target!) do |arg|
+          raise Cheetah::ExecutionFailed.new([], nil, nil, nil) if (arg & 
["/dev/sda", "/dev/sdc"]).any?
+        end
+
+        expect(subject.execute(devices: ["/dev/sda", "/dev/sdb", 
"/dev/sdc"])).to contain_exactly("/dev/sda", "/dev/sdc")
+      end
+
+      it "opens a report if grub2-install failed for all devices" do
+        stub_arch("x86_64")
+
+        allow(Yast::Execute).to receive(:on_target!) do |_arg|
+          raise Cheetah::ExecutionFailed.new([], nil, nil, nil)
+        end
+
+        expect(Yast::Report).to receive(:Error)
+
+        subject.execute(devices: ["/dev/sda", "/dev/sdb", "/dev/sdc"])
+      end
+
       it "runs with target i386-pc on i386" do
         stub_arch("i386")
-        stub_efivars
         expect_grub2_install("i386-pc", device: "/dev/sda")
 
         subject.execute(devices: ["/dev/sda"])
@@ -138,7 +164,6 @@
 
       it "runs with target i386-pc on x86_64" do
         stub_arch("x86_64")
-        stub_efivars
         expect_grub2_install("i386-pc", device: "/dev/sda")
 
         subject.execute(devices: ["/dev/sda"])
@@ -146,7 +171,6 @@
 
       it "runs with target powerpc-ieee1275 on ppc64" do
         stub_arch("ppc64")
-        stub_efivars
         expect_grub2_install("powerpc-ieee1275", device: "/dev/sda")
 
         subject.execute(devices: ["/dev/sda"])
@@ -154,7 +178,6 @@
 
       it "runs with target s390x-emu on s390" do
         stub_arch("s390_64")
-        stub_efivars
 
         expect_grub2_install("s390x-emu")
 
@@ -164,7 +187,7 @@
       it "pass directory argument when trusted boot is requested" do
         stub_arch("x86_64")
 
-        expect(Yast::Execute).to receive(:on_target) do |arg|
+        expect(Yast::Execute).to receive(:on_target!) do |arg|
           expect(arg).to include("--directory=/usr/lib/trustedgrub2/i386-pc")
         end
 


Reply via email to