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

Re: Bash-completion with triggers

On Thu, 07 Apr 2011, David Paleino wrote:
> "Only" those installing executables in these directories:

I know, I do not have stats but I expect this to be a very important
percentage of packages.

> Unfortunately, I have to remove and re-create all the symlinks upon trigger
> activation: in fact, only the directory name is being passed (/usr/bin); if
> my postinst had passed the file name activating the trigger (/usr/bin/foo); it
> would really be much faster.

I know the limitations of triggers. :-)

Still, you can do better than recreating everything each time. Like
scanning the non-installed completion files, extract some metadata
listing which program's completion this file provide, and verify if
you can find the binary before deciding to install it.

Removing completion for uninstalled packages is not important to have in
real-time, you can do it in a weekly cron or something like this.

> > If file triggers could also specify the --no-await option that
> > dpkg-triggers supports, things might be different.
> That would be great; ideas how to do it?

Extend the syntax of the triggers file and patch dpkg to support it.

> > But in the current state, I think it's a bad idea to use file triggers
> > in your case.
> A named trigger isn't better in any case, I believe.

Indeed, they are of no use.

> > You'd better use some apt hook to do the task you envision. A file
> > trigger that is activated for a majority of package installation is
> > probably better dealt with such a solution.
> Which hook would you suggest?
> Reading apt.conf(5), I find: Dpkg::Pre-Invoke, Dpkg::Post-Invoke and
> Dpkg::Pre-Install-Pkgs. I think the first two are run at each unpacking (thus
> are unsuitable to me, it would be much slower than now), and the latter is
> _before_ installing packages.
> Why there's no Dpkg::Post-Install-Pkgs? :)

Pre/Post-Invoke are called (as their name suggest it) before and after
dpkg has been called no matter the operation requested (unpack,

I was indeed thinking there was some sort of hook that would run after apt
had completed its work but it's not the case (you could still ask APT
developers if they can do it).

Still I think using Dpkg::Post-Invoke with an update-bash-completion
program intelligent enough to not do useless work is preferable over
using a file trigger given the current limitations of triggers.

File triggers are useful to replace calls to update-foo in postinst
but in your case the data is already centralized in a package and you
have the somewhat oppposite problem of knowing which of those files are

Raphaël Hertzog ◈ Debian Developer

Follow my Debian News ▶ http://RaphaelHertzog.com (English)
                      ▶ http://RaphaelHertzog.fr (Français)

Reply to: