rpm-ostree/tests/manual/test-dbquery.py
Jonathan Lebon 206ae24d4e tests: Bump to Python 3 only
This bumps the requirement on the controlling host to Python 3 only.
It also bumps the requirement on the target host to Python 3 as well
since FCOS doesn't ship Python 2 right now.

Though we'll need to eventually drop all Python usage anyway, but at
least let's get tests passing on FCOS first. (See related previous
patch).

Closes: #1828
Approved by: cgwalters
2019-05-08 19:02:32 +00:00

23 lines
565 B
Python

#!/usr/bin/env python3
import sys
from gi.repository import Gio, OSTree, RpmOstree
repopath, ref = sys.argv[1:3]
r = OSTree.Repo.new(Gio.File.new_for_path(repopath))
r.open(None)
qr = RpmOstree.db_query_all(r, ref, None)
print "Package list: "
for p in qr:
print p.get_nevra()
_,removed,added,modold,modnew = RpmOstree.db_diff(r, ref + '^', ref, None)
for p in removed:
print "D " + p.get_nevra()
for p in added:
print "A " + p.get_nevra()
for o,n in zip(modold, modnew):
print "M {0} {1} -> {2}".format(o.get_name(), o.get_evr(), n.get_evr())