Skip to content

Commit

Permalink
PoC to retain openSUSE behaviour when searching for base products
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed Sep 5, 2017
1 parent 1859721 commit 2baf88f
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/lib/y2packager/product_reader.rb
Expand Up @@ -41,13 +41,12 @@ def self.available_base_products
installation_package: installation_mapping[prod["name"]])
end

# only installable products
result.select!(&:installation_package)
products = find_installable(result)

# sort the products
result.sort!(&::Y2Packager::PRODUCT_SORTER)
products.sort!(&::Y2Packager::PRODUCT_SORTER)

log.info "available base products #{result}"
log.info "available base products #{products}"

result
end
Expand All @@ -73,8 +72,6 @@ def self.available_products
products
end

private_class_method :available_products

def self.installation_package_mapping
installation_packages = Yast::Pkg.PkgQueryProvides("system-installation()")
log.info "Installation packages: #{installation_packages.inspect}"
Expand All @@ -98,5 +95,22 @@ def self.installation_package_mapping

mapping
end

def self.find_installable(products)
installable_products = products.select(&:installation_package)
return installable_products unless installable_products.empty?

log.info "No products with system-installation()."

if installable_products.size == 1
log.info "Assuming #{installable_product.first.label} is the base one."
return result
end

log.info "Cannot find the installable product in these candidates: #{products.inspect}"
[]
end

private_class_method :available_products, :find_installable
end
end

0 comments on commit 2baf88f

Please sign in to comment.