Skip to content

Commit

Permalink
Display more details when the package solver fails (#388)
Browse files Browse the repository at this point in the history
* Display more details when the package solver fails

* Translator comments
  • Loading branch information
lslezak committed Jan 19, 2018
1 parent b65853c commit 796e454
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
5 changes: 5 additions & 0 deletions package/autoyast2.changes
@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Fri Jan 19 14:02:32 UTC 2018 - lslezak@suse.cz

- Display more details when the package solver fails

-------------------------------------------------------------------
Thu Jan 18 14:37:15 CET 2018 - schubi@suse.de

Expand Down
28 changes: 21 additions & 7 deletions src/modules/AutoinstSoftware.rb
Expand Up @@ -14,6 +14,11 @@
module Yast
class AutoinstSoftwareClass < Module
include Yast::Logger

# This file is created by pkg-bindings when the package solver fails,
# it contains some details of the failure
BAD_LIST_FILE = "/var/log/YaST2/badlist".freeze

def main
Yast.import "UI"
Yast.import "Pkg"
Expand Down Expand Up @@ -842,12 +847,12 @@ def Write

Packages.Init(true)
# Resetting package selection of previous runs. This is needed
# because it could be that additional repositories
# because it could be that additional repositories
# are available meanwhile. (bnc#979691)
Pkg.PkgApplReset

sw_settings = Profile.current.fetch("software",{})
Pkg.SetSolverFlags({ "ignoreAlreadyRecommended" => Mode.normal,
Pkg.SetSolverFlags({ "ignoreAlreadyRecommended" => Mode.normal,
"onlyRequires" => !sw_settings.fetch("install_recommended",true) })

failed = []
Expand Down Expand Up @@ -929,11 +934,20 @@ def Write
# Solve dependencies
#
if !Pkg.PkgSolve(false)
Report.Error(
_(
"The package resolver run failed. Please check your software section in the autoyast profile."
)
)
# TRANSLATORS: Error message
msg = _("The package resolver run failed. Please check your software " \
"section in the autoyast profile.")
# TRANSLATORS: Error message, %s is replaced by "/var/log/YaST2/y2log"
msg += "\n" + _("Additional details can be found in the %s file.") %
"/var/log/YaST2/y2log"

# read the details saved by pkg-bindings
if File.exist?(BAD_LIST_FILE)
msg += "\n\n"
msg += File.read(BAD_LIST_FILE)
end

Report.LongError(msg)
end

SpaceCalculation.ShowPartitionWarning
Expand Down

0 comments on commit 796e454

Please sign in to comment.