Hello community,

here is the log from the commit of package yast2-installation for 
openSUSE:Factory checked in at 2015-01-08 23:05:20
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-installation (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-installation.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-installation"

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-installation/yast2-installation.changes    
2014-12-21 12:02:21.000000000 +0100
+++ 
/work/SRC/openSUSE:Factory/.yast2-installation.new/yast2-installation.changes   
    2015-01-08 23:05:22.000000000 +0100
@@ -1,0 +2,6 @@
+Wed Jan  7 14:27:28 UTC 2015 - [email protected]
+
+- do not stuck during copy of logs files (bnc#897091)
+- 3.1.126
+
+-------------------------------------------------------------------

Old:
----
  yast2-installation-3.1.125.tar.bz2

New:
----
  yast2-installation-3.1.126.tar.bz2

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

Other differences:
------------------
++++++ yast2-installation.spec ++++++
--- /var/tmp/diff_new_pack.sDHVrL/_old  2015-01-08 23:05:23.000000000 +0100
+++ /var/tmp/diff_new_pack.sDHVrL/_new  2015-01-08 23:05:23.000000000 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package yast2-installation
 #
-# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-installation
-Version:        3.1.125
+Version:        3.1.126
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
@@ -40,8 +40,8 @@
 BuildRequires:  yast2-devtools >= 3.1.10
 BuildRequires:  rubygem(rspec)
 
-# Linuxrc.keys
-BuildRequires:  yast2 >= 3.1.41
+# Base clients for inst clients
+BuildRequires:  yast2 >= 3.1.112
 
 # Yast::Remote
 BuildRequires:  yast2-network

++++++ yast2-installation-3.1.125.tar.bz2 -> yast2-installation-3.1.126.tar.bz2 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-installation-3.1.125/package/yast2-installation.changes 
new/yast2-installation-3.1.126/package/yast2-installation.changes
--- old/yast2-installation-3.1.125/package/yast2-installation.changes   
2014-12-18 21:14:11.000000000 +0100
+++ new/yast2-installation-3.1.126/package/yast2-installation.changes   
2015-01-07 17:09:10.000000000 +0100
@@ -1,4 +1,10 @@
 -------------------------------------------------------------------
+Wed Jan  7 14:27:28 UTC 2015 - [email protected]
+
+- do not stuck during copy of logs files (bnc#897091)
+- 3.1.126
+
+-------------------------------------------------------------------
 Thu Dec 18 20:12:47 UTC 2014 - [email protected]
 
 - Fix bashisms and shebangs in scripts (by "Ledest")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-installation-3.1.125/package/yast2-installation.spec 
new/yast2-installation-3.1.126/package/yast2-installation.spec
--- old/yast2-installation-3.1.125/package/yast2-installation.spec      
2014-12-18 21:14:11.000000000 +0100
+++ new/yast2-installation-3.1.126/package/yast2-installation.spec      
2015-01-07 17:09:10.000000000 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-installation
-Version:        3.1.125
+Version:        3.1.126
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
@@ -37,8 +37,8 @@
 BuildRequires:  yast2-devtools >= 3.1.10
 BuildRequires:  rubygem(rspec)
 
-# Linuxrc.keys
-BuildRequires: yast2 >= 3.1.41
+# Base clients for inst clients
+BuildRequires: yast2 >= 3.1.112
 
 # Yast::Remote
 BuildRequires: yast2-network
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-installation-3.1.125/src/Makefile.am 
new/yast2-installation-3.1.126/src/Makefile.am
--- old/yast2-installation-3.1.125/src/Makefile.am      2014-12-18 
21:14:11.000000000 +0100
+++ new/yast2-installation-3.1.126/src/Makefile.am      2015-01-07 
17:09:10.000000000 +0100
@@ -107,6 +107,7 @@
 ylib_DATA = \
   lib/installation/cio_ignore.rb \
   lib/installation/clone_settings.rb \
+  lib/installation/copy_logs_finish.rb \
   lib/installation/minimal_installation.rb \
   lib/installation/prep_shrink.rb \
   lib/installation/remote_finish_client.rb
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-installation-3.1.125/src/clients/copy_logs_finish.rb 
new/yast2-installation-3.1.126/src/clients/copy_logs_finish.rb
--- old/yast2-installation-3.1.125/src/clients/copy_logs_finish.rb      
2014-12-18 21:14:11.000000000 +0100
+++ new/yast2-installation-3.1.126/src/clients/copy_logs_finish.rb      
2015-01-07 17:09:10.000000000 +0100
@@ -1,142 +1,3 @@
-# encoding: utf-8
+require "installation/copy_logs_finish"
 
-# 
------------------------------------------------------------------------------
-# Copyright (c) 2006-2012 Novell, Inc. 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 Novell, Inc.
-#
-# To contact Novell about this file by physical or electronic mail, you may 
find
-# current contact information at www.novell.com.
-# 
------------------------------------------------------------------------------
-
-# File:
-#  copy_logs_finish.ycp
-#
-# Module:
-#  Step of base installation finish
-#
-# Authors:
-#  Jiri Srain <[email protected]>
-#
-# $Id$
-#
-module Yast
-  class CopyLogsFinishClient < Client
-    include Yast::Logger
-
-    def main
-      Yast.import "UI"
-
-      textdomain "installation"
-
-      Yast.import "Directory"
-      Yast.include self, "installation/misc.rb"
-
-      @ret = nil
-      @func = ""
-      @param = {}
-
-      # Check arguments
-      if Ops.greater_than(Builtins.size(WFM.Args), 0) &&
-          Ops.is_string?(WFM.Args(0))
-        @func = Convert.to_string(WFM.Args(0))
-        if Ops.greater_than(Builtins.size(WFM.Args), 1) &&
-            Ops.is_map?(WFM.Args(1))
-          @param = Convert.to_map(WFM.Args(1))
-        end
-      end
-
-      log.info "starting copy_logs_finish"
-      log.debug "func=#{@func}"
-      log.debug "param=#{@param}"
-
-      if @func == "Info"
-        return {
-          "steps" => 1,
-          # progress step title
-          "title" => _(
-            "Copying log files to installed system..."
-          ),
-          "when"  => [:installation, :live_installation, :update, :autoinst]
-        }
-      elsif @func == "Write"
-        @log_files = Convert.convert(
-          WFM.Read(path(".local.dir"), Directory.logdir),
-          :from => "any",
-          :to   => "list <string>"
-        )
-
-        Builtins.foreach(@log_files) do |file|
-          log.debug "Processing file #{file}"
-
-          if file == "y2log" || Builtins.regexpmatch(file, "^y2log-[0-9]+$")
-            # Prepare y2log, y2log-* for log rotation
-
-            target_no = 1
-
-            if Ops.greater_than(Builtins.size(file), Builtins.size("y2log-"))
-              target_no = Ops.add(
-                1,
-                Builtins.tointeger(
-                  Builtins.substring(file, Builtins.size("y2log-"), 5)
-                )
-              )
-            end
-
-            target_basename = Builtins.sformat("y2log-%1", target_no)
-            InjectRenamedFile(Directory.logdir, file, target_basename)
-
-            compress_cmd = Builtins.sformat(
-              "gzip %1/%2/%3",
-              Installation.destdir,
-              Directory.logdir,
-              target_basename
-            )
-            log.debug "Compress command: #{compress_cmd}"
-            WFM.Execute(path(".local.bash"), compress_cmd)
-          elsif Builtins.regexpmatch(file, "^y2log-[0-9]+\\.gz$")
-            target_no = Ops.add(
-              1,
-              Builtins.tointeger(
-                Builtins.regexpsub(file, "y2log-([0-9]+)\\.gz", "\\1")
-              )
-            )
-            InjectRenamedFile(
-              Directory.logdir,
-              file,
-              Builtins.sformat("y2log-%1.gz", target_no)
-            )
-          elsif file == "zypp.log"
-            # Save zypp.log from the inst-sys
-            InjectRenamedFile(Directory.logdir, file, "zypp.log-1") # not 
y2log, y2log-*
-          else
-            InjectFile(Ops.add(Ops.add(Directory.logdir, "/"), file))
-          end
-        end
-
-        copy_cmd = "/bin/cp /var/log/pbl.log 
'#{Installation.destdir}/#{Directory.logdir}/pbl-instsys.log'"
-        log.debug "Copy command: #{copy_cmd}"
-        WFM.Execute(path(".local.bash"), copy_cmd)
-      else
-        log.error "unknown function: #{@func}"
-        @ret = nil
-      end
-
-      log.debug "ret=#{@ret}"
-      log.info "copy_logs_finish finished"
-      deep_copy(@ret)
-    end
-  end
-end
-
-Yast::CopyLogsFinishClient.new.main
+::Installation::CopyLogsFinish.run
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-installation-3.1.125/src/include/installation/misc.rb 
new/yast2-installation-3.1.126/src/include/installation/misc.rb
--- old/yast2-installation-3.1.125/src/include/installation/misc.rb     
2014-12-18 21:14:11.000000000 +0100
+++ new/yast2-installation-3.1.126/src/include/installation/misc.rb     
2015-01-07 17:09:10.000000000 +0100
@@ -136,19 +136,6 @@
       #return SCR::Write (.target.byte, filename, copy_buffer);
     end
 
-
-    def InjectRenamedFile(dir, src_name, target_name)
-      src = "#{dir}/#{src_name}"
-      target = "#{Installation.destdir}/#{dir}/#{target_name}"
-      command = "/bin/cp #{src} #{target}"
-
-      Builtins.y2milestone("InjectRenamedFile: <%1> -> <%2>", src, target)
-      Builtins.y2debug("Inject command: #{command}")
-
-      WFM.Execute(path(".local.bash"), command)
-      nil
-    end
-
     def UpdateWizardSteps
       wizard_mode = Mode.mode
       Builtins.y2milestone("Switching Steps to %1 ", wizard_mode)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-installation-3.1.125/src/lib/installation/copy_logs_finish.rb 
new/yast2-installation-3.1.126/src/lib/installation/copy_logs_finish.rb
--- old/yast2-installation-3.1.125/src/lib/installation/copy_logs_finish.rb     
1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-installation-3.1.126/src/lib/installation/copy_logs_finish.rb     
2015-01-07 17:09:10.000000000 +0100
@@ -0,0 +1,109 @@
+# 
------------------------------------------------------------------------------
+# Copyright (c) 2006-2015 Novell, Inc. 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 Novell, Inc.
+#
+# To contact Novell about this file by physical or electronic mail, you may 
find
+# current contact information at www.novell.com.
+# 
------------------------------------------------------------------------------
+
+require "yast"
+
+require "installation/finish_client"
+
+module Installation
+  class CopyLogsFinish < ::Installation::FinishClient
+    include Yast::I18n
+
+    LOCAL_BASH = Yast::Path.new(".local.bash")
+
+    def initialize
+      textdomain "installation"
+
+      Yast.import "Directory"
+      Yast.import "Installation"
+    end
+
+    def steps
+      1
+    end
+
+    def title
+      _("Copying log files to installed system...")
+    end
+
+    def modes
+      [:installation, :live_installation, :update, :autoinst]
+    end
+
+    def write
+      log_files = Yast::WFM.Read(Yast::Path.new(".local.dir"), 
Yast::Directory.logdir)
+
+      log_files.each do |file|
+        log.debug "Processing file #{file}"
+
+        case file
+        when "y2log", /\Ay2log-\d+\z/
+          # Prepare y2log, y2log-* for log rotation
+          target_no = 1
+
+          if file != "y2log"
+            prefix_size = "y2log-".size
+            target_no = file[prefix_size..-1].to_i + 1
+          end
+
+          target_basename = "y2log-#{target_no}"
+          copy_log_to_target(file, target_basename)
+
+          target_path = ::File.join(
+            Yast::Installation.destdir,
+            Yast::Directory.logdir,
+            target_basename
+          )
+          # call gzip with -f to avoid stuck during race condition when log
+          # rotator also gzip file and gzip then wait for input (bnc#897091)
+          compress_cmd = "gzip -f #{target_path}"
+          log.debug "Compress command: #{compress_cmd}"
+          Yast::WFM.Execute(LOCAL_BASH, compress_cmd)
+        when /\Ay2log-\d+\.gz\z/
+          target_no = file[/y2log-(\d+)/, 1].to_i + 1
+          copy_log_to_target(file, "y2log-#{target_no}.gz")
+        when "zypp.log"
+          # Save zypp.log from the inst-sys
+          copy_log_to_target(file, "zypp.log-1") # not y2log, y2log-*
+        else
+          copy_log_to_target(file)
+        end
+      end
+
+      copy_cmd = "/bin/cp /var/log/pbl.log 
'#{Yast::Installation.destdir}/#{Yast::Directory.logdir}/pbl-instsys.log'"
+      log.debug "Copy command: #{copy_cmd}"
+      Yast::WFM.Execute(LOCAL_BASH, copy_cmd)
+
+      nil
+    end
+
+  private
+
+    def copy_log_to_target(src_file, dst_file = src_file)
+      dir = Yast::Directory.logdir
+      src_path = "#{dir}/#{src_file}"
+      dst_path = "#{Yast::Installation.destdir}/#{dir}/#{dst_file}"
+      command = "/bin/cp #{src_path} #{dst_path}"
+
+      log.info "copy log with '#{command}'"
+
+      Yast::WFM.Execute(LOCAL_BASH, command)
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-installation-3.1.125/test/Makefile.am 
new/yast2-installation-3.1.126/test/Makefile.am
--- old/yast2-installation-3.1.125/test/Makefile.am     2014-12-18 
21:14:11.000000000 +0100
+++ new/yast2-installation-3.1.126/test/Makefile.am     2015-01-07 
17:09:10.000000000 +0100
@@ -1,6 +1,7 @@
 TESTS = \
   inst_functions_test.rb \
   cio_ignore_test.rb \
+  copy_logs_finish_test.rb \
   prep_shrink_test.rb \
   remote_finish_test.rb
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-installation-3.1.125/test/copy_logs_finish_test.rb 
new/yast2-installation-3.1.126/test/copy_logs_finish_test.rb
--- old/yast2-installation-3.1.125/test/copy_logs_finish_test.rb        
1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-installation-3.1.126/test/copy_logs_finish_test.rb        
2015-01-07 17:09:10.000000000 +0100
@@ -0,0 +1,61 @@
+#! /usr/bin/env rspec
+
+require_relative "./test_helper"
+
+require "installation/copy_logs_finish"
+
+describe ::Installation::CopyLogsFinish do
+  describe "#write" do
+    before do
+      allow(Yast::WFM).to receive(:Execute)
+    end
+
+    def mock_log_dir(files)
+      allow(Yast::WFM).to receive(:Read).and_return(files)
+    end
+
+    def expect_to_run(cmd)
+      expect(Yast::WFM).to receive(:Execute).with(anything(), cmd)
+    end
+
+    it "copies logs from instalation to target system" do
+      mock_log_dir(["y2start.log"])
+
+      expect_to_run(/cp .*y2start.log .*y2start.log/)
+
+      subject.write
+    end
+
+    it "rotates y2log" do
+      mock_log_dir(["y2log-1.gz"])
+
+      expect_to_run(/cp .*y2log-1.gz .*y2log-2.gz/)
+
+      subject.write
+    end
+
+    it "compresses y2log if not already done" do
+      mock_log_dir(["y2log-1"])
+
+      expect_to_run(/gzip .*y2log-2/) #-2 due to rotation
+
+      subject.write
+    end
+
+    it "does not stuck during compress if file already exists (bnc#897091)" do
+      mock_log_dir(["y2log-1"])
+
+      expect_to_run(/gzip -f/)
+
+      subject.write
+    end
+
+    it "rotates zypp.log" do
+      mock_log_dir(["zypp.log"])
+
+      expect_to_run(/cp .*zypp.log .*zypp.log-1/)
+
+      subject.write
+    end
+  end
+end

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to