Hello community,

here is the log from the commit of package yast2-printer for openSUSE:Factory 
checked in at 2020-07-01 14:26:05
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-printer (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-printer.new.3060 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-printer"

Wed Jul  1 14:26:05 2020 rev:147 rq:817905 version:4.3.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-printer/yast2-printer.changes      
2020-05-15 23:50:14.141303543 +0200
+++ /work/SRC/openSUSE:Factory/.yast2-printer.new.3060/yast2-printer.changes    
2020-07-01 14:26:11.998675462 +0200
@@ -1,0 +2,7 @@
+Tue Jun 30 13:55:10 UTC 2020 - Imobach Gonzalez Sosa <igonzalezs...@suse.com>
+
+- AutoYaST: do not export printer settings if CUPS is disabled
+  (bsc#1172749).
+- 4.3.1
+
+-------------------------------------------------------------------

Old:
----
  yast2-printer-4.3.0.tar.bz2

New:
----
  yast2-printer-4.3.1.tar.bz2

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

Other differences:
------------------
++++++ yast2-printer.spec ++++++
--- /var/tmp/diff_new_pack.2x6AOV/_old  2020-07-01 14:26:12.958678439 +0200
+++ /var/tmp/diff_new_pack.2x6AOV/_new  2020-07-01 14:26:12.958678439 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-printer
-Version:        4.3.0
+Version:        4.3.1
 Release:        0
 Summary:        YaST2 - Printer Configuration
 License:        GPL-2.0-only

++++++ yast2-printer-4.3.0.tar.bz2 -> yast2-printer-4.3.1.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-printer-4.3.0/package/yast2-printer.changes 
new/yast2-printer-4.3.1/package/yast2-printer.changes
--- old/yast2-printer-4.3.0/package/yast2-printer.changes       2020-05-12 
16:52:10.000000000 +0200
+++ new/yast2-printer-4.3.1/package/yast2-printer.changes       2020-06-30 
16:34:10.000000000 +0200
@@ -1,4 +1,11 @@
 -------------------------------------------------------------------
+Tue Jun 30 13:55:10 UTC 2020 - Imobach Gonzalez Sosa <igonzalezs...@suse.com>
+
+- AutoYaST: do not export printer settings if CUPS is disabled
+  (bsc#1172749).
+- 4.3.1
+
+-------------------------------------------------------------------
 Tue May 12 14:32:46 UTC 2020 - josef Reidinger <jreidinger@localhost>
 
 - Autoyast schema: Allow optional types for string and map objects
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-printer-4.3.0/package/yast2-printer.spec 
new/yast2-printer-4.3.1/package/yast2-printer.spec
--- old/yast2-printer-4.3.0/package/yast2-printer.spec  2020-05-12 
16:52:10.000000000 +0200
+++ new/yast2-printer-4.3.1/package/yast2-printer.spec  2020-06-30 
16:34:10.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-printer
-Version:        4.3.0
+Version:        4.3.1
 Release:        0
 Summary:        YaST2 - Printer Configuration
 License:        GPL-2.0-only
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-printer-4.3.0/src/clients/printer_auto.rb 
new/yast2-printer-4.3.1/src/clients/printer_auto.rb
--- old/yast2-printer-4.3.0/src/clients/printer_auto.rb 2020-05-12 
16:52:10.000000000 +0200
+++ new/yast2-printer-4.3.1/src/clients/printer_auto.rb 2020-06-30 
16:34:10.000000000 +0200
@@ -183,15 +183,20 @@
       # on another system from AutoYaST when AutoYaST on the other system
       # calls the above Import function.
       elsif @func == "Export"
-        # what else could be exported instead in case of errors:
-        @ret = {
-          "cupsd_conf_content"  => {
-            "file_contents" => ReadFileContent("/etc/cups/cupsd.conf")
-          },
-          "client_conf_content" => {
-            "file_contents" => ReadFileContent("/etc/cups/client.conf")
-          }
-        }
+        @ret = {}
+
+        if Printer.enabled?
+          # what else could be exported instead in case of errors:
+          @ret.merge!(
+            "cupsd_conf_content"  => {
+              "file_contents" => ReadFileContent("/etc/cups/cupsd.conf")
+            },
+            "client_conf_content" => {
+              "file_contents" => ReadFileContent("/etc/cups/client.conf")
+            }
+          )
+        end
+
       # Return packages needed to be installed and removed during
       # Autoinstallation to ensure it has all needed software installed.
       # @return map with 2 lists of strings $["install":[],"remove":[]]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-printer-4.3.0/src/modules/Printer.rb 
new/yast2-printer-4.3.1/src/modules/Printer.rb
--- old/yast2-printer-4.3.0/src/modules/Printer.rb      2020-05-12 
16:52:10.000000000 +0200
+++ new/yast2-printer-4.3.1/src/modules/Printer.rb      2020-06-30 
16:34:10.000000000 +0200
@@ -29,6 +29,7 @@
 
 require "shellwords"
 require "yast"
+require "yast2/system_service"
 
 module Yast
   class PrinterClass < Module
@@ -2378,6 +2379,13 @@
       true
     end
 
+    # Determine whether the printer service ('cups') is enabled
+    # @return [Boolean] true if the service is enabled; false otherwise
+    def enabled?
+      service = Yast2::SystemService.find("cups")
+      !!service && service.start_mode != :manual
+    end
+
     publish :function => :Modified, :type => "boolean ()"
     publish :variable => :modified, :type => "boolean"
     publish :variable => :AbortFunction, :type => "boolean ()"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-printer-4.3.0/test/printer_auto_test.rb 
new/yast2-printer-4.3.1/test/printer_auto_test.rb
--- old/yast2-printer-4.3.0/test/printer_auto_test.rb   1970-01-01 
01:00:00.000000000 +0100
+++ new/yast2-printer-4.3.1/test/printer_auto_test.rb   2020-06-30 
16:34:10.000000000 +0200
@@ -0,0 +1,66 @@
+# Copyright (c) [2020] SUSE LLC
+#
+# All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of version 2 of the GNU General Public License as published
+# by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, contact SUSE LLC.
+#
+# To contact SUSE LLC about this file by physical or electronic mail, you may
+# find current contact information at www.suse.com.
+
+require_relative "./test_helper"
+require_relative "../src/clients/printer_auto"
+
+describe Yast::PrinterAutoClient do
+  describe "#main" do
+    let(:args) { ["Export"] }
+
+    before do
+      allow(Yast::WFM).to receive(:Args) { |i = nil| i ? args[i] : args }
+      allow(subject).to receive(:ReadFileContent).with(/cupsd.conf/)
+        .and_return("cupsd.conf content")
+      allow(subject).to receive(:ReadFileContent).with(/client.conf/)
+        .and_return("client.conf content")
+    end
+
+    describe "Export" do
+      let(:enabled?) { true }
+
+      before do
+        allow(Yast::Printer).to receive(:enabled?).and_return(enabled?)
+      end
+
+      context "when the 'cups' service is enabled" do
+        let(:enabled) { true }
+
+        it "returns the content of CUPS configuration files" do
+          expect(subject.main).to include(
+            "cupsd_conf_content"  => {
+              "file_contents" => "cupsd.conf content"
+            },
+            "client_conf_content" => {
+              "file_contents" => "client.conf content"
+            }
+          )
+        end
+      end
+
+      context "when the 'cups' service is disabled" do
+        let(:enabled?) { false }
+
+        it "returns an empty hash" do
+          expect(subject.main).to eq({})
+        end
+      end
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-printer-4.3.0/test/printer_test.rb 
new/yast2-printer-4.3.1/test/printer_test.rb
--- old/yast2-printer-4.3.0/test/printer_test.rb        1970-01-01 
01:00:00.000000000 +0100
+++ new/yast2-printer-4.3.1/test/printer_test.rb        2020-06-30 
16:34:10.000000000 +0200
@@ -0,0 +1,64 @@
+# Copyright (c) [2020] SUSE LLC
+#
+# All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of version 2 of the GNU General Public License as published
+# by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, contact SUSE LLC.
+#
+# To contact SUSE LLC about this file by physical or electronic mail, you may
+# find current contact information at www.suse.com.
+
+require_relative "./test_helper"
+
+Yast.import "Printer"
+
+describe Yast::Printer do
+  describe "#enabled?" do
+    let(:service) { instance_double(Yast2::SystemService, start_mode: 
start_mode) }
+
+    before do
+      allow(Yast2::SystemService).to 
receive(:find).with("cups").and_return(service)
+    end
+
+    context "if cups is started on boot" do
+      let(:start_mode) { :on_boot }
+
+      it "returns true" do
+        expect(subject.enabled?).to eq(true)
+      end
+    end
+
+    context "if cups is started on demand" do
+      let(:start_mode) { :on_demand }
+
+      it "returns true" do
+        expect(subject.enabled?).to eq(true)
+      end
+    end
+
+    context "if cups is disabled" do
+      let(:start_mode) { :manual }
+
+      it "returns false" do
+        expect(subject.enabled?).to eq(false)
+      end
+    end
+
+    context "if cups service does not exist" do
+      let(:service) { nil }
+
+      it "returns false" do
+        expect(subject.enabled?).to eq(false)
+      end
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-printer-4.3.0/test/test_helper.rb 
new/yast2-printer-4.3.1/test/test_helper.rb
--- old/yast2-printer-4.3.0/test/test_helper.rb 1970-01-01 01:00:00.000000000 
+0100
+++ new/yast2-printer-4.3.1/test/test_helper.rb 2020-06-30 16:34:10.000000000 
+0200
@@ -0,0 +1,44 @@
+# Copyright (c) [2020] SUSE LLC
+#
+# All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of version 2 of the GNU General Public License as published
+# by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, contact SUSE LLC.
+#
+# To contact SUSE LLC about this file by physical or electronic mail, you may
+# find current contact information at www.suse.com.
+
+srcdir = File.expand_path("../../src", __FILE__)
+y2dirs = ENV.fetch("Y2DIR", "").split(":")
+ENV["Y2DIR"] = y2dirs.unshift(srcdir).join(":")
+
+require "yast"
+
+if ENV["COVERAGE"]
+  require "simplecov"
+  SimpleCov.start do
+    add_filter "/test/"
+  end
+
+  # track all ruby files under src
+  src_location = File.expand_path("../../src", __FILE__)
+  SimpleCov.track_files("#{src_location}/{module,lib}/**/*.rb")
+
+  # use coveralls for on-line code coverage reporting at Travis CI
+  if ENV["TRAVIS"]
+    require "coveralls"
+    SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
+      SimpleCov::Formatter::HTMLFormatter,
+      Coveralls::SimpleCov::Formatter
+    ]
+  end
+end


Reply via email to