Last active
December 31, 2021 13:56
-
-
Save vasi/7d94f00ed674b307b0d86afeab17298f to your computer and use it in GitHub Desktop.
Show installation reason for each dnf package
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import dnf | |
import libdnf | |
base = dnf.Base() | |
base.fill_sack() | |
for pkg in base.sack.query().installed(): | |
reason_enum = base.history.swdb.resolveRPMTransactionItemReason(pkg.name, pkg.arch, 0) | |
reason = libdnf.transaction.TransactionItemReasonToString(reason_enum) | |
print(f"{pkg.name} {pkg.arch} {reason}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment