Skip to content
Permalink
Browse files

new popup layout

  • Loading branch information...
schubi2 committed Feb 1, 2018
1 parent 2508f78 commit b63ef2c7689dda787b3db0f4b6973ce6c582b3b9
Showing with 40 additions and 2 deletions.
  1. +31 −2 src/modules/AutoinstSoftware.rb
  2. +9 −0 test/AutoinstSoftware_test.rb
@@ -12,6 +12,9 @@
module Yast
class AutoinstSoftwareClass < Module
include Yast::Logger

MAX_PACKAGE_VIEW = 5

def main
Yast.import "UI"
Yast.import "Pkg"
@@ -1087,14 +1090,40 @@ def SelectPackagesForInstallation
log.info "Storage packages for installation: #{storage_pack}"
failed_packages = failed_packages.merge(Pkg.DoProvide(storage_pack)) unless storage_pack.empty?

# Blaming only packages which have been selected by the AutoYaST configuration file
log.error "Cannot select following packages for installation:" unless failed_packages.empty?
failed_packages.reject! do |name,reason|
if @Software["packages"] && !@Software["packages"].include?(name)
log.error(" #{name} : #{reason} (selected by YAST automatically)")
true
else
log.error(" #{name} : #{reason} (selected by AutoYaST configuration file)")
false
end
end

unless failed_packages.empty?
log.error "Cannot select: #{failed_packages}"
not_selected = ""
suggest_y2log = false
failed_count = failed_packages.size
if failed_packages.size > MAX_PACKAGE_VIEW
failed_packages = failed_packages.first(MAX_PACKAGE_VIEW).to_h
suggest_y2log = true
end
failed_packages.each do |name,reason|
not_selected << "#{name}: #{reason}\n"
end
# TRANSLATORS: Warning text during the installation. %s is a list of package
Report.Error(_("These packages cannot be found in the software repositories:\n%s") % not_selected)
error_message = _("These packages cannot be found in the software repositories:\n%s") % not_selected
if suggest_y2log
# TRANSLATORS: Error message, %d is replaced by the amount of failed packages.
error_message += _("and %d additional packages") % (failed_count - MAX_PACKAGE_VIEW)
# TRANSLATORS: Error message, %s is replaced by "/var/log/YaST2/y2log"
error_message += "\n\n" + _("Details can be found in the %s file.") %
"/var/log/YaST2/y2log"
end

Report.Error(error_message)
end
end

@@ -39,6 +39,15 @@
expect(Yast::Report).to receive(:Error)
subject.SelectPackagesForInstallation()
end
it "shows a popup for not founded packages which have been selected by AY configuration only" do
allow(subject).to receive(:autoinstPackages).and_return(["a1"])
expect(Yast::Packages).to receive(:ComputeSystemPackageList).and_return([])
expect(Yast::Storage).to receive(:AddPackageList).and_return(["a2","a3"])
expect(Yast::Pkg).to receive(:DoProvide).with(["a1"]).and_return({"a1" => "not found"})
expect(Yast::Pkg).to receive(:DoProvide).with(["a2","a3"]).and_return({"a2" => "not found"})
expect(Yast::Report).to receive(:Error)
subject.SelectPackagesForInstallation()
end
end

end

0 comments on commit b63ef2c

Please sign in to comment.
You can’t perform that action at this time.