[pacman-dev] Alternatives system

Duncan Overbruck mail at duncano.de
Mon Apr 8 21:20:45 UTC 2019


allan at archlinux.org (Allan McRae) wrote:
> On 1/4/19 2:12 pm, Andrew Gregory wrote:
> >  On 04/01/19 at 09:56am, Allan McRae wrote:
> > > Hi all,
> > >
> > > I plan to finish implementing an alternatives system for pacman post 5.2
> > > release:
> > > https://wiki.archlinux.org/index.php/User:Allan/Alternatives
> > >
> > > Any comments or suggestions?
> > "All alternatives are symlinked in /usr/bin so no need to specify the
> > full path."
> > Why?  Arch puts all executables in /usr/bin but other users may not.
> Make the path configurable, if anyone ever asks for that.  Or if they
> want a range of locations, extend it to allow optional full paths.  And
> this will have some configurability with the --prefix or --bindir
> configuration options (at least in autotools).

xbps has alternatives which are very similar, but not limited to binaries,
alternatives can be used for any path and even directories.
The most common use case is binaries and their man pages.

The alternatives are structured in groups, `sh` is a group and each
package providing the alternative group can have one or more symlinks
for a given group.

$ xbps-alternatives -l -g sh
sh
 - dash (current)
  - sh:/usr/bin/dash
  - sh.1:/usr/share/man/man1/dash.1
 - mksh
  - sh:/usr/bin/mksh
  - sh.1:/usr/share/man/man1/mksh.1
 - bash
  - sh:/usr/bin/bash
  - sh.1:/usr/share/man/man1/bash.1
 - busybox
  - sh:/usr/bin/busybox
 - yash
  - sh:/usr/bin/yash
  - sh.1:/usr/share/man/man1/yash.1
 - loksh
  - sh:/usr/bin/loksh
  - sh.1:/usr/share/man/man1/loksh-sh.1

If the target is relative or a filename they are created inside the targets
directory.

$ xbps-alternatives -l -g lua
lua
 - lua (current)
  - lua:/usr/bin/lua5.3
  - luac:/usr/bin/luac5.3
  - lua.1:/usr/share/man/man1/lua5.3.1
  - luac.1:/usr/share/man/man1/luac5.3.1
  - lua:/usr/include/lua5.3
  - /usr/include/lua.h:/usr/include/lua5.3/lua.h
  - /usr/include/luaconf.h:/usr/include/lua5.3/luaconf.h
  - /usr/include/lua.hpp:/usr/include/lua5.3/lua.hpp
  - /usr/include/lualib.h:/usr/include/lua5.3/lualib.h
  - /usr/include/lauxlib.h:/usr/include/lua5.3/lauxlib.h
  - lua.pc:/usr/lib/pkgconfig/lua5.3.pc
  - liblua.a:/usr/lib/liblua5.3.a
  - liblua.so:/usr/lib/liblua5.3.so
  - lua:/usr/share/doc/lua5.3
 - lua52
  - lua:/usr/bin/lua5.2
  - luac:/usr/bin/luac5.2
  - lua.1:/usr/share/man/man1/lua5.2.1
  - luac.1:/usr/share/man/man1/luac5.2.1
  - lua:/usr/include/lua5.2
  - /usr/include/lua.h:/usr/include/lua5.2/lua.h
  - /usr/include/luaconf.h:/usr/include/lua5.2/luaconf.h
  - /usr/include/lua.hpp:/usr/include/lua5.2/lua.hpp
  - /usr/include/lualib.h:/usr/include/lua5.2/lualib.h
  - /usr/include/lauxlib.h:/usr/include/lua5.2/lauxlib.h
  - lua.pc:/usr/lib/pkgconfig/lua5.2.pc
  - liblua.a:/usr/lib/liblua5.2.a
  - liblua.so:/usr/lib/liblua5.2.so
  - lua:/usr/share/doc/lua5.2
 - lua51
  - lua:/usr/bin/lua5.1
  - luac:/usr/bin/luac5.1
  - lua.1:/usr/share/man/man1/lua5.1.1
  - luac.1:/usr/share/man/man1/luac5.1.1
  - lua:/usr/include/lua5.1
  - /usr/include/lua.h:/usr/include/lua5.1/lua.h
  - /usr/include/luaconf.h:/usr/include/lua5.1/luaconf.h
  - /usr/include/lua.hpp:/usr/include/lua5.1/lua.hpp
  - /usr/include/lualib.h:/usr/include/lua5.1/lualib.h
  - /usr/include/lauxlib.h:/usr/include/lua5.1/lauxlib.h
  - lua.pc:/usr/lib/pkgconfig/lua5.1.pc
  - liblua.a:/usr/lib/liblua5.1.a
  - liblua.so:/usr/lib/liblua5.1.so
  - lua:/usr/share/doc/lua5.1

Greetings,
Duncan Overbruck


More information about the pacman-dev mailing list