From a8a654b1aa8619d124ad67142c871e500d088aa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Wed, 12 Apr 2023 16:25:21 +0200 Subject: [PATCH] Pkg.TargetInitializeOptions() - added option for rebuilding DB (bsc#1209565) - added a new option for rebuilding the RPM database (--rebuilddb) - 4.4.6 * Code review fixes --- package/yast2-pkg-bindings-devel-doc.spec | 2 +- package/yast2-pkg-bindings.changes | 7 +++++++ package/yast2-pkg-bindings.spec | 2 +- src/Target_Load.cc | 16 ++++++++++++++-- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/package/yast2-pkg-bindings-devel-doc.spec b/package/yast2-pkg-bindings-devel-doc.spec index f16fe252..d5f006cf 100644 --- a/package/yast2-pkg-bindings-devel-doc.spec +++ b/package/yast2-pkg-bindings-devel-doc.spec @@ -17,7 +17,7 @@ Name: yast2-pkg-bindings-devel-doc -Version: 4.4.5 +Version: 4.4.6 Release: 0 Summary: YaST2 - Documentation for yast2-pkg-bindings package License: GPL-2.0-only diff --git a/package/yast2-pkg-bindings.changes b/package/yast2-pkg-bindings.changes index b59df8cc..b29e10e8 100644 --- a/package/yast2-pkg-bindings.changes +++ b/package/yast2-pkg-bindings.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Apr 13 08:15:43 UTC 2023 - Ladislav Slezák + +- Pkg.TargetInitializeOptions() - added a new option for + rebuilding the RPM database (--rebuilddb) (bsc#1209565) +- 4.4.6 + ------------------------------------------------------------------- Mon Nov 14 17:41:14 UTC 2022 - Ladislav Slezák diff --git a/package/yast2-pkg-bindings.spec b/package/yast2-pkg-bindings.spec index a950da66..97f6a6f4 100644 --- a/package/yast2-pkg-bindings.spec +++ b/package/yast2-pkg-bindings.spec @@ -17,7 +17,7 @@ Name: yast2-pkg-bindings -Version: 4.4.5 +Version: 4.4.6 Release: 0 Summary: YaST2 - Package Manager Access License: GPL-2.0-only diff --git a/src/Target_Load.cc b/src/Target_Load.cc index 182c6463..8ef4ef97 100644 --- a/src/Target_Load.cc +++ b/src/Target_Load.cc @@ -143,9 +143,10 @@ PkgFunctions::TargetInitialize (const YCPString& root) * @short Initialize Target, read the keys, set the repomanager options * @param string root Root Directory * @param map options for RepoManager - * supproted keys: + * supported keys: * "target_distro": - override the target distribution autodetection, * example values: "sle-11-x86_84", "sle-12-x86_84" + * "rebuild_db": - rebuild the RPM DB if set to `true` * @return boolean */ YCPValue @@ -155,7 +156,18 @@ PkgFunctions::TargetInitializeOptions (const YCPString& root, const YCPMap& opti try { - zypp_ptr()->initializeTarget(r); + // do not rebuild the RPM DB by default + bool rebuild_db = false; + + const YCPString rebuild_db_key("rebuild_db"); + YCPValue rebuild_db_value = options->value(rebuild_db_key); + if (!rebuild_db_value.isNull() && rebuild_db_value->isBoolean()) + { + rebuild_db = rebuild_db_value->asBoolean()->value(); + y2milestone("RPM DB rebuild is %s", rebuild_db ? "enabled" : "disabled"); + } + + zypp_ptr()->initializeTarget(r, rebuild_db); SetTarget(r, options); } catch (zypp::Exception & excpt)