Packaging and Delivering Software With the Image Packaging System in Oracle® Solaris 11.2

Exit Print View

Updated: July 2014
 
 

Specifying Mediated Links

The following command shows the currently selected preferred implementations of Python, Ruby, and Secure Shell:

$ pkg mediator python ruby ssh
MEDIATOR    VER. SRC. VERSION IMPL. SRC. IMPLEMENTATION
python      vendor    2.6     vendor
ruby        system    1.9     system
ssh         vendor            vendor     sunssh

The following command shows all participants in each of these mediations:

$ pkg mediator -a python ruby ssh
MEDIATOR    VER. SRC. VERSION IMPL. SRC. IMPLEMENTATION
python      vendor    2.6     vendor
python      system    2.7     system
ruby        system    1.9     system
ruby        system    1.8     system
ssh         vendor            vendor     sunssh

The lower version was selected by the system as the preferred Python implementation because it has a mediator-priority specified, as shown by the VER. SRC. and IMPL. SRC. and by the following command:

$ pkg contents -Ho action.raw -t link -a path=usr/bin/python 'runtime/python*'
link mediator=python mediator-version=2.7 path=usr/bin/python pkg.linted.pkglint
.dupaction010.2=true target=python2.7
link mediator=python mediator-priority=vendor mediator-version=2.6 path=usr/bin/
python target=python2.6

If you specify mediator=python as the argument to the -a option, the output shows many more links in the python mediation. Remember to include all necessary paths in the mediation.

$ pkg contents -Ho action.raw -t link -a mediator=python runtime/python-26
link mediator=python mediator-priority=vendor mediator-version=2.6 path=usr/bin/
2to3 target=2to3-2.6
link mediator=python mediator-priority=vendor mediator-version=2.6 path=usr/bin/
python target=python2.6
link mediator=python mediator-priority=vendor mediator-version=2.6 path=usr/bin/
pydoc target=pydoc-2.6
link mediator=python mediator-priority=vendor mediator-version=2.6 path=usr/bin/
idle target=idle-2.6
link mediator=python mediator-priority=vendor mediator-version=2.6 path=usr/bin/
python-config target=python2.6-config
link mediator=python mediator-priority=vendor mediator-version=2.6 path=usr/bin/
amd64/python target=python2.6 variant.arch=i386
link mediator=python mediator-priority=vendor mediator-version=2.6 path=usr/bin/
amd64/python-config target=python2.6-config variant.arch=i386
link facet.doc.man=all mediator=python mediator-priority=vendor mediator-version
=2.6 path=usr/share/man/man1/python.1 target=python2.6.1

The pkg.linted.pkglint.dupaction010.2=true attribute in the usr/bin/python mediated link in the runtime/python-27 package indicates that the /usr/bin/python link is delivered by more than one package and is a valid mediated link. Mediated links are an exception to the rule that an action can be delivered by only one package. The pkglint utility checks for duplicate actions. Setting pkg.linted.check.id to true bypasses checks for check.id for that action. See Verify the Package and the pkglint (1) man page. Use the pkglint -L command to show the full list of checks that pkglint performs. The description of the pkglint.dupaction010 check is “Mediated links should be valid.”

The higher version was selected by the system as the preferred Ruby implementation.

$ pkg contents -Ho action.raw -t link -a path=usr/bin/ruby runtime/ruby-19
link mediator=ruby mediator-version=1.9 path=usr/bin/ruby pkg.linted.pkglint.dup
action010.2=true target=./ruby19

The ssh mediation has only one participant. If you anticipate delivering additional implementations of an application, define the mediation in the original package so that the original package will be a participant in the mediation when other implementations are delivered. Otherwise, you will need to deliver an update to the original package, or users will not be able to select the original implementation as the preferred implementation.

In addition to showing the link action, the following command shows the name of the package where this action is defined.

$ pkg contents -o pkg.name,action.raw -t link -a path=usr/bin/ssh '*'
PKG.NAME    ACTION.RAW
network/ssh link mediator=ssh mediator-implementation=sunssh mediator-priority=
vendor path=usr/bin/ssh target=../lib/sunssh/bin/ssh

A mediated link that specifies a mediator-implementation can also specify a mediator-version, a mediator-priority, or both. If all participants in the mediation specify only a mediator-implementation, the system selects the preferred implementation arbitrarily. If the selected mediator-implementation is versioned, the highest version is selected, as shown by the following commands:

$ pkg mediator -a myapp
MEDIATOR    VER. SRC. VERSION IMPL. SRC. IMPLEMENTATION
myapp       system            system     db@12
myapp       system            system     db@11
myapp       system            system     db
$ pkg mediator myapp
MEDIATOR    VER. SRC. VERSION IMPL. SRC. IMPLEMENTATION
myapp       system            system     db@12

If another implementation is added to the mediation, that implementation might be selected by the system, as shown by the following commands:

$ pkg mediator -a myapp
MEDIATOR    VER. SRC. VERSION IMPL. SRC. IMPLEMENTATION
myapp       system            system     aa
myapp       system            system     db@12
myapp       system            system     db@11
myapp       system            system     db
$ pkg mediator myapp
MEDIATOR    VER. SRC. VERSION IMPL. SRC. IMPLEMENTATION
myapp       system            system     aa