Bug#546577: Set DPKG_MAINTSCRIPT_NAME to the script name in maintainer scripts environment

2010-04-16 Thread Guillem Jover
On Mon, 2009-09-14 at 22:34:16 +0200, Sven Joachim wrote:
 On 2009-09-14 10:38 +0200, Raphael Hertzog wrote:
  Package: dpkg
  Version: 1.15.4
  Severity: wishlist
 
  Please export DPKG_MAINTSCRIPT_NAME in the environment of maintainer
  scripts, it should contain the name of the maintainer script (prerm,
  postrm, preinst, postinst, config) that is currently running.

config would not always have it, as dpkg does have any knowledge of
it, and in some cases it would be postinst.

The difference with this variable and the currently exported ones, is
that this one is always passed to the script through argv[0]:

  self=$(basename $0)

and this expression is a constant across all maintainer scripts, in
comparison with the package name which would need to be hardcoded
on each maintainer script, or the architecture which is known only at
built time and would need modifying it then.

I'm not outright opposed to this, though, it just feels wrong somehow
for external programs to change behaviour depending on what maintainer
script called them.

  See #546165 for an example of where it would have been useful.
 
 Another example is the deprecation warning for dpkg's own
 --print-installation-architecture option.  This evening I saw that
 warning several times when I finally upgraded my laptop to X.Org 7.4.

Right, the problem though, is that if the warning gets removed then no
one sees it, and it cannot be fixed in later versions, which kind of
defeats the purpose of the warning.

 Would be nice if this could be suppressed in prerm scripts as well.

Well, I'd rather see the warnings one last time on upgrade, than have
to make dpkg aware of that variable to modify its behaviour when
printing the warning, the same goes for install-info, as people might
forget to remove all insances and they will not warn anymore.

regards,
guillem



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#546577: Set DPKG_MAINTSCRIPT_NAME to the script name in maintainer scripts environment

2010-04-16 Thread Raphael Hertzog
On Fri, 16 Apr 2010, Guillem Jover wrote:
 The difference with this variable and the currently exported ones, is
 that this one is always passed to the script through argv[0]:
 
   self=$(basename $0)

It's not clear to me that this is reliable:
it some cases we would get package.control (when installed in
/var/lib/dpkg/info/) and other case control (when called from
tmp.ci).

It seems also wrong for maintainer scripts to rely on this which exposes
rather internal information. Suppose a script assumes one of both formats
above, it might break when we get arch:package.control just because
we decided to store the files that way for multi-arch (I know we're more
likely to use different directories, but still...).

 n is a constant across all maintainer scripts, in
 comparison with the package name which would need to be hardcoded
 on each maintainer script, or the architecture which is known only at
 built time and would need modifying it then.

If you consider that the maintainer must be the only one to have full
control on what the script does, yes. But it can make sense for the
maintainer to delegate that control by putting some functions which are
more like specialized hooks.

That's the approach I followed for the conffile handling stuff, it gives
more freedom to change the internal implementation and make it do more
without requiring intervention from the maintainer who added that hook
in its maintainer scripts.

Cheers,
-- 
Raphaël Hertzog

Like what I do? Sponsor me: http://ouaza.com/wp/2010/01/05/5-years-of-freexian/
My Debian goals: http://ouaza.com/wp/2010/01/09/debian-related-goals-for-2010/



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#546577: Set DPKG_MAINTSCRIPT_NAME to the script name in maintainer scripts environment

2009-09-14 Thread Raphael Hertzog
Package: dpkg
Version: 1.15.4
Severity: wishlist

Please export DPKG_MAINTSCRIPT_NAME in the environment of maintainer
scripts, it should contain the name of the maintainer script (prerm,
postrm, preinst, postinst, config) that is currently running.

See #546165 for an example of where it would have been useful.

Cheers,
-- 
Raphaël Hertzog



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#546577: Set DPKG_MAINTSCRIPT_NAME to the script name in maintainer scripts environment

2009-09-14 Thread Sven Joachim
On 2009-09-14 10:38 +0200, Raphael Hertzog wrote:

 Package: dpkg
 Version: 1.15.4
 Severity: wishlist

 Please export DPKG_MAINTSCRIPT_NAME in the environment of maintainer
 scripts, it should contain the name of the maintainer script (prerm,
 postrm, preinst, postinst, config) that is currently running.

 See #546165 for an example of where it would have been useful.

Another example is the deprecation warning for dpkg's own
--print-installation-architecture option.  This evening I saw that
warning several times when I finally upgraded my laptop to X.Org 7.4.
Would be nice if this could be suppressed in prerm scripts as well.

Cheers,
   Sven



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org