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

Service registration



Rob Browning <rlb@cs.utexas.edu> writes:

> I think that we should have some sort of install procedure (a la
> install-info) for emacs .el files.

We keep going down this route again and again - info, elisp, menu,
mime.  Maybe we should generalize this?

Let's provide a system where packages could register themselves as
clients of a service. Other programs could register themselves as
providers of a service.  They would provide hook scipts which would
get run for each client in the service.  The system could also provide
mechanisms to help the servers - for example "Give me a list of all
the foo arguments in the bar service.

For elisp files, it might work like this.

$ register-service --help
register-service --install service package [param=value ...]
register-service --remove service package

In the dpkg postinst:
  register-service --install elisp dpkg file=/usr/lib/dpkg/dpkg-dev.el
In the dpkg prerm:
  register-service --remove elisp dpkg

$ provide-service --help
provide-service --install-hook service package hookfile
provide-service --remove-hook service package
provide-service --list-clients service
...

In the emacs postinst:
  provide-service --install-hook elisp emacs /usr/lib/emacs/install-hook

/usr/lib/emacs/install-hook can then simply build up a list in
/etc/emacs.el of all the files that need to run.  Easy enough with
perl.
  
When a provider first installed a hook, the system would immediately
run the hookfile for all clients that already registered.  Then
whenever a new client registered, it would run the hookfile.  The
hookfile would be run with the same arguments that the client
registered with.  Any arbitrary information can be stored in the
service registry.

There could be simpler interfaces to this registry for packages which
don't want to bother with storing information themselves - things like
--list-clients.

This system isn't very hard to implement.  Much of the code can
probably be ripped out of menu.  I think it would solve lots of cases.

Comments?


Guy


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: