From a4da47e5a83c3a9006eb23b6887928406f328167 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Tue, 9 Jan 2024 15:13:18 +0100 Subject: [PATCH] Disable empty Online medium repository (bsc#1182303) --- package/yast2-packager.changes | 7 +++++++ package/yast2-packager.spec | 2 +- src/lib/packager/clients/pkg_finish.rb | 6 +++++- test/pkg_finish_test.rb | 4 +++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/package/yast2-packager.changes b/package/yast2-packager.changes index 64c6c27c..de28e1d0 100644 --- a/package/yast2-packager.changes +++ b/package/yast2-packager.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Jan 9 13:39:32 UTC 2024 - Ladislav Slezák + +- After installation disable the empty installation repository + from the SLE15 Online medium (bsc#1182303) +- 4.5.18 + ------------------------------------------------------------------- Fri May 5 08:34:49 UTC 2023 - Ladislav Slezák diff --git a/package/yast2-packager.spec b/package/yast2-packager.spec index b6f11c97..01618bcc 100644 --- a/package/yast2-packager.spec +++ b/package/yast2-packager.spec @@ -17,7 +17,7 @@ Name: yast2-packager -Version: 4.5.17 +Version: 4.5.18 Release: 0 Summary: YaST2 - Package Library License: GPL-2.0-or-later diff --git a/src/lib/packager/clients/pkg_finish.rb b/src/lib/packager/clients/pkg_finish.rb index 12c8422d..68fe74f1 100644 --- a/src/lib/packager/clients/pkg_finish.rb +++ b/src/lib/packager/clients/pkg_finish.rb @@ -13,6 +13,7 @@ require "installation/finish_client" require "y2packager/repository" +require "y2packager/resolvable" require "packager/cfa/zypp_conf" require "packager/cfa/dnf_conf" @@ -192,7 +193,10 @@ def disable_local_repos log.info "Not installed base products: #{non_installed_base.map(&:name)} " local_repos.each_with_object([]) do |repo, disabled| - if repo.products.empty? + # No product but the repository is not empty => most likely a 3rd party + # repository, do not touch it. + # The empty repository on the SLE Online medium is disabled by the code below. + if repo.products.empty? && Y2Packager::Resolvable.any?(kind: :package, source: repo.repo_id) log.info("Repo #{repo.repo_id} (#{repo.name}) does not have products; ignored") next end diff --git a/test/pkg_finish_test.rb b/test/pkg_finish_test.rb index bb6e5e6c..190da995 100755 --- a/test/pkg_finish_test.rb +++ b/test/pkg_finish_test.rb @@ -184,6 +184,7 @@ .to receive(:GetBooleanFeature) .with("software", "disable_media_repo") .and_return(true) + allow(Y2Packager::Resolvable).to receive(:any?).and_return(false) end context "dvd repo is disabled even if base products aren't available using other repos" do @@ -226,9 +227,10 @@ end end - context "if does not contain any product" do + context "if does not contain any product but is not empty" do before do allow(local_repo).to receive(:products).and_return([]) + allow(Y2Packager::Resolvable).to receive(:any?).and_return(true) end it "does not disable the local repository" do