Mailinglist Archive: opensuse-factory (282 mails)

< Previous Next >
Re: [opensuse-factory] C implementation of update-alternatives
  • From: Michal Vyskocil <mvyskocil@xxxxxxx>
  • Date: Fri, 22 Oct 2010 15:26:27 +0200
  • Message-id: <201010221526.27286.mvyskocil@xxxxxxx>
On Friday 22 of October 2010 15:10:45 Josef Reidinger wrote:
Michal Vyskocil write:
Hi all,

I noticed Debian folks reimplemented the old good update-alternatives
command from Perl to C. That means your-favourite-program (like awk or
vim) will no longer depends on Perl in openSUSE.

I think it is useless as perl is required part of opensuse. Kernel depends
on kernel :)

This is not a plan to remove Perl from SUSE - just following upstream. But
it's nice the C implementation removed an unecessary and maybe surprising
dependency of some packages on Perl.

and for handling such configuration I think is perl good

Maybe SUSE hackers are the last who thinks that ;-). For example the original
update-alternatives has been rewritten three times (afaics)

- chkconfig in RedHat has C program called alternatives
- is ispired and written in shell/awk by ALT Linux
- Debian switched to C based implementation recently

Michal Vyskocil

Good think is - new implementation is backward compatible, so no changes
in %scripts are required, no reinstallation and so. And what is better,
the simple %post update-alternatives --install %preun
update-alternatives --remove calls would work without a problem, which
is the most common use-case.

I found only two notable differences:

1.) more verbose by default - considering to change it, as all things are
already logged to /var/log/alternatives.log
zypper remove java-1_6_0-openjdk
Removing java-1_6_0-openjdk- [done]
Additional rpm output:
update-alternatives: warning: alternative /usr/lib64/jvm/jre-1.6.0-
openjdk/bin/java (part of link group java) doesn't exist. Removing from
list of alternatives.
update-alternatives: warning: alternative
/usr/lib64/jvm/jre-1.6.0-openjdk (part of link group jre_openjdk)
doesn't exist. Removing from list of alternatives.
... and much more

2.) Don't allow the same slave alternative in more than one - bnc#648260
- even if it's a bug in openjdk packaging

I prepared package is in OBS - home:mvyskocil:update-alternatives/update-
alternatives [1]. Please test (at least) your package with newest update-
alternatives and bug me in case of troubles, thanks.


Following list shows which packages use update-alternatives in some of

* gawk

* gobby
* gobby04
* mozilla-xulrunner192 (pcerny?)
* ntfs-3g
* PackageKit-gstreamer-plugin
* rarian
* rarian-scrollkeeper-compat
* scrollkeeper
* vala

* firebird-classic
* firebird-superserver

* gvim
* vim

* ksh
* pdksh

* lftp
* lukemftp

* lua
* lua50
* mawk

* rubygem-rails-2_3

Thanks for your help
Michal Vyskocil
< Previous Next >