On 21/09/17 05:03 AM, Julian Andres Klode wrote:
On Mi., 20. Sep. 2017, 23:03 Jack Bates <2g567n@nottheoilrig.com <mailto:2g567n@nottheoilrig.com>> wrote: Where does the StateCache::Delete() i.e. StateCache::Mode data get read from? I'm trying to debug a problem with the Python marked_delete property -- I expect it to be True after "apt-mark remove", but if I run: Selections are ignored by apt, except for dselect-upgrade. Markings in the depcache are a runtime only state.
Ahh -- thank you for clarifying.What's the *right* way to get the persistent value? The first thing that comes to mind is grepping /var/lib/dpkg/status directly:
filename = '/var/lib/dpkg/status' contents = open(filename).read() contents = contents.rstrip() entries = contents.split('\n\n') status = dict( zip((next(line[len('Package: '):] for line in entry.splitlines() if line.startswith('Package: ')) for entry in entries), (next( line[len('Status: '):] for line in entry.splitlines() if line.startswith('Status: ')) for entry in entries)))