diff --git a/package/yast2-pkg-bindings-devel-doc.spec b/package/yast2-pkg-bindings-devel-doc.spec index f16fe25..d5f006c 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 b59df8c..b29e10e 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 a950da6..97f6a6f 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 182c646..8ef4ef9 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)