Skip to content

Commit

Permalink
Pkg.TargetInitializeOptions() - added option for rebuilding DB (bsc#1…
Browse files Browse the repository at this point in the history
…209565)

- added a new option for rebuilding the RPM database (--rebuilddb)
- 4.4.6

* Code review fixes
  • Loading branch information
lslezak committed Apr 13, 2023
1 parent a17b494 commit a8a654b
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 a8a654b

Please sign in to comment.