Skip to content

Commit

Permalink
taking an own map for conflicting
Browse files Browse the repository at this point in the history
  • Loading branch information
schubi2 committed Mar 7, 2017
1 parent c1b936c commit 833e3f5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
4 changes: 1 addition & 3 deletions src/modules/AddOnProduct.rb
Expand Up @@ -145,9 +145,7 @@ def main
"sle-hae" => [ "sle-ha" ],
"SUSE_SLES_SAP" => [ "SLES_SAP" ],
# SMT is now integrated into the base SLES
"sle-smt" => [ "SLES" ],
# SLES_SAP includes SLES. So SLES is not needed anymore
"SLES" => [ "SLES_SAP" ]
"sle-smt" => [ "SLES" ]
}

end
Expand Down
27 changes: 21 additions & 6 deletions src/modules/Packages.rb
Expand Up @@ -29,6 +29,13 @@ class PackagesClass < Module
# Minimum set of packages required for installation with remote X11 server
REMOTE_X11_BASE_TAGS = [ "xorg-x11-server", "xorg-x11-fonts", "icewm" ]

# Some products are already be "included" in other products. So they MUST
# not be installed anymore and conflicting to the other one.
PRODUCT_CONFLICTS = {
# SLES_SAP includes SLES. So SLES is not needed anymore
"SLES" => [ "SLES_SAP" ]
}

def main
Yast.import "UI"
Yast.import "Pkg"
Expand Down Expand Up @@ -2095,16 +2102,16 @@ def SelectProduct
end

# Due selecting all available products there can be products which
# are conflicting due e.g. renaming eachother. These conflicts
# can be solved automatically.
# are conflicting.
# E.g products are already be "included" by other products. So they MUST
# not be installed anymore.
selected_products.reject! do |old_product|
selected_products.any? do |new_product|
renamed = AddOnProduct.renamed?(old_product, new_product)
log.info("Product #{old_product} will be renamed by or is included in #{new_product}") if renamed
renamed
conflicts = product_conflicts?(old_product, new_product)
log.info("Product #{old_product} conflicts with #{new_product} and will not be installed.") if conflicts
conflicts
end
end

ret = selected_products.all? { |name| Pkg.ResolvableInstall(name, :product) }
end

Expand Down Expand Up @@ -2790,6 +2797,14 @@ def kept_products(products)
def has_window_manager?
Pkg.IsSelected("windowmanager") || Pkg.IsProvided("windowmanager")
end

# Checking if two products are conflicting with each other.
#
# @return [Boolean] true if there are conflicts
def product_conflicts?(product1, product2)
return false unless PRODUCT_CONFLICTS[product1]
PRODUCT_CONFLICTS[product1].include?(product2)
end
end

Packages = PackagesClass.new
Expand Down

0 comments on commit 833e3f5

Please sign in to comment.