[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: On robustness of maintainer scripts



[Jakub Wilk, 2013-05-10]
> 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?
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

[¹] namespace has to be created here as other packages might want to use
    given library in maintainer scipts, even without .pyc files
    ("test -f ... ||" is probably missing here)

(with some extra code to handle private directories, including
rt* scripts, or any other logic from pycompile script, probably without
exclude patterns or other features that are not really used)

> 2) Add code to pythonX.Y's postinst that'll process stuff from
> /var/lib/python/pyX.Ycompile.todo. Note that you don't need to move
> any complicated logic to the interpreter packages. All that the
> postinst would have to do is to call some script shipped in
> python-minimal.
> 
> 
> 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)
-- 
Piotr Ożarowski                         Debian GNU/Linux Developer
www.ozarowski.pl          www.griffith.cc           www.debian.org
GPG Fingerprint: 1D2F A898 58DA AF62 1786 2DF7 AEF6 F1A2 A745 7645


Reply to: