Skip to content

Commit

Permalink
dnf5daemon: The buildtime attribute has been added to the package_att…
Browse files Browse the repository at this point in the history
…rs option
  • Loading branch information
Dmitry Safonov authored and m-blaha committed May 28, 2024
1 parent 679ef5d commit 12643ad
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
Following options and filters are supported:
- package_attrs: list of strings
list of package attributes that are returned. Supported attributes are name, epoch, version, release, arch, repo_id, from_repo_id, is_installed, install_size, download_size, sourcerpm, summary, url, license, description, files, changelogs, provides, requires, requires_pre, conflicts, obsoletes, recommends, suggests, enhances, supplements, evr, nevra, full_nevra, reason, vendor, group.
list of package attributes that are returned. Supported attributes are name, epoch, version, release, arch, repo_id, from_repo_id, is_installed, install_size, download_size, buildtime, sourcerpm, summary, url, license, description, files, changelogs, provides, requires, requires_pre, conflicts, obsoletes, recommends, suggests, enhances, supplements, evr, nevra, full_nevra, reason, vendor, group.
- with_nevra: bool (default true)
match patterns against available packages NEVRAs
- with_provides: bool (default true)
Expand Down
8 changes: 8 additions & 0 deletions dnf5daemon-server/package.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const std::map<std::string, PackageAttribute> package_attributes{
{"is_installed", PackageAttribute::is_installed},
{"install_size", PackageAttribute::install_size},
{"download_size", PackageAttribute::download_size},
{"buildtime", PackageAttribute::buildtime},
{"sourcerpm", PackageAttribute::sourcerpm},
{"summary", PackageAttribute::summary},
{"url", PackageAttribute::url},
Expand Down Expand Up @@ -119,6 +120,9 @@ dnfdaemon::KeyValueMap package_to_map(
case PackageAttribute::download_size:
dbus_package.emplace(attr, static_cast<uint64_t>(libdnf_package.get_download_size()));
break;
case PackageAttribute::buildtime:
dbus_package.emplace(attr, static_cast<uint64_t>(libdnf_package.get_build_time()));
break;
case PackageAttribute::sourcerpm:
dbus_package.emplace(attr, libdnf_package.get_sourcerpm());
break;
Expand Down Expand Up @@ -254,6 +258,10 @@ std::string package_to_json(const libdnf5::rpm::Package & libdnf_package, const
json_object_object_add(
json_pkg, cattr, json_object_new_int64(static_cast<int64_t>(libdnf_package.get_download_size())));
break;
case PackageAttribute::buildtime:
json_object_object_add(
json_pkg, cattr, json_object_new_int64(static_cast<int64_t>(libdnf_package.get_build_time())));
break;
case PackageAttribute::sourcerpm:
json_object_object_add(json_pkg, cattr, json_object_new_string(libdnf_package.get_sourcerpm().c_str()));
break;
Expand Down
1 change: 1 addition & 0 deletions dnf5daemon-server/package.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ enum class PackageAttribute {
is_installed,
install_size,
download_size,
buildtime,
sourcerpm,
summary,
url,
Expand Down
1 change: 1 addition & 0 deletions doc/dnf_daemon/examples/rpm_list_fd.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ def repoquery(iface_rpm, options):
"is_installed",
"install_size",
"download_size",
"buildtime",
"sourcerpm",
"summary",
"url",
Expand Down

0 comments on commit 12643ad

Please sign in to comment.