Bug#775854: glib2.0: Useless removal and regeneration of cached data

Guillem Jover guillem at debian.org
Tue Jan 20 17:38:05 UTC 2015

Package: glib2.0
Version: 2.42.1-1
Severity: normal


The libglib2.0-0 postrm script states that because the caches are not
refcounted there's no way to know if they are needed or not on purge.

But in fact it is possible to know easily from the environment variable
DPKG_MAINTSCRIPT_PACKAGE_REFCOUNT, set by dpkg since 1.17.2. You just
need to check if the value is 1.

If you want to support older dpkg versions you can use the following in
case the above variable is not set:

dpkg-query -f '${db:Status-Abbrev} ${binary:Package}\n' -W @pkgname@ | \
  grep -v '^.n' | wc -l

Where @pkgname@ is the non-arch-qualified package name.


More information about the pkg-gnome-maintainers mailing list