Skip to content

Commit

Permalink
Merge pull request #175 from yast/bsc1209565_sp4
Browse files Browse the repository at this point in the history
[SLE15-SP4] Pkg.TargetInitializeOptions() - added option for rebuilding the RPM DB
  • Loading branch information
lslezak committed May 31, 2023
2 parents a17b494 + a8a654b commit 3c66b2d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package/yast2-pkg-bindings-devel-doc.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions package/yast2-pkg-bindings.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Apr 13 08:15:43 UTC 2023 - Ladislav Slezák <[email protected]>

- 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 <[email protected]>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-pkg-bindings.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 14 additions & 2 deletions src/Target_Load.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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": <string> - override the target distribution autodetection,
* example values: "sle-11-x86_84", "sle-12-x86_84"
* "rebuild_db": <boolean> - rebuild the RPM DB if set to `true`
* @return boolean
*/
YCPValue
Expand All @@ -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)
Expand Down

0 comments on commit 3c66b2d

Please sign in to comment.