Hello community, here is the log from the commit of package yast2 for openSUSE:Factory checked in at 2017-07-17 10:31:23 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2 (Old) and /work/SRC/openSUSE:Factory/.yast2.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2" Mon Jul 17 10:31:23 2017 rev:407 rq:510064 version:3.3.2 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2/yast2.changes 2017-07-11 08:23:51.324287791 +0200 +++ /work/SRC/openSUSE:Factory/.yast2.new/yast2.changes 2017-07-17 10:31:24.873508492 +0200 @@ -1,0 +2,14 @@ +Thu Jul 13 10:45:59 UTC 2017 - [email protected] + +- Add Yast::Execute.on_target! and Yast::Execute.locally! variants + which raise a Cheetah exception if the command fails (bsc#1048512) +- 3.3.2 + +------------------------------------------------------------------- +Wed Jul 12 13:38:08 UTC 2017 - [email protected] + +- convert Object#timeout usage to Timeout.timeout as ruby2.4 makes + it obsolete ( ruby2.4 will be for SLE15 so part of bsc#1044312) +- 3.3.1 + +------------------------------------------------------------------- Old: ---- yast2-3.3.0.tar.bz2 New: ---- yast2-3.3.2.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2.spec ++++++ --- /var/tmp/diff_new_pack.TLH1gN/_old 2017-07-17 10:31:25.621403052 +0200 +++ /var/tmp/diff_new_pack.TLH1gN/_new 2017-07-17 10:31:25.625402488 +0200 @@ -17,7 +17,7 @@ Name: yast2 -Version: 3.3.0 +Version: 3.3.2 Release: 0 Summary: YaST2 - Main Package License: GPL-2.0 ++++++ yast2-3.3.0.tar.bz2 -> yast2-3.3.2.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.3.0/library/system/src/lib/yast2/execute.rb new/yast2-3.3.2/library/system/src/lib/yast2/execute.rb --- old/yast2-3.3.0/library/system/src/lib/yast2/execute.rb 2017-07-10 11:22:17.312954640 +0200 +++ new/yast2-3.3.2/library/system/src/lib/yast2/execute.rb 2017-07-13 14:12:05.528949739 +0200 @@ -24,8 +24,10 @@ require "cheetah" module Yast - # Module for executing scripts/programs in safe way. Uses cheetah as backend, - # but adds support for chrooting in installation. + # A module for executing scripts/programs in a safe way + # (not prone to shell quoting bugs). + # It uses {http://www.rubydoc.info/github/openSUSE/cheetah/ Cheetah} + # as the backend, but adds support for chrooting during the installation. class Execute # use y2log by default Cheetah.default_options = { logger: Y2Logger.instance } @@ -33,10 +35,22 @@ extend Yast::I18n textdomain "base" - # Runs arguments with respect of changed root in installation. - # @see http://www.rubydoc.info/github/openSUSE/cheetah/Cheetah.run parameter docs - # @raise Cheetah::ExecutionFailed + # Runs with chroot; a failure becomes a popup. + # Runs a command described by *args*, + # in a `chroot(2)` specified by the installation (WFM.scr_root). + # Shows a {ReportClass#Error popup} if the command fails + # and returns `nil` in such case. + # @param args see http://www.rubydoc.info/github/openSUSE/cheetah/Cheetah.run def self.on_target(*args) + popup_error { on_target!(*args) } + end + + # Runs with chroot; a failure becomes an exception. + # Runs a command described by *args*, + # in a `chroot(2)` specified by the installation (WFM.scr_root). + # @param args see http://www.rubydoc.info/github/openSUSE/cheetah/Cheetah.run + # @raise Cheetah::ExecutionFailed if the command fails + def self.on_target!(*args) root = Yast::WFM.scr_root if args.last.is_a? ::Hash @@ -45,17 +59,31 @@ args.push(chroot: root) end - popup_error { Cheetah.run(*args) } + Cheetah.run(*args) end - # Runs arguments without changed root. - # @see http://www.rubydoc.info/github/openSUSE/cheetah/Cheetah.run parameter docs - # @raise Cheetah::ExecutionFailed + # Runs without chroot; a failure becomes a popup. + # Runs a command described by *args*, + # *disregarding* a `chroot(2)` specified by the installation (WFM.scr_root). + # Shows a {ReportClass#Error popup} if the command fails + # and returns `nil` in such case. + # @param args see http://www.rubydoc.info/github/openSUSE/cheetah/Cheetah.run def self.locally(*args) - popup_error { Cheetah.run(*args) } + popup_error { locally!(*args) } end - def self.popup_error(&block) + # Runs without chroot; a failure becomes an exception. + # Runs a command described by *args*, + # *disregarding* a `chroot(2)` specified by the installation (WFM.scr_root). + # In other words, this is just an alias for `Cheetah.run`, provided for + # API orthogonality. + # @param args see http://www.rubydoc.info/github/openSUSE/cheetah/Cheetah.run + # @raise Cheetah::ExecutionFailed if the command fails + def self.locally!(*args) + Cheetah.run(*args) + end + + private_class_method def self.popup_error(&block) block.call rescue Cheetah::ExecutionFailed => e Yast.import "Report" @@ -72,7 +100,5 @@ } ) end - - private_class_method :popup_error end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.3.0/library/system/test/execute_test.rb new/yast2-3.3.2/library/system/test/execute_test.rb --- old/yast2-3.3.0/library/system/test/execute_test.rb 2017-07-10 11:22:17.352954640 +0200 +++ new/yast2-3.3.2/library/system/test/execute_test.rb 2017-07-13 14:12:05.532949739 +0200 @@ -27,6 +27,18 @@ end end + describe ".locally!" do + it "passes arguments directly to cheetah" do + expect(Cheetah).to receive(:run).with("ls", "-a") + + Yast::Execute.locally("ls", "-a") + end + + it "raises Cheetah::ExecutionFailed if command execution failed" do + expect { Yast::Execute.locally!("false") }.to raise_error(Cheetah::ExecutionFailed) + end + end + describe ".on_target" do it "adds to passed arguments chroot option if scr chrooted" do allow(Yast::WFM).to receive(:scr_root).and_return("/mnt") @@ -44,4 +56,17 @@ expect(Yast::Execute.on_target("false")).to eq nil end end + + describe ".on_target!" do + it "adds to passed arguments chroot option if scr chrooted" do + allow(Yast::WFM).to receive(:scr_root).and_return("/mnt") + expect(Cheetah).to receive(:run).with("ls", "-a", chroot: "/mnt") + + Yast::Execute.on_target("ls", "-a") + end + + it "raises Cheetah::ExecutionFailed if command execution failed" do + expect { Yast::Execute.on_target!("false") }.to raise_error(Cheetah::ExecutionFailed) + end + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.3.0/library/systemd/src/lib/yast2/systemctl.rb new/yast2-3.3.2/library/systemd/src/lib/yast2/systemctl.rb --- old/yast2-3.3.0/library/systemd/src/lib/yast2/systemctl.rb 2017-07-10 11:22:17.356954640 +0200 +++ new/yast2-3.3.2/library/systemd/src/lib/yast2/systemctl.rb 2017-07-13 14:12:05.536949739 +0200 @@ -23,9 +23,11 @@ def execute(command) command = SYSTEMCTL + command log.debug "Executing `systemctl` command: #{command}" - result = timeout(TIMEOUT) { SCR.Execute(Path.new(".target.bash_output"), command) } + result = ::Timeout.timeout(TIMEOUT) do + SCR.Execute(Path.new(".target.bash_output"), command) + end OpenStruct.new(result.merge!(command: command)) - rescue Timeout::Error + rescue ::Timeout::Error raise SystemctlError, "Timeout #{TIMEOUT} seconds: #{command}" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.3.0/package/yast2.changes new/yast2-3.3.2/package/yast2.changes --- old/yast2-3.3.0/package/yast2.changes 2017-07-10 11:22:17.520954640 +0200 +++ new/yast2-3.3.2/package/yast2.changes 2017-07-13 14:12:05.560949739 +0200 @@ -1,4 +1,18 @@ ------------------------------------------------------------------- +Thu Jul 13 10:45:59 UTC 2017 - [email protected] + +- Add Yast::Execute.on_target! and Yast::Execute.locally! variants + which raise a Cheetah exception if the command fails (bsc#1048512) +- 3.3.2 + +------------------------------------------------------------------- +Wed Jul 12 13:38:08 UTC 2017 - [email protected] + +- convert Object#timeout usage to Timeout.timeout as ruby2.4 makes + it obsolete ( ruby2.4 will be for SLE15 so part of bsc#1044312) +- 3.3.1 + +------------------------------------------------------------------- Mon Jul 10 08:09:15 UTC 2017 - [email protected] - Fix omitting button in CWM::Dialog and make API consistent with diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.3.0/package/yast2.spec new/yast2-3.3.2/package/yast2.spec --- old/yast2-3.3.0/package/yast2.spec 2017-07-10 11:22:17.520954640 +0200 +++ new/yast2-3.3.2/package/yast2.spec 2017-07-13 14:12:05.560949739 +0200 @@ -17,7 +17,7 @@ Name: yast2 -Version: 3.3.0 +Version: 3.3.2 Release: 0 Summary: YaST2 - Main Package License: GPL-2.0
