From 55bd6e38c128dcf8c28cfc9c46a3941e727b9a48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Imobach=20Gonz=C3=A1lez=20Sosa?= Date: Mon, 9 Mar 2026 12:49:07 +0000 Subject: [PATCH 1/4] Check the selection of the release package --- rust/agama-software/src/zypp_server.rs | 99 +++++++++++++------------- 1 file changed, 51 insertions(+), 48 deletions(-) diff --git a/rust/agama-software/src/zypp_server.rs b/rust/agama-software/src/zypp_server.rs index ee2e33ecd9..4da672d259 100644 --- a/rust/agama-software/src/zypp_server.rs +++ b/rust/agama-software/src/zypp_server.rs @@ -47,7 +47,7 @@ use crate::{ state::{self, SoftwareState}, WriteIssues, }, - state::{Addon, RegistrationState, RepoKey, ResolvableSelection}, + state::{Addon, RegistrationState, RepoKey, ResolvableSelection, ResolvablesState}, Registration, ResolvableType, }; @@ -418,59 +418,41 @@ impl ZyppServer { // reset everything to start from scratch zypp.reset_resolvables(); - // FIXME: hotfix/workaround for bsc#1259311 - check if a *-release package is selected to install - // and if so then do not select the product to install, this should be removed after fixing the solver - let mut selected_release_package: Option = None; - for (name, r#type, selection) in &state.resolvables.to_vec() { - if r#type == &ResolvableType::Package - && name.ends_with("-release") - // uh, the "lsb-release" package actually does not provide any product... - && name != "lsb-release" - { - match selection { - ResolvableSelection::Selected | ResolvableSelection::AutoSelected { .. } => { - selected_release_package = Some(name.clone()); - break; - } - ResolvableSelection::Removed => {} - } - } - } + tracing::info!("Selecting base product: {}", &state.product); - _ = progress.cast(progress::message::Next::new(Scope::Software)); - if let Some(release_package) = selected_release_package { - tracing::info!( - "Release package {} will be installed, not selecting the product {} to install", - release_package, - &state.product - ); - } else { - tracing::info!("Selecting base product: {}", &state.product); - let result = zypp.select_resolvable( + // FIXME: hotfix/workaround for bsc#1259311 - this should be removed after fixing the solver + let result = match Self::find_release_package(&state.resolvables) { + Some(package) => zypp.select_resolvable( + &package, + zypp_agama::ResolvableKind::Package, + zypp_agama::ResolvableSelected::Installation, + ), + None => zypp.select_resolvable( &state.product, zypp_agama::ResolvableKind::Product, zypp_agama::ResolvableSelected::Installation, + ), + }; + + if let Err(error) = result { + tracing::info!( + "Failed to find the product {} in the repositories: {}", + &state.product, + &error ); - if let Err(error) = result { - tracing::info!( - "Failed to find the product {} in the repositories: {}", - &state.product, - &error - ); - if state.allow_registration && !self.is_registered() { - let message = gettext("Failed to find the product in the repositories. You might need to register the system."); - let issue = Issue::new("missing_registration", &message) - .with_details(&error.to_string()); - issues.product.push(issue); - } else { - let message = gettext("Failed to find the product in the repositories."); - let issue = - Issue::new("missing_product", &message).with_details(&error.to_string()); - issues.software.push(issue); - }; + if state.allow_registration && !self.is_registered() { + let message = gettext("Failed to find the product in the repositories. You might need to register the system."); + let issue = + Issue::new("missing_registration", &message).with_details(&error.to_string()); + issues.product.push(issue); + } else { + let message = gettext("Failed to find the product in the repositories."); + let issue = + Issue::new("missing_product", &message).with_details(&error.to_string()); + issues.software.push(issue); + }; - return Self::send_issues_and_finish(issues, tx, progress); - } + return Self::send_issues_and_finish(issues, tx, progress); } for (name, r#type, selection) in &state.resolvables.to_vec() { @@ -1003,4 +985,25 @@ impl ZyppServer { _ = progress.cast(progress::message::Finish::new(Scope::Software)); Ok(()) } + + // FIXME: hotfix/workaround for bsc#1259311 - check if a *-release package is selected to install + // and if so then do not select the product to install, this should be removed after fixing the solver + fn find_release_package(resolvables: &ResolvablesState) -> Option { + for (name, r#type, selection) in &resolvables.to_vec() { + if r#type == &ResolvableType::Package + && name.ends_with("-release") + // uh, the "lsb-release" package actually does not provide any product... + && name != "lsb-release" + { + match selection { + ResolvableSelection::Selected | ResolvableSelection::AutoSelected { .. } => { + return Some(name.clone()) + } + ResolvableSelection::Removed => {} + } + } + } + + None + } } From 4565cf3dc314ff05003c0776e43a49653438e04d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Imobach=20Gonz=C3=A1lez=20Sosa?= Date: Mon, 9 Mar 2026 13:36:15 +0000 Subject: [PATCH 2/4] Update from code review --- rust/agama-software/src/zypp_server.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/rust/agama-software/src/zypp_server.rs b/rust/agama-software/src/zypp_server.rs index 4da672d259..6ee21f0652 100644 --- a/rust/agama-software/src/zypp_server.rs +++ b/rust/agama-software/src/zypp_server.rs @@ -991,16 +991,12 @@ impl ZyppServer { fn find_release_package(resolvables: &ResolvablesState) -> Option { for (name, r#type, selection) in &resolvables.to_vec() { if r#type == &ResolvableType::Package - && name.ends_with("-release") + && name.ends_with("-release") // uh, the "lsb-release" package actually does not provide any product... && name != "lsb-release" + && selection.selected() { - match selection { - ResolvableSelection::Selected | ResolvableSelection::AutoSelected { .. } => { - return Some(name.clone()) - } - ResolvableSelection::Removed => {} - } + return Some(name.clone()); } } From 20bc4f7736787569ef7de8d32c2061ff2307a9fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Imobach=20Gonz=C3=A1lez=20Sosa?= Date: Mon, 9 Mar 2026 13:37:53 +0000 Subject: [PATCH 3/4] Remove unneeded clone --- rust/agama-software/src/zypp_server.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust/agama-software/src/zypp_server.rs b/rust/agama-software/src/zypp_server.rs index 6ee21f0652..c507167d51 100644 --- a/rust/agama-software/src/zypp_server.rs +++ b/rust/agama-software/src/zypp_server.rs @@ -989,8 +989,8 @@ impl ZyppServer { // FIXME: hotfix/workaround for bsc#1259311 - check if a *-release package is selected to install // and if so then do not select the product to install, this should be removed after fixing the solver fn find_release_package(resolvables: &ResolvablesState) -> Option { - for (name, r#type, selection) in &resolvables.to_vec() { - if r#type == &ResolvableType::Package + for (name, r#type, selection) in resolvables.to_vec() { + if r#type == ResolvableType::Package && name.ends_with("-release") // uh, the "lsb-release" package actually does not provide any product... && name != "lsb-release" From b514cb209e3f0eeffb2393115f4380c6aa5c7974 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Imobach=20Gonz=C3=A1lez=20Sosa?= Date: Mon, 9 Mar 2026 13:46:43 +0000 Subject: [PATCH 4/4] Remove clone --- rust/agama-software/src/zypp_server.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/agama-software/src/zypp_server.rs b/rust/agama-software/src/zypp_server.rs index c507167d51..10c590350b 100644 --- a/rust/agama-software/src/zypp_server.rs +++ b/rust/agama-software/src/zypp_server.rs @@ -996,7 +996,7 @@ impl ZyppServer { && name != "lsb-release" && selection.selected() { - return Some(name.clone()); + return Some(name); } }