Skip to content

Instantly share code, notes, and snippets.

@alunux
Last active June 9, 2016 20:17
Show Gist options
  • Save alunux/5d9d8185d941810f4a9cd1c224927121 to your computer and use it in GitHub Desktop.
Save alunux/5d9d8185d941810f4a9cd1c224927121 to your computer and use it in GitHub Desktop.
import dnf
if __name__ == '__main__':
with dnf.Base() as base:
base.fill_sack()
q = base.sack.query()
i = q.installed()
pkg32 = pkgnoarch = pkg64 = 0
for pkg in i:
if pkg.arch == 'x86_64':
pkg64 += 1
elif pkg.arch == 'i686':
pkg32 += 1
elif pkg.arch == 'noarch':
pkgnoarch += 1
totalpkg = pkg32 + pkg64 + pkgnoarch
print("Total paket i686 yang terinstal = %s paket" % (pkg32))
print("Total paket x86_64 yang terinstal = %s paket" % (pkg64))
print("Total paket noarch yang terinstal = %s paket" % (pkgnoarch))
print("Total paket yang terinstal = %s paket" % (totalpkg))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment