Hi!
On Thu, 2012-07-12 at 19:48:50 +0200, Matthias Klose wrote:
> Package: dpkg
> Version: 1.16.7
> Severity: normal
> For a Multi-Arch same package, which contains .py files which are
> byte-compiled
> in the postinst, and the byte code is removed in the preinst, it is necessary
> to
> know how many "copies" of the package are installed, so that the byte code is
> only compiled after the first package is installed, and only removed if the
> last
> package is removed. This can be done using
(As I've mentioned on debian-devel, I don't think a fully multiarch
enabled python is currently a good idea, but that's besides this bug
report.)
> if [ $(dpkg-query -W '<pkg>:*' 2>/dev/null | wc -l) -le 1 ]; then
> ... byte code compilation
> fi
>
> if [ $(dpkg-query -W '<pkg>:*' 2>/dev/null | wc -l) -le 1 ]; then
> ... byte code removal
> fi
This is not right, and will not take into account dpkg selections.
A correct way to currently compute the present instances could be:
dpkg-query -f '${db:Status-Abbrev} ${binary:Package}\n' -W pkgname | \
grep -v '^.n' | wc -l
> It would be better to have this package reference count availabe in the
> environment when running the maintainer scripts.
Yes, this seems like a good idea, I'll queue a patch for 1.17.x.
Thanks,
Guillem
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]