Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package yast2 for openSUSE:Factory checked 
in at 2022-08-30 14:48:38
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2 (Old)
 and      /work/SRC/openSUSE:Factory/.yast2.new.2083 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2"

Tue Aug 30 14:48:38 2022 rev:536 rq:1000015 version:4.5.11

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2/yast2.changes      2022-07-29 
16:47:15.910546998 +0200
+++ /work/SRC/openSUSE:Factory/.yast2.new.2083/yast2.changes    2022-08-30 
14:48:46.712013029 +0200
@@ -1,0 +2,7 @@
+Fri Aug 26 13:18:39 UTC 2022 - Josef Reidinger <jreidin...@suse.com>
+
+- On transactional systems, inform the user that packages are
+  required to be installed manually (related to bsc#1199840)
+- 4.5.11
+
+-------------------------------------------------------------------

Old:
----
  yast2-4.5.10.tar.bz2

New:
----
  yast2-4.5.11.tar.bz2

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

Other differences:
------------------
++++++ yast2.spec ++++++
--- /var/tmp/diff_new_pack.p5gpOf/_old  2022-08-30 14:48:47.396014775 +0200
+++ /var/tmp/diff_new_pack.p5gpOf/_new  2022-08-30 14:48:47.404014795 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2
-Version:        4.5.10
+Version:        4.5.11
 Release:        0
 
 Summary:        YaST2 Main Package

++++++ yast2-4.5.10.tar.bz2 -> yast2-4.5.11.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-4.5.10/library/packages/src/modules/Package.rb 
new/yast2-4.5.11/library/packages/src/modules/Package.rb
--- old/yast2-4.5.10/library/packages/src/modules/Package.rb    2022-07-28 
12:32:46.000000000 +0200
+++ new/yast2-4.5.11/library/packages/src/modules/Package.rb    2022-08-29 
14:03:07.000000000 +0200
@@ -34,9 +34,11 @@
 require "forwardable"
 require "y2packager/resolvable"
 
+Yast.import "CommandLine"
 Yast.import "Mode"
 Yast.import "PackageAI"
 Yast.import "PackageSystem"
+Yast.import "Popup"
 
 module Yast
   # This module implements support to query, install and remove packages.
@@ -329,14 +331,15 @@
     # @param [String] message optional installation|removal text (nil -> 
standard will be used)
     # @return true on success
     def PackageDialog(packages, install, message)
-      packages = deep_copy(packages)
-      Builtins.y2debug("Asking for packages: %1", packages)
+      log.info "Asking for packages: #{packages}"
       packs = Builtins.filter(packages) do |package|
         install ? !Installed(package) : Installed(package)
       end
-      Builtins.y2debug("Remaining packages: %1", packs)
+      log.info "Remaining packages: #{packs}"
+
+      return true if packs.empty?
 
-      return true if Ops.less_than(Builtins.size(packs), 1)
+      check_transactional_system!(packs, install ? :install : :remove)
 
       # Popup Text
       text = _("These packages need to be installed:") + "<p>"
@@ -452,30 +455,47 @@
       @last_op_canceled
     end
 
-    publish function: :by_pattern, type: "list <string> (string)"
+    # Return if system is transactional and does not support direct package
+    # install
+    # @return [Boolean]
+    def IsTransactionalSystem
+      return @transactional unless @transactional.nil?
+
+      mounts = SCR.Read(path(".proc.mounts"))
+      root = mounts.find { |m| m["file"] == WFM.scr_root }
+      log.info "root in mounts #{root.inspect}"
+
+      raise "Failed to find #{WFM.scr_root} at /proc/mounts" unless root
+
+      # check if there are ro keyword in mount
+      @transactional = /(?:^|,)ro(?:,|$)/.match?(root["mntops"])
+    end
+
     publish function: :Available, type: "boolean (string)"
-    publish function: :Installed, type: "boolean (string)"
-    publish function: :DoInstall, type: "boolean (list <string>)"
-    publish function: :DoRemove, type: "boolean (list <string>)"
-    publish function: :DoInstallAndRemove, type: "boolean (list <string>, list 
<string>)"
     publish function: :AvailableAll, type: "boolean (list <string>)"
     publish function: :AvailableAny, type: "boolean (list <string>)"
-    publish function: :InstalledAll, type: "boolean (list <string>)"
-    publish function: :InstalledAny, type: "boolean (list <string>)"
-    publish function: :InstallMsg, type: "boolean (string, string)"
-    publish function: :InstallAllMsg, type: "boolean (list <string>, string)"
-    publish function: :InstallAnyMsg, type: "boolean (list <string>, string)"
-    publish function: :RemoveMsg, type: "boolean (string, string)"
-    publish function: :RemoveAllMsg, type: "boolean (list <string>, string)"
+    publish function: :DoInstall, type: "boolean (list <string>)"
+    publish function: :DoInstallAndRemove, type: "boolean (list <string>, list 
<string>)"
+    publish function: :DoRemove, type: "boolean (list <string>)"
     publish function: :Install, type: "boolean (string)"
     publish function: :InstallAll, type: "boolean (list <string>)"
+    publish function: :InstallAllMsg, type: "boolean (list <string>, string)"
     publish function: :InstallAny, type: "boolean (list <string>)"
-    publish function: :Remove, type: "boolean (string)"
-    publish function: :RemoveAll, type: "boolean (list <string>)"
+    publish function: :InstallAnyMsg, type: "boolean (list <string>, string)"
+    publish function: :InstallKernel, type: "boolean (list <string>)"
+    publish function: :InstallMsg, type: "boolean (string, string)"
+    publish function: :Installed, type: "boolean (string)"
+    publish function: :InstalledAll, type: "boolean (list <string>)"
+    publish function: :InstalledAny, type: "boolean (list <string>)"
     publish function: :LastOperationCanceled, type: "boolean ()"
     publish function: :PackageAvailable, type: "boolean (string)"
     publish function: :PackageInstalled, type: "boolean (string)"
-    publish function: :InstallKernel, type: "boolean (list <string>)"
+    publish function: :Remove, type: "boolean (string)"
+    publish function: :RemoveAll, type: "boolean (list <string>)"
+    publish function: :RemoveAllMsg, type: "boolean (list <string>, string)"
+    publish function: :RemoveMsg, type: "boolean (string, string)"
+    publish function: :IsTransactionalSystem, type: "boolean ()"
+    publish function: :by_pattern, type: "list <string> (string)"
 
   private
 
@@ -512,6 +532,24 @@
 
       found_backend || backend
     end
+
+    # checks if working on transactional system
+    # if so, then it shows popup to user and abort yast
+    def check_transactional_system!(packages, mode = :install)
+      return unless IsTransactionalSystem()
+
+      msg = _("Transactional system detected. ")
+      case mode
+      when :install then msg += _("Following packages have to be installed 
manually:")
+      when :remove then msg += _("Following packages have to be removed 
manually:")
+      else
+        raise "Unknown mode #{mode}"
+      end
+      msg += "<p><ul><li>#{packages.join("</li><li>")}</li></ul></p>"
+      msg += _("Please start YaST again after reboot.")
+      Popup.LongMessage(msg)
+      raise Yast::AbortException
+    end
   end
 
   Package = PackageClass.new
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-4.5.10/library/packages/test/package_test.rb 
new/yast2-4.5.11/library/packages/test/package_test.rb
--- old/yast2-4.5.10/library/packages/test/package_test.rb      2022-07-28 
12:32:46.000000000 +0200
+++ new/yast2-4.5.11/library/packages/test/package_test.rb      2022-08-29 
14:03:07.000000000 +0200
@@ -25,6 +25,11 @@
 describe Yast::Package do
   subject { Yast::Package }
 
+  before do
+    # reset cache
+    subject.instance_variable_set(:@transactional, nil)
+  end
+
   describe "#CheckAndInstallPackages" do
     let(:installed) { false }
 
@@ -361,6 +366,35 @@
       allow(Yast::Mode).to receive(:commandline).and_return(commandline)
       allow(Yast::CommandLine).to receive(:Interactive).and_return(interactive)
       allow(Yast::Popup).to receive(:AnyQuestionRichText).and_return(confirm)
+
+      allow(Yast::SCR).to receive(:Read).and_return(
+        [{
+          "file"    => "/",
+          "freq"    => 0,
+          "mntops"  => "rw,relatime",
+          "passno"  => 0,
+          "spec"    => "/dev/nvme0n1p2",
+          "vfstype" => "ext4"
+        }]
+      )
+    end
+
+    context "when run on transactional system" do
+      it "shows popup and abort" do
+        allow(Yast::SCR).to receive(:Read).and_return(
+          [{
+            "file"    => "/",
+            "freq"    => 0,
+            "mntops"  => "ro,relatime",
+            "passno"  => 0,
+            "spec"    => "/dev/nvme0n1p2",
+            "vfstype" => "ext4"
+          }]
+        )
+
+        expect(Yast::Popup).to receive(:LongMessage)
+        expect { subject.PackageDialog(packages, true, nil) }.to 
raise_error(Yast::AbortException)
+      end
     end
 
     context "when installing packages" do
@@ -558,4 +592,36 @@
       subject.RemoveAllMsg(["firewalld", "yast2"], "Remove?")
     end
   end
+
+  describe "#IsTransactionalSystem" do
+    it "returns false if system is not transactional" do
+      allow(Yast::SCR).to receive(:Read).and_return(
+        [{
+          "file"    => "/",
+          "freq"    => 0,
+          "mntops"  => "rw,relatime",
+          "passno"  => 0,
+          "spec"    => "/dev/nvme0n1p2",
+          "vfstype" => "ext4"
+        }]
+      )
+
+      expect(subject.IsTransactionalSystem).to eq false
+    end
+
+    it "returns true if system is transactional" do
+      allow(Yast::SCR).to receive(:Read).and_return(
+        [{
+          "file"    => "/",
+          "freq"    => 0,
+          "mntops"  => 
"ro,seclabel,relatime,subvolid=244,subvol=/@/.snapshots/8/snapshot",
+          "passno"  => 0,
+          "spec"    => "/dev/vda3",
+          "vfstype" => "ext4"
+        }]
+      )
+
+      expect(subject.IsTransactionalSystem).to eq true
+    end
+  end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-4.5.10/package/yast2.changes 
new/yast2-4.5.11/package/yast2.changes
--- old/yast2-4.5.10/package/yast2.changes      2022-07-28 12:32:46.000000000 
+0200
+++ new/yast2-4.5.11/package/yast2.changes      2022-08-29 14:03:07.000000000 
+0200
@@ -1,4 +1,11 @@
 -------------------------------------------------------------------
+Fri Aug 26 13:18:39 UTC 2022 - Josef Reidinger <jreidin...@suse.com>
+
+- On transactional systems, inform the user that packages are
+  required to be installed manually (related to bsc#1199840)
+- 4.5.11
+
+-------------------------------------------------------------------
 Thu Jul 28 09:40:31 UTC 2022 - David Diaz <dgonza...@suse.com>
 
 - Do not ask for user input while checking file conflicts if the
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-4.5.10/package/yast2.spec 
new/yast2-4.5.11/package/yast2.spec
--- old/yast2-4.5.10/package/yast2.spec 2022-07-28 12:32:46.000000000 +0200
+++ new/yast2-4.5.11/package/yast2.spec 2022-08-29 14:03:07.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2
-Version:        4.5.10
+Version:        4.5.11
 
 Release:        0
 Summary:        YaST2 Main Package

Reply via email to