Re: On robustness of maintainer scripts
* Piotr Ożarowski <piotr@debian.org>, 2013-05-11, 00:29:
postinst
========
[...]
Proposed solution:
1) Wait until #671711 is fixed.
3) Make pycompile a shell script that does only two simple things:
- write options it was called with to a file, say,
/var/lib/python/pyX.Ycompile.todo;
- use dpkg-trigger to trigger pythonX.Y.
why not generate maintainer scripts without pycompile at all?
- There are hundreds of packages that use py{compile,clean} in the
maintainer script. The script needs to continue to exist at least until
jessie is released.
- Fixing the problem in py{compile,clean} means that even the packages
that haven't been rebuilt can benefit from the fix.
- If you take all corner cases into cosideration, the required gets
pretty complicated. IMO too complicated to risk putting the code
directly into maintainer scripts.
I wanted to delegate as much as possible to interpreter packages, but
your idea with temp. files is even better - maintainer scripts can
look like this:
| touch /usr/lib/pythonX.Y/dist-packages/namespace/__init__.py¹
| touch /usr/lib/pythonX.Z/dist-packages/namespace/__init__.py¹
| dpkg -L <package> | grep \.py$ | while read file
| do
| echo "${file}" >> /var/lib/python/pyX.Ycompile.todo
| echo "${file}" >> /var/lib/python/pyX.Zcompile.todo
| done
Here you need to check with versions are supported, and which of them
are installed^Wunpacked.
Oh, and the call to dpkg-trigger is missing. /o\
[¹] namespace has to be created here as other packages might want to
use given library in maintainer scipts, even without .pyc files
ACK
("test -f ... ||" is probably missing here)
Yes, it is missing. :)
prerm
=====
[...]
Proposed solution:
Get rid of /usr/bin/pyclean, so that the fallback code is activated.
\o/ Just kidding. :) Not only that would almost certainly have
unintended consequences, but also the fallback code doesn't look
complete: it doesn't take care of namespaces.
Actual proposed solution:
Rewrite /usr/bin/pyclean in shell.
again, removing /usr/bin/pyclean is not that bad idea. I like it and
will try to provide example scripts for interpreter packages (and then
generate prerm like in postinst example)
You need to remove namespaces, remove files from *.todo...
I wouldn't dare to put it directly to prerm.
--
Jakub Wilk
Reply to: