Hello community, here is the log from the commit of package yast2-installation for openSUSE:Factory checked in at 2019-05-15 12:23:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-installation (Old) and /work/SRC/openSUSE:Factory/.yast2-installation.new.5148 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-installation" Wed May 15 12:23:34 2019 rev:425 rq:702845 version:4.2.4 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-installation/yast2-installation.changes 2019-04-25 16:20:09.522079598 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-installation.new.5148/yast2-installation.changes 2019-05-15 12:23:36.746206118 +0200 @@ -1,0 +2,7 @@ +Fri May 10 15:07:17 CEST 2019 - [email protected] + +- Downloading files: Remounting CD with bind option correctly if + the CD has already been mounted (bsc#1132915). +- 4.2.4 + +------------------------------------------------------------------- Old: ---- yast2-installation-4.2.3.tar.bz2 New: ---- yast2-installation-4.2.4.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-installation.spec ++++++ --- /var/tmp/diff_new_pack.SR73o8/_old 2019-05-15 12:23:37.510204448 +0200 +++ /var/tmp/diff_new_pack.SR73o8/_new 2019-05-15 12:23:37.514204439 +0200 @@ -17,7 +17,7 @@ Name: yast2-installation -Version: 4.2.3 +Version: 4.2.4 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ yast2-installation-4.2.3.tar.bz2 -> yast2-installation-4.2.4.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.2.3/package/yast2-installation.changes new/yast2-installation-4.2.4/package/yast2-installation.changes --- old/yast2-installation-4.2.3/package/yast2-installation.changes 2019-04-24 15:43:28.000000000 +0200 +++ new/yast2-installation-4.2.4/package/yast2-installation.changes 2019-05-14 14:24:17.000000000 +0200 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Fri May 10 15:07:17 CEST 2019 - [email protected] + +- Downloading files: Remounting CD with bind option correctly if + the CD has already been mounted (bsc#1132915). +- 4.2.4 + +------------------------------------------------------------------- Wed Apr 24 13:26:07 UTC 2019 - Stefan Hundhammer <[email protected]> - Make sure pkg target is active as long as still needed (bsc#1128385) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.2.3/package/yast2-installation.spec new/yast2-installation-4.2.4/package/yast2-installation.spec --- old/yast2-installation-4.2.3/package/yast2-installation.spec 2019-04-24 15:43:28.000000000 +0200 +++ new/yast2-installation-4.2.4/package/yast2-installation.spec 2019-05-14 14:24:17.000000000 +0200 @@ -16,7 +16,7 @@ # Name: yast2-installation -Version: 4.2.3 +Version: 4.2.4 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.2.3/src/lib/transfer/file_from_url.rb new/yast2-installation-4.2.4/src/lib/transfer/file_from_url.rb --- old/yast2-installation-4.2.3/src/lib/transfer/file_from_url.rb 2019-04-24 15:43:28.000000000 +0200 +++ new/yast2-installation-4.2.4/src/lib/transfer/file_from_url.rb 2019-05-14 14:24:17.000000000 +0200 @@ -182,7 +182,7 @@ elsif _Scheme == "file" file = Builtins.sformat("%1/%2", Installation.sourcedir, _Path) # FIXME: I have doubts this will ever work. Too early. if Ops.greater_than(SCR.Read(path(".target.size"), file), 0) - cpcmd = Builtins.sformat("cp %1 %2", file, _Localfile) + cpcmd = Builtins.sformat("/bin/cp %1 %2", file, _Localfile) Builtins.y2milestone("Copy profile: %1", cpcmd) SCR.Execute(path(".target.bash"), cpcmd) else @@ -194,7 +194,7 @@ _Path ) ) - cpcmd = Builtins.sformat("cp %1 %2", _Path, _Localfile) + cpcmd = Builtins.sformat("/bin/cp %1 %2", _Path, _Localfile) Builtins.y2milestone("Copy profile: %1", cpcmd) SCR.Execute(path(".target.bash"), cpcmd) end @@ -216,36 +216,18 @@ install_url = InstURL.installInf2Url("") # Builtins.regexpsub can also return nil (bnc#959723) cdrom_device = install_url ? (Builtins.regexpsub(install_url, "devices=(.*)$", "\\1") || "") : "" - if Installation.boot == "cd" && !cdrom_device.empty? - already_mounted = Ops.add( - Ops.add("grep ", cdrom_device), - " /proc/mounts ;" - ) - am = Convert.to_map( - SCR.Execute(path(".target.bash_output"), already_mounted) - ) - if Ops.get_integer(am, "exit", -1) == 0 && - Ops.greater_than( - Builtins.size(Ops.get_string(am, "stdout", "")), - 0 - ) - Builtins.y2warning( + if Installation.boot == "cd" && !cdrom_device.empty? + mtab = File.read("/proc/mounts") + m = mtab.match(/^#{cdrom_device}\s+(\S+)/) + if m + Builtins.y2milestone( "%1 is already mounted, trying to bind mount...", cdrom_device ) - cmd = Ops.add( - Ops.add( - Ops.add( - Ops.add("mount -v --bind `grep ", cdrom_device), - " /proc/mounts |cut -f 2 -d \\ ` " - ), - mount_point - ), - ";" - ) am1 = Convert.to_map( - SCR.Execute(path(".target.bash_output"), cmd) + SCR.Execute(path(".target.bash_output"), + "/bin/mount -v --bind #{m[1]} #{mount_point}") ) if Ops.get_integer(am1, "exit", -1) == 0 ok = true @@ -282,7 +264,7 @@ end if ok cpcmd = Builtins.sformat( - Ops.add(Ops.add("cp ", mount_point), "/%1 %2"), + Ops.add(Ops.add("/bin/cp ", mount_point), "/%1 %2"), _Path, _Localfile ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.2.3/test/file_from_url_test.rb new/yast2-installation-4.2.4/test/file_from_url_test.rb --- old/yast2-installation-4.2.3/test/file_from_url_test.rb 2019-04-24 15:43:28.000000000 +0200 +++ new/yast2-installation-4.2.4/test/file_from_url_test.rb 2019-05-14 14:24:17.000000000 +0200 @@ -5,6 +5,8 @@ require "transfer/file_from_url" describe Yast::Transfer::FileFromUrl do + Yast.import "Installation" + before do stub_const("Yast::FTP", double(fake_method: nil)) stub_const("Yast::HTTP", double(Get: nil)) @@ -176,6 +178,56 @@ context "when scheme is 'ftp'" do end context "when scheme is 'file'" do + let(:scheme) { "file" } + let(:destination) { "/tmp/auto.xml" } + let(:source) { "/oss.xml" } + let(:cd_device) { "/dev/sr0" } + let(:tmp_mount) { "/tmp_dir/tmp_mount" } + + before do + allow(Yast::SCR).to receive(:Execute) + .with(Yast::Path.new(".target.bash"), "/bin/cp #{tmp_mount}/#{source} #{destination}") + allow(Yast::SCR).to receive(:Execute) + .with(Yast::Path.new(".target.bash"), "/bin/cp #{source} #{destination}") + allow(Yast::WFM).to receive(:Execute) + .with(Yast::Path.new(".local.umount"), tmp_mount) + allow(Yast::Installation).to receive(:sourcedir).and_return("/mnt") + allow(Yast::Installation).to receive(:boot).and_return("cd") + allow(Yast::InstURL).to receive("installInf2Url").and_return("cd:/?devices=#{cd_device}") + expect(Yast::SCR).to receive(:Read) + .with(Yast::Path.new(".target.size"), "/mnt/#{source}").and_return(0) + expect(Yast::SCR).to receive(:Read) + .with(Yast::Path.new(".target.size"), destination).and_return(0, 10) + end + + context "CD has already been mounted multiple times" do + before do + allow(File).to receive(:read).with("/proc/mounts").and_return( + "#{cd_device} /mounts/mp_0005 iso9660 ro,relatime 0 0\n"\ + "#{cd_device} /mounts/mp_0006 iso9660 ro,relatime 0 0" + ) + end + + it "mounts with --bind option and returns true" do + expect(Yast::SCR).to receive(:Execute) + .with(Yast::Path.new(".target.bash_output"), "/bin/mount -v --bind /mounts/mp_0005 #{tmp_mount}") + .and_return("exit" => 0, "stdout" => "ok") + expect(subject.Get(scheme, "", source, destination)).to eq(true) + end + end + + context "CD has not been mounted" do + before do + allow(File).to receive(:read).with("/proc/mounts").and_return("") + end + + it "mounts CD and returns true" do + expect(Yast::WFM).to receive(:Execute) + .with(Yast::Path.new(".local.mount"), [cd_device, tmp_mount, Yast::Installation.mountlog]) + .and_return(true) + expect(subject.Get(scheme, "", source, destination)).to eq(true) + end + end end context "when scheme is 'nfs'" do end
