Hello community, here is the log from the commit of package yast2-packager for openSUSE:Factory checked in at 2019-09-23 13:16:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-packager (Old) and /work/SRC/openSUSE:Factory/.yast2-packager.new.7948 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-packager" Mon Sep 23 13:16:41 2019 rev:379 rq:732113 version:4.2.27 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-packager/yast2-packager.changes 2019-09-02 13:20:57.805360595 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-packager.new.7948/yast2-packager.changes 2019-09-23 13:16:43.241112457 +0200 @@ -1,0 +2,20 @@ +Wed Sep 18 11:28:23 UTC 2019 - Ladislav Slezák <[email protected]> + +- Support for the online installation medium (jsc#SLE-7214) +- 4.2.27 + +------------------------------------------------------------------- +Wed Sep 18 06:40:17 UTC 2019 - Ladislav Slezák <[email protected]> + +- Properly initialize the used base product name at upgrade + (bsc#1150856) +- 4.2.26 + +------------------------------------------------------------------- +Wed Sep 4 14:32:20 UTC 2019 - Ladislav Slezák <[email protected]> + +- Added Y2Packager::MediumType class for detecting the installation + medium type (related to jsc#SLE-7214) +- 4.2.25 + +------------------------------------------------------------------- Old: ---- yast2-packager-4.2.24.tar.bz2 New: ---- yast2-packager-4.2.27.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-packager.spec ++++++ --- /var/tmp/diff_new_pack.lgo3VJ/_old 2019-09-23 13:16:43.709112373 +0200 +++ /var/tmp/diff_new_pack.lgo3VJ/_new 2019-09-23 13:16:43.709112373 +0200 @@ -17,7 +17,7 @@ Name: yast2-packager -Version: 4.2.24 +Version: 4.2.27 Release: 0 Summary: YaST2 - Package Library License: GPL-2.0-or-later @@ -35,8 +35,8 @@ BuildRequires: yast2-storage-ng >= 4.0.141 # break the yast2-packager -> yast2-storage-ng -> yast2-packager build cycle #!BuildIgnore: yast2-packager -# inst_rpmcopy.rb: SlideShow.RebuildDialog(true) -BuildRequires: yast2 >= 4.2.8 +# Y2Packager::ProductControlProduct +BuildRequires: yast2 >= 4.2.22 # Pkg::Resolvables BuildRequires: yast2-pkg-bindings >= 4.2.0 # Augeas lenses @@ -47,8 +47,8 @@ Requires: yast2-country-data >= 2.16.3 # Pkg::Resolvables Requires: yast2-pkg-bindings >= 4.2.0 -# Y2Packager::Product.forced_base_product -Requires: yast2 >= 4.2.17 +# Y2Packager::ProductControlProduct +Requires: yast2 >= 4.2.22 # unzipping license file Requires: unzip # HTTP, FTP, HTTPS modules (inst_productsources.ycp) ++++++ yast2-packager-4.2.24.tar.bz2 -> yast2-packager-4.2.27.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-4.2.24/package/yast2-packager.changes new/yast2-packager-4.2.27/package/yast2-packager.changes --- old/yast2-packager-4.2.24/package/yast2-packager.changes 2019-08-29 10:32:55.000000000 +0200 +++ new/yast2-packager-4.2.27/package/yast2-packager.changes 2019-09-20 11:36:49.000000000 +0200 @@ -1,4 +1,24 @@ ------------------------------------------------------------------- +Wed Sep 18 11:28:23 UTC 2019 - Ladislav Slezák <[email protected]> + +- Support for the online installation medium (jsc#SLE-7214) +- 4.2.27 + +------------------------------------------------------------------- +Wed Sep 18 06:40:17 UTC 2019 - Ladislav Slezák <[email protected]> + +- Properly initialize the used base product name at upgrade + (bsc#1150856) +- 4.2.26 + +------------------------------------------------------------------- +Wed Sep 4 14:32:20 UTC 2019 - Ladislav Slezák <[email protected]> + +- Added Y2Packager::MediumType class for detecting the installation + medium type (related to jsc#SLE-7214) +- 4.2.25 + +------------------------------------------------------------------- Wed Aug 28 12:59:14 UTC 2019 - José Iván López González <[email protected]> - Avoid error when generating some warnings (bsc#1148536). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-4.2.24/package/yast2-packager.spec new/yast2-packager-4.2.27/package/yast2-packager.spec --- old/yast2-packager-4.2.24/package/yast2-packager.spec 2019-08-29 10:32:55.000000000 +0200 +++ new/yast2-packager-4.2.27/package/yast2-packager.spec 2019-09-20 11:36:49.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-packager -Version: 4.2.24 +Version: 4.2.27 Release: 0 Summary: YaST2 - Package Library License: GPL-2.0-or-later @@ -35,8 +35,8 @@ BuildRequires: yast2-storage-ng >= 4.0.141 # break the yast2-packager -> yast2-storage-ng -> yast2-packager build cycle #!BuildIgnore: yast2-packager -# inst_rpmcopy.rb: SlideShow.RebuildDialog(true) -BuildRequires: yast2 >= 4.2.8 +# Y2Packager::ProductControlProduct +BuildRequires: yast2 >= 4.2.22 # Pkg::Resolvables BuildRequires: yast2-pkg-bindings >= 4.2.0 # Augeas lenses @@ -47,8 +47,8 @@ Requires: yast2-country-data >= 2.16.3 # Pkg::Resolvables Requires: yast2-pkg-bindings >= 4.2.0 -# Y2Packager::Product.forced_base_product -Requires: yast2 >= 4.2.17 +# Y2Packager::ProductControlProduct +Requires: yast2 >= 4.2.22 # unzipping license file Requires: unzip # HTTP, FTP, HTTPS modules (inst_productsources.ycp) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-4.2.24/src/include/packager/repositories_include.rb new/yast2-packager-4.2.27/src/include/packager/repositories_include.rb --- old/yast2-packager-4.2.24/src/include/packager/repositories_include.rb 2019-08-29 10:32:55.000000000 +0200 +++ new/yast2-packager-4.2.27/src/include/packager/repositories_include.rb 2019-09-20 11:36:49.000000000 +0200 @@ -22,6 +22,7 @@ Yast.import "PackageSystem" Yast.import "Popup" Yast.import "Label" + Yast.import "Mode" Yast.import "SourceDialogs" Yast.import "Report" Yast.import "Progress" @@ -343,8 +344,8 @@ # @return [Array<Y2Packager::ProductLocation>] Found products def scan_products(_expanded_url, original_url) # use the selected base product during installation, - # in installed system use the installed base product - base_product = if Stage.initial + # in installed system or during upgrade use the installed base product + base_product = if Stage.initial && !Mode.update Y2Packager::Product.selected_base&.name else Y2Packager::Product.installed_base_product&.name diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-4.2.24/src/lib/y2packager/clients/inst_product_license.rb new/yast2-packager-4.2.27/src/lib/y2packager/clients/inst_product_license.rb --- old/yast2-packager-4.2.24/src/lib/y2packager/clients/inst_product_license.rb 2019-08-29 10:32:55.000000000 +0200 +++ new/yast2-packager-4.2.27/src/lib/y2packager/clients/inst_product_license.rb 2019-09-20 11:36:49.000000000 +0200 @@ -12,7 +12,9 @@ require "yast" require "y2packager/dialogs/inst_product_license" +require "y2packager/medium_type" require "y2packager/product" +require "y2packager/product_control_product" Yast.import "Language" Yast.import "GetInstArgs" Yast.import "Mode" @@ -57,7 +59,14 @@ def product return @product if @product - @product = Y2Packager::Product.selected_base + @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 + log.warn "No base product is selected for installation" unless @product @product end @@ -68,7 +77,13 @@ # # @return [Boolean] def multi_product_media? - Y2Packager::Product.available_base_products.size > 1 + if Y2Packager::MediumType.online? + # in an online installation read the products from the control.xml + Y2Packager::ProductControlProduct.products.size > 1 + else + # otherwise read the products from the medium + Y2Packager::Product.available_base_products.size > 1 + end end # Determine whether the product's license should be shown diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-4.2.24/src/lib/y2packager/clients/inst_repositories_initialization.rb new/yast2-packager-4.2.27/src/lib/y2packager/clients/inst_repositories_initialization.rb --- old/yast2-packager-4.2.24/src/lib/y2packager/clients/inst_repositories_initialization.rb 2019-08-29 10:32:55.000000000 +0200 +++ new/yast2-packager-4.2.27/src/lib/y2packager/clients/inst_repositories_initialization.rb 2019-09-20 11:36:49.000000000 +0200 @@ -14,6 +14,7 @@ require "yast" require "y2packager/product" require "y2packager/self_update_addon_repo" +require "y2packager/medium_type" Yast.import "Packages" Yast.import "PackageCallbacks" @@ -36,6 +37,11 @@ def main textdomain "packager" + if Y2Packager::MediumType.skip_step? + log.info "Skipping the client on the #{Y2Packager::MediumType.type} medium" + return :auto + end + if !init_installation_repositories Yast::Popup.Error( _("Failed to initialize the software repositories.\nAborting the installation.") @@ -51,6 +57,11 @@ end 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 @@ -59,7 +70,9 @@ # Initialize installation repositories def init_installation_repositories Yast::PackageCallbacks.RegisterEmptyProgressCallbacks - Yast::Packages.InitializeCatalogs + # the online installation uses the repositories from the registration server, + # skip initializing the repository from the medium, it is missing there + Yast::Packages.InitializeCatalogs unless Y2Packager::MediumType.online? return false if Yast::Packages.InitFailed Yast::Packages.InitializeAddOnProducts @@ -75,6 +88,15 @@ 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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-4.2.24/src/lib/y2packager/medium_type.rb new/yast2-packager-4.2.27/src/lib/y2packager/medium_type.rb --- old/yast2-packager-4.2.24/src/lib/y2packager/medium_type.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-packager-4.2.27/src/lib/y2packager/medium_type.rb 2019-09-20 11:36:49.000000000 +0200 @@ -0,0 +1,122 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) 2019 SUSE LLC, All Rights Reserved. +# +# 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_location" +require "y2packager/repomd_downloader" + +Yast.import "InstURL" + +module Y2Packager + # This class scans the installation medium type and detects which installation + # medium type it is (online/offline/standard). + class MediumType + class << self + include Yast::Logger + + # Type of the installation medium, raises an exception if the installation + # URL is not set (nil) or is empty. + # + # @return [Symbol] Symbol describing the medium, one of `:offline`, + # `:online` or `:standard` + def type + @type ||= detect_medium_type + end + + # Is the medium an online installation medium? (SLE Online) + # Raises an exception if the installation URL is not set (nil) or is empty. + # The online installation medium contains no repository + # or a repository without any base product. + def online? + type == :online + end + + # Is the medium an offline installation medium? (SLE Offline) + # Raises an exception if the installation URL is not set (nil) or is empty. + # The offline installation medium contains several installation repositories. + # (At least one base product and one module/extension, usually there are + # several base products and many modules/extensions.) + def offline? + type == :offline + end + + # Is the medium an standard installation medium? (openSUSE Leap) + # Raises an exception if the installation URL is not set (nil) or is empty. + # The standard installation medium contains a single repository + # with at least one base product. (Usually there is only one base product.) + def standard? + type == :standard + end + + # Helper method which evaluates the client arguments and the installation + # medium type and returns whether the client should be skipped. + # + # @return [Boolean] True if the client should be skipped. + # + def skip_step? + skip = Yast::WFM.Args(0) && Yast::WFM.Args(0)["skip"] + return true if skip&.split(",")&.include?(type.to_s) + + only = Yast::WFM.Args(0) && Yast::WFM.Args(0)["only"] + return true if only && !only.split(",").include?(type.to_s) + + false + end + + private + + # + # Detect the medium type. + # + # @return [Symbol] Symbol describing the medium, one of `:offline`, + # `:online` or `:standard` + def detect_medium_type + url = Yast::InstURL.installInf2Url("") + + raise "The installation URL is not set" if url.nil? || url.empty? + + # scan the number of the products in the media.1/products file + downloader = Y2Packager::RepomdDownloader.new(url) + product_repos = downloader.product_repos + + # the online medium should not contain any repository + # TODO: how to detect an invalid installation URL or a broken medium?? + if product_repos.empty? + log.info("Detected medium type: online (no repository on the medium)") + return :online + end + + # the offline medium contains several modules and extensions + if product_repos.size > 1 + log.info("Detected medium type: offline (found #{product_repos.size} product repos)") + return :offline + end + + # no preferred base product for evaluating the dependencies + base_product = nil + # run the scan even when there is only one repository on the medium + force_scan = true + base_products = Y2Packager::ProductLocation.scan(url, base_product, force_scan) + .select { |p| p.details&.base } + + if base_products.empty? + log.info("Detected medium type: online (no base product found on the medium)") + :online + else + log.info("Detected medium type: standard (found #{base_products.size} base products)") + :standard + end + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-4.2.24/src/lib/y2packager/product_location.rb new/yast2-packager-4.2.27/src/lib/y2packager/product_location.rb --- old/yast2-packager-4.2.24/src/lib/y2packager/product_location.rb 2019-08-29 10:32:55.000000000 +0200 +++ new/yast2-packager-4.2.27/src/lib/y2packager/product_location.rb 2019-09-20 11:36:49.000000000 +0200 @@ -42,16 +42,20 @@ # @param base_product [String,nil] The base product used for evaluating the # product dependencies, if nil the solver can select any product to satisfy # the dependencies. + # @param force_scan [Boolean] force evaluating the products (and their + # dependencies) even when there is only one repository on the medium. + # For the performance reasons the default is `false`, set `true` for + # special cases. # # @return [Array<Y2Packager::ProductLocation>] The found products # - def self.scan(url, base_product = nil) + def self.scan(url, base_product = nil, force_scan = false) log.info "Scanning #{Yast::URL.HidePassword(url)} for products..." downloader = Y2Packager::RepomdDownloader.new(url) # Skip the scan if there is none or just one repository, the repository selection # is displayed only when there are at least 2 repositories. - return [] if downloader.product_repos.size < 2 + return [] if downloader.product_repos.size < 2 && !force_scan pool = Y2Packager::SolvablePool.new diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-4.2.24/src/lib/y2packager/storage_manager_proxy.rb new/yast2-packager-4.2.27/src/lib/y2packager/storage_manager_proxy.rb --- old/yast2-packager-4.2.24/src/lib/y2packager/storage_manager_proxy.rb 2019-08-29 10:32:55.000000000 +0200 +++ new/yast2-packager-4.2.27/src/lib/y2packager/storage_manager_proxy.rb 2019-09-20 11:36:49.000000000 +0200 @@ -1,7 +1,3 @@ -#!/usr/bin/env ruby -# -# encoding: utf-8 - # Copyright (c) [2017] SUSE LLC # # All Rights Reserved. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-4.2.24/test/lib/clients/inst_product_license_test.rb new/yast2-packager-4.2.27/test/lib/clients/inst_product_license_test.rb --- old/yast2-packager-4.2.24/test/lib/clients/inst_product_license_test.rb 2019-08-29 10:32:55.000000000 +0200 +++ new/yast2-packager-4.2.27/test/lib/clients/inst_product_license_test.rb 2019-09-20 11:36:49.000000000 +0200 @@ -31,6 +31,7 @@ allow(Y2Packager::Product).to receive(:selected_base).and_return(product) allow(Y2Packager::Product).to receive(:available_base_products).and_return(products) allow(Yast::Mode).to receive(:auto).and_return(auto) + allow(Y2Packager::MediumType).to receive(:online?).and_return(false) stub_const("Yast::Language", language) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-4.2.24/test/lib/clients/inst_repositories_initialization_test.rb new/yast2-packager-4.2.27/test/lib/clients/inst_repositories_initialization_test.rb --- old/yast2-packager-4.2.24/test/lib/clients/inst_repositories_initialization_test.rb 2019-08-29 10:32:55.000000000 +0200 +++ new/yast2-packager-4.2.27/test/lib/clients/inst_repositories_initialization_test.rb 2019-09-20 11:36:49.000000000 +0200 @@ -19,6 +19,7 @@ allow(Y2Packager::Product).to receive(:forced_base_product) allow(Y2Packager::Product).to receive(:available_base_products).and_return(products) allow(Y2Packager::SelfUpdateAddonRepo).to receive(:present?).and_return(false) + allow(Y2Packager::MediumType).to receive(:online?).and_return(false) end it "initializes Packages subsystem" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-4.2.24/test/medium_type_test.rb new/yast2-packager-4.2.27/test/medium_type_test.rb --- old/yast2-packager-4.2.24/test/medium_type_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-packager-4.2.27/test/medium_type_test.rb 2019-09-20 11:36:49.000000000 +0200 @@ -0,0 +1,111 @@ +require_relative "test_helper" +require "y2packager/medium_type" + +describe Y2Packager::MediumType do + let(:repo_url) { "http://example.com/repo" } + + before do + allow(Yast::InstURL).to receive(:installInf2Url).and_return(repo_url) + end + + after do + # the computed value is cached, we need to reset it manually for the next test + described_class.instance_variable_set(:@type, nil) + end + + describe "#type" do + it "raises an exception when the installation URL is nil" do + expect(Yast::InstURL).to receive(:installInf2Url).and_return(nil) + expect { described_class.type }.to raise_exception(/The installation URL is not set/) + end + + it "raises an exception when the installation URL is empty" do + expect(Yast::InstURL).to receive(:installInf2Url).and_return("") + expect { described_class.type }.to raise_exception(/The installation URL is not set/) + end + + it "returns :online if no repository is found on the medium" do + expect_any_instance_of(Y2Packager::RepomdDownloader) + .to receive(:product_repos).and_return([]) + + expect(described_class.type).to eq(:online) + end + + it "returns :offline if at least two repositories are found on the medium" do + expect_any_instance_of(Y2Packager::RepomdDownloader) + .to receive(:product_repos).and_return( + [ + ["Basesystem-Module 15.1-0", "/Module-Basesystem"], + ["SLES15-SP1 15.1-0", "/Product-SLES"] + ] + ) + + expect(described_class.type).to eq(:offline) + end + + context "only one repository on the installation medium" do + before do + expect_any_instance_of(Y2Packager::RepomdDownloader) + .to receive(:product_repos).and_return( + [ + ["SLES15-SP1 15.1-0", "/"] + ] + ) + end + + it "returns :online if the repository does not contain any base product" do + expect(Y2Packager::ProductLocation).to receive(:scan).and_return([]) + expect(described_class.type).to eq(:online) + end + + it "returns :standard if the repository contains any base product" do + details = Y2Packager::ProductLocationDetails.new( + product: "SLES", + summary: "SUSE Linux Enterprise Server 15 SP1", + description: "SUSE Linux Enterprise offers a comprehensive...", + order: 200, + base: true, + depends_on: [], + product_package: "sles-release" + ) + prod = Y2Packager::ProductLocation.new("/", "/", product: details) + + expect(Y2Packager::ProductLocation).to receive(:scan).and_return([prod]) + expect(described_class.type).to eq(:standard) + end + end + end + + describe "#skip_step?" do + context "online installation medium" do + before do + allow(Y2Packager::MediumType).to receive(:type).and_return(:online) + end + + it "returns true if the client args contain \"skip\" => \"online\"" do + allow(Yast::WFM).to receive(:Args).with(0).and_return("skip" => "online") + expect(Y2Packager::MediumType.skip_step?).to eq(true) + end + it "returns true if the client args contain \"skip\" => \"standard,online\"" do + allow(Yast::WFM).to receive(:Args).with(0).and_return("skip" => "standard,online") + expect(Y2Packager::MediumType.skip_step?).to eq(true) + end + it "returns false if the client args do not contain \"skip\" => \"online\"" do + allow(Yast::WFM).to receive(:Args).with(0).and_return({}) + expect(Y2Packager::MediumType.skip_step?).to eq(false) + end + it "returns false if the client args contain \"only\" => \"online\"" do + allow(Yast::WFM).to receive(:Args).with(0).and_return("only" => "online") + expect(Y2Packager::MediumType.skip_step?).to eq(false) + end + it "returns false if the client args contain \"only\" => \"online,standard\"" do + allow(Yast::WFM).to receive(:Args).with(0).and_return("only" => "standard,online") + expect(Y2Packager::MediumType.skip_step?).to eq(false) + end + it "returns false if the client args do not contain \"only\" => \"online\"" do + allow(Yast::WFM).to receive(:Args).with(0).and_return({}) + expect(Y2Packager::MediumType.skip_step?).to eq(false) + end + end + end +end
