Replies: 1 comment
-
You can use the #include <iostream>
#include <libdnf5/base/base.hpp>
#include <libdnf5/rpm/package_query.hpp>
int main() {
libdnf5::Base base;
base.get_config().get_cacheonly_option().set("metadata");
base.setup();
auto repo_sack = base.get_repo_sack();
repo_sack->create_repos_from_system_configuration();
repo_sack->update_and_load_enabled_repos(true);
libdnf5::rpm::PackageQuery query(base);
query.filter_name({"htop"});
for (const auto & pkg : query) {
std::cout << pkg.get_nevra() << std::endl;
}
}
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Can i load all enabled repos without internet network with c++ and libdnf5 library?
I already tried to do so:
auto base = new libdnf5::base::Base(); base->load_config_from_file(); base->setup(); base->create_repos_from_system_configuration(); base->repo_sack->update_and_load_enabled_repos(true);
But it's takes a lot of time.
It seems that using the cache, created with
dnf makecache
would speed up the procedure considerably.Thanks.
Beta Was this translation helpful? Give feedback.
All reactions