Hello community,

here is the log from the commit of package yast2-packager for openSUSE:Factory 
checked in at 2018-07-24 17:28:17
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-packager (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-packager.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-packager"

Tue Jul 24 17:28:17 2018 rev:357 rq:623708 version:4.1.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-packager/yast2-packager.changes    
2018-07-01 21:25:24.484845619 +0200
+++ /work/SRC/openSUSE:Factory/.yast2-packager.new/yast2-packager.changes       
2018-07-24 17:28:25.427761374 +0200
@@ -1,0 +2,9 @@
+Mon Jul 16 11:19:03 UTC 2018 - [email protected]
+
+- Do not display a false "not enough free space" warning popup if
+  the free space is bigger than 8EiB (2^63) (bsc#991090)
+- Do not display the "not enough free space" warning for partitions
+  where nothing is going to be installed (bsc#926841)
+- 4.1.2
+
+-------------------------------------------------------------------

Old:
----
  yast2-packager-4.1.1.tar.bz2

New:
----
  yast2-packager-4.1.2.tar.bz2

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

Other differences:
------------------
++++++ yast2-packager.spec ++++++
--- /var/tmp/diff_new_pack.NwLY4Q/_old  2018-07-24 17:28:27.135763540 +0200
+++ /var/tmp/diff_new_pack.NwLY4Q/_new  2018-07-24 17:28:27.135763540 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-packager
-Version:        4.1.1
+Version:        4.1.2
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build

++++++ yast2-packager-4.1.1.tar.bz2 -> yast2-packager-4.1.2.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-packager-4.1.1/package/yast2-packager.changes 
new/yast2-packager-4.1.2/package/yast2-packager.changes
--- old/yast2-packager-4.1.1/package/yast2-packager.changes     2018-06-29 
16:34:19.000000000 +0200
+++ new/yast2-packager-4.1.2/package/yast2-packager.changes     2018-07-18 
16:48:44.000000000 +0200
@@ -1,4 +1,13 @@
 -------------------------------------------------------------------
+Mon Jul 16 11:19:03 UTC 2018 - [email protected]
+
+- Do not display a false "not enough free space" warning popup if
+  the free space is bigger than 8EiB (2^63) (bsc#991090)
+- Do not display the "not enough free space" warning for partitions
+  where nothing is going to be installed (bsc#926841)
+- 4.1.2
+
+-------------------------------------------------------------------
 Tue Jun 26 17:19:48 CEST 2018 - [email protected]
 
 - Added additional searchkeys to desktop file (fate#321043).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-packager-4.1.1/package/yast2-packager.spec 
new/yast2-packager-4.1.2/package/yast2-packager.spec
--- old/yast2-packager-4.1.1/package/yast2-packager.spec        2018-06-29 
16:34:19.000000000 +0200
+++ new/yast2-packager-4.1.2/package/yast2-packager.spec        2018-07-18 
16:48:44.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-packager
-Version:        4.1.1
+Version:        4.1.2
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-packager-4.1.1/src/modules/SlideShowCallbacks.rb 
new/yast2-packager-4.1.2/src/modules/SlideShowCallbacks.rb
--- old/yast2-packager-4.1.1/src/modules/SlideShowCallbacks.rb  2018-06-29 
16:34:19.000000000 +0200
+++ new/yast2-packager-4.1.2/src/modules/SlideShowCallbacks.rb  2018-07-18 
16:48:44.000000000 +0200
@@ -286,12 +286,23 @@
         if !pkgdu.nil?
           # check each mount point
           Builtins.foreach(pkgdu) do |part, data|
+            # disk sizes from libzypp, in KiB!
+            _disk_size, used_now, used_future, read_only = *data
+            # the size difference, how much the package needs on this partition
+            required_space = used_future - used_now
+
             # skip read-only partitions, the package cannot be installed anyway
-            if Ops.get(data, 3, 0) == 1
+            if read_only == 1
               Builtins.y2debug("Skipping read-only partition %1", part)
               next
             end
 
+            # nothing to install on this partition, skip it (bsc#926841)
+            if required_space <= 0
+              log.debug("Nothing to install at #{part}, skipping")
+              next
+            end
+
             target_dir = File.join(Installation.destdir, part)
 
             # handle missing directories (not existing yet or incorrect 
metadata),
@@ -310,13 +321,20 @@
               target_dir,
               disk_available
             )
-            if Ops.less_than(disk_available, Ops.get(data, 2, 0))
+
+            if disk_available < 0
+              log.debug("Data overflow, too much free space available, 
skipping the check")
+              next
+            end
+
+            # we need to convert the size to KiB to compare it with the 
libzypp size
+            if (disk_available / 1024) < required_space
               Builtins.y2warning(
                 "Not enough free space in %1 (%2): available: %3, required: 
%4",
                 part,
                 target_dir,
                 disk_available,
-                Ops.get(data, 2, 0)
+                required_space
               )
 
               cont = YesNoAgainWarning(
@@ -338,7 +356,8 @@
           end
         else
           # disk usage for each partition is not known
-          # assume that all files will be installed into the root directory
+          # assume that all files will be installed into the root directory,
+          # this is the current free space (in bytes)
           disk_available = Pkg.TargetAvailable(Installation.destdir)
 
           Builtins.y2milestone(
@@ -347,7 +366,9 @@
             disk_available
           )
 
-          if Ops.less_than(disk_available, pkg_size)
+          if disk_available < 0
+            log.debug("Data overflow, too much free space available, skipping 
the check")
+          elsif disk_available < pkg_size
             Builtins.y2warning(
               "Not enough free space in %1: available: %2, required: %3",
               Installation.destdir,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-packager-4.1.1/test/packages_test.rb 
new/yast2-packager-4.1.2/test/packages_test.rb
--- old/yast2-packager-4.1.1/test/packages_test.rb      2018-06-29 
16:34:19.000000000 +0200
+++ new/yast2-packager-4.1.2/test/packages_test.rb      2018-07-18 
16:48:44.000000000 +0200
@@ -1661,4 +1661,118 @@
       expect(subject.sourceAccessPackages.sort).to eq(["cifs-mount", 
"nfs-client"])
     end
   end
+
+  # helper for the #repo_schemes tests to mock the repository configuration
+  def expect_source_urls(mapping)
+    expect(Yast::Pkg).to 
receive(:SourceGetCurrent).with(true).and_return(mapping.keys)
+
+    mapping.each do |id, url|
+      expect(Yast::Pkg).to receive(:SourceURL).with(id).and_return(url)
+    end
+  end
+
+  describe "#repo_schemes" do
+    it "returns empty list if no repository is defined" do
+      expect_source_urls({})
+      expect(subject.repo_schemes).to eq([])
+    end
+
+    it "returns all used schemes" do
+      expect_source_urls(
+        0 => "http://example.com";,
+        1 => "https://example.com";,
+        2 => "ftp://example.com";,
+        3 => "dir:///packages",
+        4 => "dvd:///"
+      )
+      expect(subject.repo_schemes).to eq(["http", "https", "ftp", "dir", 
"dvd"])
+    end
+
+    it "returns unique list" do
+      expect_source_urls(
+        0 => "http://example.com";,
+        1 => "http://example2.com";,
+        7 => "ftp://example.com";,
+        8 => "ftp://example2.com";
+      )
+      expect(subject.repo_schemes).to eq(["http", "ftp"])
+    end
+
+    it "returns the scheme of the base URL for ISO scheme" do
+      expect_source_urls(
+        # ISO over NFS, see "man zypper"
+        0 => 
"iso:/subdir?iso=DVD1.iso&url=nfs://server/dir&mnt=/nfs&filesystem=udf"
+      )
+      expect(subject.repo_schemes).to eq(["nfs"])
+    end
+
+    it "converts the scheme names to lower case" do
+      expect_source_urls(
+        0 => "HTTP://example.com",
+        8 => "FTP://example2.com"
+      )
+      expect(subject.repo_schemes).to eq(["http", "ftp"])
+    end
+
+    it "ignores invalid URL" do
+      expect_source_urls(0 => ":")
+      expect(subject.repo_schemes).to eq([])
+    end
+
+    it "ignores incomplete ISO URL (missing 'url' parameter)" do
+      expect_source_urls(0 => 
"iso:/subdir?iso=DVD1.iso&mnt=/nfs&filesystem=udf")
+      expect(subject.repo_schemes).to eq([])
+    end
+
+    it "ignores incomplete ISO URL (empty 'url' parameter)" do
+      expect_source_urls(0 => 
"iso:/subdir?iso=DVD1.iso&url=&mnt=/nfs&filesystem=udf")
+      expect(subject.repo_schemes).to eq([])
+    end
+
+    it "ignores invalid ISO URL (invalid 'url' parameter)" do
+      expect_source_urls(
+        0 => "iso:/subdir?iso=DVD1.iso&url=:&filesystem=udf"
+      )
+      expect(subject.repo_schemes).to eq([])
+    end
+  end
+
+  describe "#sourceAccessPackages" do
+    it "returns empty list if no repository is defined" do
+      expect(subject).to receive(:repo_schemes).and_return([])
+      expect(subject.sourceAccessPackages).to eq([])
+    end
+
+    # these do not need any extra package to access them
+    it "returns empty list for http(s), ftp, hd, cd, dvd and dir schemes" do
+      schemes = ["http", "https", "ftp", "hd", "cd", "dvd", "dir"]
+      expect(subject).to receive(:repo_schemes).and_return(schemes)
+      expect(subject.sourceAccessPackages).to eq([])
+    end
+
+    it "returns 'nfs-client' for nfs scheme" do
+      schemes = ["nfs"]
+      expect(subject).to receive(:repo_schemes).and_return(schemes)
+      expect(subject.sourceAccessPackages).to eq(["nfs-client"])
+    end
+
+    it "returns 'cifs-mount' for smb scheme" do
+      schemes = ["smb"]
+      expect(subject).to receive(:repo_schemes).and_return(schemes)
+      expect(subject.sourceAccessPackages).to eq(["cifs-mount"])
+    end
+
+    it "returns 'cifs-mount' for cifs scheme" do
+      schemes = ["cifs"]
+      expect(subject).to receive(:repo_schemes).and_return(schemes)
+      expect(subject.sourceAccessPackages).to eq(["cifs-mount"])
+    end
+
+    it "returns 'cifs-mount' and 'nfs-client' for smb and nfs schemes" do
+      schemes = ["cifs", "nfs"]
+      expect(subject).to receive(:repo_schemes).and_return(schemes)
+      # sort the result to make it order independent
+      expect(subject.sourceAccessPackages.sort).to eq(["cifs-mount", 
"nfs-client"])
+    end
+  end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-packager-4.1.1/test/slide_show_callabacks_test.rb 
new/yast2-packager-4.1.2/test/slide_show_callabacks_test.rb
--- old/yast2-packager-4.1.1/test/slide_show_callabacks_test.rb 1970-01-01 
01:00:00.000000000 +0100
+++ new/yast2-packager-4.1.2/test/slide_show_callabacks_test.rb 2018-07-18 
16:48:44.000000000 +0200
@@ -0,0 +1,73 @@
+#!/usr/bin/env rspec
+
+require_relative "test_helper"
+
+Yast.import "SlideShowCallbacks"
+
+describe Yast::SlideShowCallbacksClass do
+  subject { Yast::SlideShowCallbacksClass.new }
+
+  describe "#DisplayStartInstall" do
+    let(:pkg_name) { "libyui-ncurses-pkg-devel" }
+    let(:pkg_location) { "pkg_location" }
+    let(:pkg_description) { "pkg_description" }
+    let(:pkg_size) { 138510 }
+    let(:deleting) { false }
+
+    before do
+      allow(Yast::PackageSlideShow).to receive(:SlideDisplayStart)
+      allow(subject).to receive(:HandleInput)
+      allow(Yast::Installation).to receive(:destdir).and_return("/")
+      allow(File).to receive(:exist?).and_return(true)
+      allow(Yast::SlideShow).to receive(:SetUserAbort)
+
+      subject.instance_variable_set(:@ask_again, true)
+      subject.instance_variable_set(:@pkg_inprogress, pkg_name)
+    end
+
+    RSpec.shared_examples "free space check" do
+      it "does not display the space warning when free space is >8EiB" do
+        # sizes > 8EiB are returned as negative numbers (data overflow)
+        expect(Yast::Pkg).to receive(:TargetAvailable).and_return(-42)
+        expect(subject).to_not receive(:YesNoAgainWarning)
+
+        subject.DisplayStartInstall(pkg_name, pkg_location, pkg_description, 
pkg_size, deleting)
+      end
+
+      it "does not display the space warning when free space is enough" do
+        # 1MiB free space
+        expect(Yast::Pkg).to receive(:TargetAvailable).and_return(1 << 20)
+        expect(subject).to_not receive(:YesNoAgainWarning)
+
+        subject.DisplayStartInstall(pkg_name, pkg_location, pkg_description, 
pkg_size, deleting)
+      end
+
+      it "displays the space warning when free space is not enough" do
+        # 64KiB free space
+        expect(Yast::Pkg).to receive(:TargetAvailable).and_return(1 << 16)
+        expect(subject).to receive(:YesNoAgainWarning)
+
+        subject.DisplayStartInstall(pkg_name, pkg_location, pkg_description, 
pkg_size, deleting)
+      end
+    end
+
+    context "package data usage is available" do
+      before do
+        expect(Yast::Pkg).to receive(:PkgDU).with(pkg_name).and_return(
+          # required space 230KiB
+          "/" => [6854656, 4483116, 4483346, 0]
+        )
+      end
+
+      include_examples "free space check"
+    end
+
+    context "package data usage is not available" do
+      before do
+        expect(Yast::Pkg).to receive(:PkgDU).with(pkg_name).and_return(nil)
+      end
+
+      include_examples "free space check"
+    end
+  end
+end


Reply via email to