From 7f7ebce8ad4fa3b9fe5f6645c82dfd44cab536c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Wed, 10 Jul 2019 17:20:40 +0200 Subject: [PATCH] Comments --- devel/product_scanner.rb | 9 ++- src/lib/y2packager/dialogs/addon_selector.rb | 16 +++-- .../y2packager/dialogs/product_summary.erb | 6 +- src/lib/y2packager/product_finder.rb | 65 +++++++++++++++---- src/lib/y2packager/product_location.rb | 15 ++++- src/modules/Packages.rb | 3 + test/product_location_test.rb | 4 +- 7 files changed, 93 insertions(+), 25 deletions(-) diff --git a/devel/product_scanner.rb b/devel/product_scanner.rb index 97b9560ac..e1081c8f7 100755 --- a/devel/product_scanner.rb +++ b/devel/product_scanner.rb @@ -1,9 +1,13 @@ #! /usr/bin/env ruby -# This script tests the product scanner which evaluates the -# SLES Packages DVD or the Offline installation medium. +# This is a testing script which runs the product scanner +# for the SLES Packages DVD or the Offline installation medium. +require "pp" require "yast" + +# YaST modifies the load path, we need to update it +# *after* calling require "yast" $LOAD_PATH.unshift(File.join(__dir__, "../src/lib")) require "y2packager/product_location" @@ -25,5 +29,4 @@ puts "Scanning #{url}..." -require "pp" pp Y2Packager::ProductLocation.scan(url, base_product) diff --git a/src/lib/y2packager/dialogs/addon_selector.rb b/src/lib/y2packager/dialogs/addon_selector.rb index 06c55b1b3..8ac0c3150 100644 --- a/src/lib/y2packager/dialogs/addon_selector.rb +++ b/src/lib/y2packager/dialogs/addon_selector.rb @@ -32,7 +32,8 @@ class AddonSelector < ::UI::InstallationDialog attr_reader :selected_products # TODO: handle a theoretical case when a product subdirectory contains several - # libzypp products + # libzypp products (only for 3rd party or manually created media, the official + # SUSE media always contain one product per repository) # Constructor # @@ -41,8 +42,10 @@ def initialize(products) super() textdomain "packager" - # do not offer base products, they would conflict with the already selected base product - @products = products.select { |p| !p.base } + @products = products + # do not offer base products, they would conflict with the already selected base product, + # allow a hidden way to force displaying them in some special cases + @products.reject!(&:base) unless ENV["Y2_DISPLAY_BASE_PRODUCTS"] == "1" @selected_products = [] end @@ -85,8 +88,8 @@ def addon_repos_handler select_dependant_products end + # refresh the details of the currently selected add-on def refresh_details(current_product) - # refresh the details details = product_description(current_product) Yast::UI.ChangeWidget(Id(:details), :Value, details) Yast::UI.ChangeWidget(Id(:details), :Enabled, true) @@ -96,11 +99,15 @@ def select_dependant_products # select the dependent products new_selection = current_selection + # the selection has not changed, nothing to do return if new_selection == selected_products + # add the dependant items to the selected list selected_items = Yast::UI.QueryWidget(Id(:addon_repos), :SelectedItems) new_items = new_selection - selected_products new_items.each do |p| + # the dependencies contain also the transitive (indirect) dependencies, + # we do not need to recursively evaluate the list selected_items.concat(p.depends_on) end @@ -209,6 +216,7 @@ def product_description(product) dependencies = [] if product.depends_on && !product.depends_on.empty? product.depends_on.each do |p| + # display the human readable product name instead of the product directory prod = @products.find { |pr| pr.dir == p } dependencies << (prod.summary || prod.name) if prod end diff --git a/src/lib/y2packager/dialogs/product_summary.erb b/src/lib/y2packager/dialogs/product_summary.erb index 822802e2f..32322274c 100644 --- a/src/lib/y2packager/dialogs/product_summary.erb +++ b/src/lib/y2packager/dialogs/product_summary.erb @@ -2,14 +2,18 @@ textdomain "packager" %> +<%# TRANSLATORS: the RichText header, followed by the name of the directory %> <%= _("Directory on the Media:") %> <%= h(product.dir) %>
+<%# TRANSLATORS: the RichText header, followed by the name of the medium %> <%= _("Media Name:") %> <%= h(product.name) %>
<% if product.product_name %> + <%# TRANSLATORS: the RichText header, followed by the product identifier, e.g. "SLES" %> <%= _("Product ID:") %> <%= h(product.product_name) %> <% end %> <% if !dependencies.empty? %> + <%# TRANSLATORS: the RichText section header, followed by the names of the dependant products %>

<%= _("Dependencies") %>