Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into simplify_slideshow
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Nov 24, 2021
2 parents 284d3e4 + 5281002 commit 2f5e9d8
Show file tree
Hide file tree
Showing 45 changed files with 2,871 additions and 514 deletions.
4 changes: 2 additions & 2 deletions devel/product_scanner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# *after* calling require "yast"
$LOAD_PATH.unshift(File.join(__dir__, "../src/lib"))

require "y2packager/product_location"
require "y2packager/product_spec_readers/full"

url = ARGV[0]

Expand All @@ -29,4 +29,4 @@

puts "Scanning #{url}..."

pp Y2Packager::ProductLocation.scan(url, base_product)
pp Y2Packager::ProductSpecReaders::Full.new.products(url, base_product)
63 changes: 50 additions & 13 deletions devel/test_addon_selector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,63 @@
#
# Run it using "yast2 ./test_addon_selector.rb" command

require "y2packager/product_location"
require "y2packager/repo_product_spec"
require "y2packager/dialogs/addon_selector"

new_repos = [
["Basesystem-Module 15-0", "/Basesystem"],
["Desktop-Applications-Module 15-0", "/Desktop-Applications"],
["Desktop-Productivity-Module 15-0", "/Desktop-Productivity"],
["Development-Tools-Module 15-0", "/Development-Tools"],
["HA-Module 15-0", "/HA"],
["HPC-Module 15-0", "/HPC"],
["Legacy-Module 15-0", "/Legacy"],
["Public-Cloud-Module 15-0", "/Public-Cloud"],
["SAP-Applications-Module 15-0", "/SAP-Applications"],
["Scripting-Module 15-0", "/Scripting"],
["Server-Applications-Module 15-0", "/Server-Applications"]
[
"sle-basesystem-module", "Basesystem Module",
"Basesystem-Module 15-0", "/Basesystem"
],
[
"sle-desktop-applications-module", "Desktop Applications Module",
"Desktop-Applications-Module 15-0", "/Desktop-Applications"
],
[
"sle-desktop-productivity-module", "Desktop Productivity Module",
"Desktop-Productivity-Module 15-0", "/Desktop-Productivity"
],
[
"sle-development-module", "Development Tools Module",
"Development-Tools-Module 15-0", "/Development-Tools"
],
[
"sle-ha-module", "High Availability Module",
"HA-Module 15-0", "/HA"
],
[
"sle-hpc-module", "High Performance Computing Module",
"HPC-Module 15-0", "/HPC"
],
[
"sle-legacy-module", "Legacy Module",
"Legacy-Module 15-0", "/Legacy"
],
[
"sle-public-cloud-module", "Public Cloud Module",
"Public-Cloud-Module 15-0", "/Public-Cloud"
],
[
"sle-sap-applications-module", "SAP Applications Module",
"SAP-Applications-Module 15-0", "/SAP-Applications"
],
[
"sle-scripting-module", "Scripting Module",
"Scripting-Module 15-0", "/Scripting"
],
[
"sle-server-applications-module", "Server Applications Module",
"Server-Applications-Module 15-0", "/Server-Applications"
]
]

puts "Repositories to select: " + new_repos.inspect

products = new_repos.map { |r| Y2Packager::ProductLocation.new(r[0], r[1]) }
products = new_repos.map do |name, display_name, _media_name, dir|
Y2Packager::RepoProductSpec.new(
name: name, display_name: display_name, media_name: display_name, dir: dir, base: false
)
end
dialog = Y2Packager::Dialogs::AddonSelector.new(products)

puts "Dialog result: " + dialog.run.inspect
Expand Down
17 changes: 17 additions & 0 deletions package/yast2-packager.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
-------------------------------------------------------------------
Mon Nov 22 08:22:46 UTC 2021 - Ladislav Slezák <lslezak@suse.cz>

- Use consistent names for the Full medium repositories
(bsc#1191652)
- 4.4.14

-------------------------------------------------------------------
Fri Nov 12 13:02:17 UTC 2021 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>

- Introduce the product specification API (bsc#1192626):
- Add a ProductSpec and derived classes.
- Drop ProductLocation and ProductLocationDetails.
- Add a specific client to initialize the workflow of the
selected product.
- 4.4.13

-------------------------------------------------------------------
Thu Nov 4 15:18:16 UTC 2021 - Ladislav Slezák <lslezak@suse.cz>

Expand Down
10 changes: 5 additions & 5 deletions package/yast2-packager.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-packager
Version: 4.4.12
Version: 4.4.14
Release: 0
Summary: YaST2 - Package Library
License: GPL-2.0-or-later
Expand All @@ -36,8 +36,8 @@ BuildRequires: rubygem(%{rb_default_ruby_abi}:nokogiri)
BuildRequires: yast2-storage-ng >= 4.0.141
# break the yast2-packager -> yast2-storage-ng -> yast2-packager build cycle
#!BuildIgnore: yast2-packager
# Installation::InstallationInfo
BuildRequires: yast2 >= 4.4.4
# ProductSpec API
BuildRequires: yast2 >= 4.4.21
# raw_name
BuildRequires: yast2-pkg-bindings >= 4.2.8
# Augeas lenses
Expand All @@ -48,8 +48,8 @@ BuildRequires: ruby-solv
Requires: yast2-country-data >= 2.16.3
# raw_name
Requires: yast2-pkg-bindings >= 4.2.8
# UIExtensionChecker
Requires: yast2 >= 4.4.19
# ProductSpec API
Requires: yast2 >= 4.4.21
# unzipping license file
Requires: unzip
# HTTP, FTP, HTTPS modules (inst_productsources.ycp)
Expand Down
3 changes: 3 additions & 0 deletions src/clients/inst_product_workflow.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
require "y2packager/clients/inst_product_workflow"

Y2Packager::Clients::InstProductWorkflow.new.main
14 changes: 9 additions & 5 deletions src/include/packager/repositories_include.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require "y2packager/product_location"
require "y2packager/product_spec_readers/full"
require "y2packager/product"

# encoding: utf-8
Expand Down Expand Up @@ -26,6 +26,7 @@ def initialize_packager_repositories_include(_include_target)
Yast.import "SourceDialogs"
Yast.import "Report"
Yast.import "Progress"
Yast.import "Packages"

textdomain "packager"

Expand Down Expand Up @@ -344,7 +345,7 @@ def autorefresh_for?(url)
private

# scan the repository URL and return the available products
# @return [Array<Y2Packager::ProductLocation>] Found products
# @return [Array<Y2Packager::RepoProductSpec>] Found products
def scan_products(_expanded_url, original_url)
# use the selected base product during installation,
# in installed system or during upgrade use the installed base product
Expand All @@ -355,7 +356,7 @@ def scan_products(_expanded_url, original_url)
end

log.info("Using base product: #{base_product}")
found_products = Y2Packager::ProductLocation.scan(original_url, base_product)
found_products = Y2Packager::ProductSpecReaders::Full.new.products(original_url, base_product)
log.info("Found products: #{found_products}")

# add at least one product if the scan result is empty (no product info available)
Expand All @@ -364,7 +365,7 @@ def scan_products(_expanded_url, original_url)
url_path = URL.Parse(original_url)["path"]
p_elems = url_path.split("/")

fallback = _("Repository")
fallback = Packages.fallback_name

if p_elems.size > 1
url_path = Ops.get(
Expand All @@ -386,7 +387,10 @@ def scan_products(_expanded_url, original_url)
url_path = fallback
end

found_products << Y2Packager::ProductLocation.new(url_path, "/")
found_products << Y2Packager::RepoProductSpec.new(
name: url_path, # FIXME: how is this addon selected?
dir: "/"
)
end

found_products
Expand Down
27 changes: 4 additions & 23 deletions src/lib/y2packager/clients/inst_product_license.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@

require "yast"
require "y2packager/dialogs/inst_product_license"
require "y2packager/medium_type"
require "y2packager/product"
require "y2packager/product_control_product"
require "y2packager/product_spec"
Yast.import "Language"
Yast.import "GetInstArgs"
Yast.import "Mode"
Expand Down Expand Up @@ -54,19 +52,12 @@ def main

# Return the selected base product
#
# @return [Y2Packager::Product]
# @return [Y2Packager::ProductSpec]
# @see Y2Packager::Product.selected_base
def product
return @product if @product

@product = if Y2Packager::MediumType.online?
# in an online installation read the products from the control.xml
Y2Packager::ProductControlProduct.selected
else
# otherwise read the product from the medium
Y2Packager::Product.selected_base
end

@product = Y2Packager::ProductSpec.selected_base
log.warn "No base product is selected for installation" unless @product
@product
end
Expand All @@ -77,17 +68,7 @@ def product
#
# @return [Boolean]
def multi_product_media?
if Y2Packager::MediumType.online?
# in an online installation read the products from the control.xml
Y2Packager::ProductControlProduct.products.size > 1
elsif Y2Packager::MediumType.offline?
# the offline medium always contains several products, but they are
# in separate sub-repositories so we cannot see them in libzypp
true
else
# otherwise read the products from the medium
Y2Packager::Product.available_base_products.size > 1
end
Y2Packager::ProductSpec.base_products.size > 1
end

# Determine whether the product's license should be shown
Expand Down
61 changes: 61 additions & 0 deletions src/lib/y2packager/clients/inst_product_workflow.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# ------------------------------------------------------------------------------
# Copyright (c) 2021 SUSE LLC
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of version 2 of the GNU General Public License as published by the
# Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# ------------------------------------------------------------------------------

require "yast"
require "y2packager/product"
require "y2packager/self_update_addon_repo"

Yast.import "GetInstArgs"
Yast.import "WorkflowManager"

module Y2Packager
module Clients
# Client to initialize product specific workflow
class InstProductWorkflow
include Yast::Logger
include Yast::I18n

# Client main method
def main
textdomain "packager"

# no changes if going back
return :back if Yast::GetInstArgs.going_back

# Add self update repo as it can contain updated rpms for product
if Y2Packager::SelfUpdateAddonRepo.present?
log.info "Adding the self-update add-on repository..."
Y2Packager::SelfUpdateAddonRepo.create_repo
else
log.info "Self-update repository not found - finishing..."
end

# initialize the workflow for the selected base product
merge_and_run_workflow

:next
end

private

# Merge selected product's workflow and go to the next step
#
# @see Yast::WorkflowManager.merge_product_workflow
def merge_and_run_workflow
Yast::WorkflowManager.SetBaseWorkflow(false)
Yast::WorkflowManager.merge_product_workflow(Y2Packager::Product.selected_base)
Yast::ProductControl.RunFrom(Yast::ProductControl.CurrentStep + 1, true)
end
end
end
end
35 changes: 4 additions & 31 deletions src/lib/y2packager/clients/inst_repositories_initialization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,7 @@ def main
return :auto
end

# for the Full medium we need to just add the self-update add-on
# repo to make the new roles work
if Y2Packager::MediumType.offline?
if Y2Packager::SelfUpdateAddonRepo.present?
log.info "Adding the self-update add-on repository..."
Y2Packager::SelfUpdateAddonRepo.create_repo
else
log.info "Self-update repository not found - finishing..."
end

return :auto
end
return :auto if Y2Packager::MediumType.offline?

if !init_installation_repositories
Yast::Popup.Error(
Expand All @@ -75,10 +64,6 @@ def main

adjust_base_product_selection

# in an online installation and we need to additionally load and initialize
# the workflow for the registered base product
merge_and_run_workflow if Y2Packager::MediumType.online?

:next
end

Expand All @@ -99,21 +84,9 @@ def init_installation_repositories
# FIXME: UI.SetProductName(Product.name || "SUSE Linux")
Yast::PackageCallbacks.RestorePreviousProgressCallbacks

# add extra addon repo built from the initial self update repository (bsc#1101016)
Y2Packager::SelfUpdateAddonRepo.create_repo if Y2Packager::SelfUpdateAddonRepo.present?

true
end

# Merge selected product's workflow and go to the next step
#
# @see Yast::WorkflowManager.merge_product_workflow
def merge_and_run_workflow
Yast::WorkflowManager.SetBaseWorkflow(false)
Yast::WorkflowManager.merge_product_workflow(Y2Packager::Product.selected_base)
Yast::ProductControl.RunFrom(Yast::ProductControl.CurrentStep + 1, true)
end

# Adjust product selection
#
# During installation, all products are selected by default. So if there
Expand All @@ -127,7 +100,7 @@ def merge_and_run_workflow
# @see https://github.com/yast/yast-packager/blob/7e1a0bbb90823b03c15d92f408036a560dca8aa3/src/modules/Packages.rb#L1876
# @see https://github.com/yast/yast-packager/blob/fbc396df910e297915f9f785fc460e72e30d1948/src/modules/Packages.rb#L1905
def adjust_base_product_selection
forced_base_product = Y2Packager::Product.forced_base_product
forced_base_product = Y2Packager::ProductSpec.forced_base_product&.to_product

if forced_base_product
log.info("control.xml wants to force the #{forced_base_product.name} product")
Expand All @@ -145,9 +118,9 @@ def adjust_base_product_selection

# Return base available products
#
# @return [Array<Y2Product>] Available base products
# @return [Array<Y2Packager::Product>] Available base products
def products
@products ||= Y2Packager::Product.available_base_products
@products ||= Y2Packager::ProductSpec.base_products.map(&:to_product)
end
end
end
Expand Down
Loading

0 comments on commit 2f5e9d8

Please sign in to comment.