#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
from . import testutils
if __name__ == "__main__":
import pkg5unittest
import os
import shutil
import six
import stat
import tempfile
import unittest
# Don't discard repository or setUp() every test.
pkg_sendmail = """
add set name=pkg.summary value="Example sendmail package"
add link path=/usr/sbin/newaliases target=../lib/sendmail
close
add set name=pkg.summary value="Example sendmail package"
add link path=/usr/bin/mailq target=../lib/sendmail-mta/mailq mediator=mta mediator-implementation=sendmail
add link path=/usr/lib/sendmail target=../lib/sendmail-mta/sendmail mediator=mta mediator-implementation=sendmail
add link path=/usr/sbin/newaliases target=../lib/sendmail-mta/sendmail mediator=mta mediator-implementation=sendmail
add link path=/usr/sbin/sendmail target=../lib/sendmail-mta/sendmail mediator=mta mediator-implementation=sendmail
close
add set name=pkg.summary value="Example sendmail vendor-priority package"
add link path=/usr/bin/mailq target=../lib/sendmail-mta/mailq mediator=mta mediator-implementation=sendmail mediator-priority=vendor
add link path=/usr/lib/sendmail target=../lib/sendmail-mta/sendmail mediator=mta mediator-implementation=sendmail mediator-priority=vendor
add link path=/usr/sbin/newaliases target=../lib/sendmail-mta/sendmail mediator=mta mediator-implementation=sendmail mediator-priority=vendor
add link path=/usr/sbin/sendmail target=../lib/sendmail-mta/sendmail mediator=mta mediator-implementation=sendmail mediator-priority=vendor
close
add set name=pkg.summary value="Example sendmail target change package"
add link path=/usr/bin/mailq target=../lib/sendmail3-mta/mailq3 mediator=mta mediator-implementation=sendmail
add link path=/usr/lib/sendmail target=../lib/sendmail3-mta/sendmail mediator=mta mediator-implementation=sendmail
add link path=/usr/sbin/newaliases target=../lib/sendmail3-mta/sendmail mediator=mta mediator-implementation=sendmail
add link path=/usr/sbin/sendmail target=../lib/sendmail3-mta/sendmail mediator=mta mediator-implementation=sendmail
close """
pkg_sendmail_links = """
open pkg://test/sendmail-links@1.0
add set name=pkg.summary value="Example sendmail package for verifying symlink refcounts behaviour"
add link path=/usr/bin/mailq target=../lib/sendmail-mta/mailq mediator=mta mediator-implementation=sendmail
add link path=/usr/lib/sendmail target=../lib/sendmail-mta/sendmail mediator=mta mediator-implementation=sendmail
add link path=/usr/sbin/newaliases target=../lib/sendmail-mta/sendmail mediator=mta mediator-implementation=sendmail
add link path=/usr/sbin/sendmail target=../lib/sendmail-mta/sendmail mediator=mta mediator-implementation=sendmail
close
open pkg://test/sendmail-links@2.0
add set name=pkg.summary value="Example sendmail package for verifying symlink refcounts behaviour"
add hardlink path=/usr/bin/mailq target=../lib/sendmail-mta/mailq mediator=mta mediator-implementation=sendmail
add hardlink path=/usr/lib/sendmail target=../lib/sendmail-mta/sendmail mediator=mta mediator-implementation=sendmail
add hardlink path=/usr/sbin/newaliases target=../lib/sendmail-mta/sendmail mediator=mta mediator-implementation=sendmail
add hardlink path=/usr/sbin/sendmail target=../lib/sendmail-mta/sendmail mediator=mta mediator-implementation=sendmail
close """
pkg_postfix = """
add set name=pkg.summary value="Example postfix package"
add link path=/usr/bin/mailq target=../../opt/postfix/sbin/sendmail mediator=mta mediator-implementation=postfix
add link path=/usr/lib/sendmail target=../../opt/postfix/sbin/sendmail mediator=mta mediator-implementation=postfix
add link path=/usr/sbin/newaliases target=../../opt/postfix/sbin/sendmail mediator=mta mediator-implementation=postfix
add link path=/usr/sbin/sendmail target=../../opt/postfix/sbin/sendmail mediator=mta mediator-implementation=postfix
close
add set name=pkg.summary value="Example postfix site-priority package"
add link path=/usr/bin/mailq target=../../opt/postfix/sbin/sendmail mediator=mta mediator-implementation=postfix mediator-priority=site
add link path=/usr/lib/sendmail target=../../opt/postfix/sbin/sendmail mediator=mta mediator-implementation=postfix mediator-priority=site
add link path=/usr/sbin/newaliases target=../../opt/postfix/sbin/sendmail mediator=mta mediator-implementation=postfix mediator-priority=site
add link path=/usr/sbin/sendmail target=../../opt/postfix/sbin/sendmail mediator=mta mediator-implementation=postfix mediator-priority=site
close """
pkg_conflict_mta = """
open pkg://test/conflict-mta@1.0
add link path=/usr/bin/mailq target=../../opt/conflict-mta/sbin/sendmail mediator=mail mediator-implementation=conflict
add link path=/usr/lib/sendmail target=../../opt/conflict-mta/sbin/sendmail mediator=mail mediator-implementation=conflict
add link path=/usr/sbin/newaliases target=../../opt/conflict-mta/sbin/sendmail mediator=mail mediator-implementation=conflict
add link path=/usr/sbin/sendmail target=../../opt/conflict-mta/sbin/sendmail mediator=mail mediator-implementation=conflict
close """
pkg_duplicate_mta = """
open pkg://test/duplicate-mta@1.0
add set name=pkg.summary value="Example mta package that provides duplicate mediation"
add link path=/usr/bin/mailq target=../lib/duplicate-mta/mailq mediator=mta mediator-implementation=sendmail
add link path=/usr/lib/sendmail target=../lib/duplicate-mta/sendmail mediator=mta mediator-implementation=sendmail
add link path=/usr/sbin/newaliases target=../lib/duplicate-mta/sendmail mediator=mta mediator-implementation=sendmail
add link path=/usr/sbin/sendmail target=../lib/duplicate-mta/sendmail mediator=mta mediator-implementation=sendmail
close
open pkg://test/duplicate-mta@2.0
add set name=pkg.summary value="Example mta package that provides duplicate hardlink mediation"
add hardlink path=/usr/bin/mailq target=../lib/duplicate-mta/mailq mediator=mta mediator-implementation=sendmail
add hardlink path=/usr/lib/sendmail target=../lib/duplicate-mta/sendmail mediator=mta mediator-implementation=sendmail
add hardlink path=/usr/sbin/newaliases target=../lib/duplicate-mta/sendmail mediator=mta mediator-implementation=sendmail
add hardlink path=/usr/sbin/sendmail target=../lib/duplicate-mta/sendmail mediator=mta mediator-implementation=sendmail
close """
pkg_unmediated_mta = """
open pkg://test/unmediated-mta@1.0
add set name=pkg.summary value="Example unmediated mta package"
add link path=/usr/sbin/newaliases target=../../opt/unmediated/sbin/sendmail
close
open pkg://test/unmediated-mta@2.0
add set name=pkg.summary value="Example unmediated hardlink mta package"
add hardlink path=/usr/sbin/newaliases target=../../opt/unmediated/sbin/sendmail
close """
pkg_perl = """
add set name=pkg.summary value="Example perl package"
close
add set name=pkg.summary value="Example perl package"
close """
pkg_python = """
add set name=pkg.summary value="Example python package"
close
add set name=pkg.summary value="Example python package"
close
open pkg://test/runtime/python-unladen-swallow-27@2.7.0
add set name=pkg.summary value="Example python implementation package"
add file tmp/foopyus path=/usr/bin/python2.7-unladen-swallow owner=root group=bin mode=0555
add link path=/usr/bin/python target=python2.7-unladen-swallow mediator=python mediator-version=2.7 mediator-implementation=unladen-swallow
close
open pkg://test/runtime/python-unladen-swallow-34@3.4.0
add set name=pkg.summary value="Example python implementation package"
add file tmp/foopyus path=/usr/bin/python3.4-unladen-swallow owner=root group=bin mode=0555
add link path=/usr/bin/python target=python3.4-unladen-swallow mediator=python mediator-version=3.4 mediator-implementation=unladen-swallow
close
open pkg://test/runtime/python-unladen-swallow-35@3.5.0
add set name=pkg.summary value="Example python versioned implementation package"
add file tmp/foopyus path=/usr/bin/python3.5-unladen-swallow owner=root group=bin mode=0555
add link path=/usr/bin/python target=python3.5-unladen-swallow mediator=python mediator-version=3.5 mediator-implementation=unladen-swallow@3.5
close """
pkg_multi_python = """
open pkg://test/runtime/multi-impl-python-27@2.7.0
add set name=pkg.summary value="Example python package with multiple implementations"
add file tmp/foopyus path=/usr/bin/python2.7-unladen-swallow owner=root group=bin mode=0555
add link path=/usr/bin/python target=python2.7-unladen-swallow mediator=python mediator-implementation=unladen-swallow
close
open pkg://test/runtime/multi-impl-ver-python@3.4.0
add set name=pkg.summary value="Example python implementation package with multiple implementations and versions"
add file tmp/foopyus path=/usr/bin/python2.7-unladen-swallow owner=root group=bin mode=0555
add link path=/usr/bin/python target=python2.7-unladen-swallow mediator=python mediator-version=2.7 mediator-implementation=unladen-swallow
add file tmp/foopyus path=/usr/bin/python3.4-unladen-swallow owner=root group=bin mode=0555
add link path=/usr/bin/python target=python3.4-unladen-swallow mediator=python mediator-version=3.4 mediator-implementation=unladen-swallow
close
"""
pkg_vi = """
add set name=pkg.summary value="Example nvi vendor priority package"
add hardlink path=/usr/bin/vi target=nvi mediator=vi mediator-implementation=nvi mediator-priority=vendor
close
add set name=pkg.summary value="Example vi package"
close
add set name=pkg.summary value="Example vim vi package"
close
add set name=pkg.summary value="Example vim vi site priority package"
add hardlink path=/usr/bin/vi target=vim mediator=vi mediator-implementation=vim mediator-priority=site facet.vi=true
close """
pkg_multi_ver = """
add set name=pkg.summary value="Example multiple version mod_php package"
add link path=usr/apache2/2.2/libexec/mod_php5.so target=mod_php5.2.so mediator=php mediator-version=5.2
add link path=usr/apache2/2.2/libexec/mod_php5.so target=mod_php5.2.5.so mediator=php mediator-version=5.2.5
close """
pkg_variant = """
open pkg://test/multi-ver-variant@1.0
add set name=pkg.summary value="Example mediated varianted package"
add hardlink path=usr/bin/foo target=foo-1-nd mediator=foo mediator-version=1 variant.debug.osnet=false
add hardlink path=usr/bin/foo target=foo-1-d mediator=foo mediator-version=1 variant.debug.osnet=true
add hardlink path=usr/bin/foo target=foo-2-nd mediator=foo mediator-version=2 variant.debug.osnet=false
add hardlink path=usr/bin/foo target=foo-2-d mediator=foo mediator-version=2 variant.debug.osnet=true
close """
])
"""Verify set-mediator / unset-mediator function as expected
when setting / unsetting values only. Other tests verify
mediation change behaviour.
"""
# Verify lack of required input results in graceful failure for
# Verify unsetting a mediator not set results in nothing to do.
# Verify bad options or option input to set/unset-mediator
# result in graceful failure.
# Verify unprivileged user attempting set-mediator results in
# graceful failure.
# Verify mediation can be set and that the parsable output is
# correct.
["mta",
[[None, None], [None, "system"]],
[[None, None], ["sendmail", "local"]]]])
["mta",
[[None, None], [None, "system"]],
[[None, None], ["sendmail", "local"]]]])
mta\tsystem\t\tlocal\tsendmail\t
""")
mta\tlocal\t1.0\tlocal\tsendmail\t
""")
mta\tsystem\t\tlocal\tsendmail\t
""")
mta\tlocal\t1.0\tlocal\tpostfix@1.0\t
""")
# Verify unprilveged user attempting unset-mediator results in
# graceful failure.
# Verify individual components of mediation can be unset.
mta\tsystem\t\tlocal\tpostfix@1.0\t
""")
# Test the parsable output of set-mediator.
["mta",
[[None, "system"], ["1.0", "local"]],
[["postfix@1.0", "local"], ["postfix@1.0", "local"]]]])
mta\tlocal\t1.0\tlocal\tpostfix@1.0\t
""")
["mta",
[["1.0", "local"], ["1.0", "local"]],
[["postfix@1.0", "local"], [None, "system"]]]])
["mta",
[["1.0", "local"], ["1.0", "local"]],
[["postfix@1.0", "local"], [None, "system"]]]])
mta\tlocal\t1.0\tsystem\t\t
""")
# Verify unsetting last component without installed package
# results in completely removing mediation.
""")
# Now install some packages to test the ability to list
# available mediations.
# Test listing all available mediations.
perl\tsystem\t5.10.0\tsystem\t\t
perl\tsystem\t5.8.4\tsystem\t\t
python\tsystem\t3.5\tsystem\tunladen-swallow@3.5\t
python\tsystem\t3.4\tsystem\t\t
python\tsystem\t3.4\tsystem\tunladen-swallow\t
python\tsystem\t2.7\tsystem\t\t
python\tsystem\t2.7\tsystem\tunladen-swallow\t
vi\tsite\t\tsite\tvim\t
vi\tvendor\t\tvendor\tnvi\t
vi\tsystem\t\tsystem\tsvr4\t
""")
# Dump image cache before continuing to verify the
# information is re-generated and operations succeed.
# Test listing specific available mediations.
perl\tsystem\t5.10.0\tsystem\t\t
perl\tsystem\t5.8.4\tsystem\t\t
vi\tsite\t\tsite\tvim\t
vi\tvendor\t\tvendor\tnvi\t
vi\tsystem\t\tsystem\tsvr4\t
vi\tsite\t\tsite\tvim\t
vi\tvendor\t\tvendor\tnvi\t
vi\tsystem\t\tsystem\tsvr4\t
""", ("vi",))
# Set facet.vi=false and verify vim mediation is no longer
# available but verify still passes.
vi\tvendor\t\tvendor\tnvi\t
vi\tsystem\t\tsystem\tsvr4\t
""", ("vi",))
# Set facet.vi=true and verify vim mediation is available again.
vi\tsite\t\tsite\tvim\t
vi\tvendor\t\tvendor\tnvi\t
vi\tsystem\t\tsystem\tsvr4\t
""", ("vi",))
# Verify exit 1 if no mediators matched.
# Verify exit 3 (partial failure) if only some mediators match.
"""Verify that package mediation works as expected for install,
update, and uninstall with symbolic links.
"""
def gen_mta_files():
for fname in ("mailq",):
"bin", fname)
yield fpath
for fname in ("sendmail",):
"lib", fname)
yield fpath
def gen_mta_links():
for lname in ("mailq",):
"bin", lname)
yield lpath
"sbin", lname)
yield lpath
for lname in ("sendmail",):
"lib", lname)
yield lpath
def gen_perl_links():
for lname in ("perl",):
"bin", lname)
yield lpath
def gen_php_links():
for lname in ("mod_php5.so",):
yield lpath
def gen_python_links():
for lname in ("python",):
"bin", lname)
yield lpath
# Some installs are done with extra verbosity to ease in
# debugging tests when they fail.
# Upgrading to 1.0 should transition the files to links.
# Check that installed links point to sendmail and that
# verify passes.
mta\tsystem\t\tsystem\tsendmail\t
""")
# Upgrading to 3.0 should change the targets of every link.
# Downgrading to 0.5 should change sendmail and mailq links back
# to a file.
# Finally, upgrade to 1.0 again for remaining tests.
# Install postfix (this should succeed even though sendmail is
# already installed) and the links should be updated to point to
# postfix, and verify should pass.
mta\tsystem\t\tsystem\tpostfix\t
""")
# Remove the links for postfix, and then check that verify
# fails and that fix will restore the correct ones.
# Verify that setting mediation to existing value results in
# a change since mediation will now be marked as source
# 'local'.
mta\tsystem\t\tlocal\tpostfix\t
""")
# Verify that setting the same mediation again results in no
# changes since mediation is already effective and marked as
# source 'local'.
# Now change mediation implementation to sendmail.
mta\tsystem\t\tlocal\tsendmail\t
""")
# Check that installed links point to sendmail and that verify
# passes.
# Now change mediation to implementation not available. All
# mediated links should be removed, and verify should still
# pass.
mta\tsystem\t\tlocal\tnosuchmta\t
""")
# Now uninstall all packages.
mta\tsystem\t\tlocal\tnosuchmta\t
""")
# Now install both at the same time, since the bogus
# implementation is still set, no links should be installed.
# Now unset the mediation, postfix should be preferred since it
# is first lexically, and verify should pass.
mta\tsystem\t\tsystem\tpostfix\t
""")
# Now uninstall all packages, then reinstall them and verify
# that postfix was selected for initial install (since user did
# not explicitly set a mediation) and that verify passes.
mta\tsystem\t\tsystem\tpostfix\t
""")
# Verify that an unmediated package can't be installed if it
# conflicts with mediated packages that are installed.
# Verify that a mediated package that delivers conflicting links
# with the same mediation as an installed package cannot be
# installed.
# Verify that a mediated package with a conflicting mediator
# can't be installed if it conflicts with mediated packages
# that are installed.
# Verify that an unmediated package can be installed if the
# mediated ones are removed.
"unmediated-mta")
# Verify that mediated packages cannot be installed if an
# unmediated, conflicting package is installed.
# Remove all packages, then install both postfix and sendmail,
# verify that postfix was selected, then remove postfix and
# verify sendmail is selected (since the user didn't explicitly
# set a mediation).
# Now explicitly set sendmail for the mediation, then remove
# sendmail and install postfix, and verify links are not
# present.
# Install sendmail again and verify links point to sendmail.
# Remove and install postfix and verify links still point to
# sendmail (since user explicitly set mediation to sendmail
# previously).
# Verify that a package with an identical set of links for
# sendmail can be installed and that verify passes.
# Verify that removing sendmail-links will not remove the links
# since sendmail still delivers them and that verify
# still passes.
# Verify that a version of sendmail-links that delivers the
# links as hardlinks conflicts even though mediation is the
# the same.
# Now install sendmail-links again, and then remove both of them
# and verify that the links are gone and verify passes.
# Unset mediation for following tests.
# Install sendmail@1 and postfix@1, then upgrade to sendmail@2
# and verify that links point to sendmail due to vendor
# priority, and then upgrade to postfix@2 and verify that links
# point to postfix due to site priority.
mta\tvendor\t\tvendor\tsendmail\t
""")
mta\tsite\t\tsite\tpostfix\t
""")
# The mta packages are left installed to verify that the system
# properly handles multiple mediators in an image.
# Install perl5.8.4 and verify link targets point to 5.8.4
# and verify passes.
# Install perl5.10.0 and verify link targets point to 5.10.0
# and verify passes.
# Change mediation to 5.8.4 and verify link targets point to
# 5.8.4 and verify passes.
mta\tsite\t\tsite\tpostfix\t
perl\tlocal\t5.8.4\tsystem\t\t
""")
# Remove perl5.8.4 and verify links no longer exist and verify
# passes.
mta\tsite\t\tsite\tpostfix\t
perl\tlocal\t5.8.4\tsystem\t\t
""")
# Unset mediation, verify links point to perl5.10.0,
# remove perl-510, verify links do not exist, verify
# passes, and mediation is unknown.
mta\tsite\t\tsite\tpostfix\t
perl\tsystem\t5.10.0\tsystem\t\t
""")
mta\tsite\t\tsite\tpostfix\t
""")
# Install both perl5.8.4 and perl5.10.0, verify that 5.10.0 is
# preferred for links as it has the greatest version, and that
# verify passes.
mta\tsite\t\tsite\tpostfix\t
perl\tsystem\t5.10.0\tsystem\t\t
""")
# Install python and python-unladen-swallow at the same time,
# verify that unladen-swallow is NOT selected.
python\tsystem\t2.7\tsystem\t\t
""")
# Set only mediation version and verify unladen swallow is NOT
# selected.
python\tlocal\t2.7\tsystem\t\t
""")
# Set mediation implementation to unladen swallow and verify it
# was selected.
python\tlocal\t2.7\tlocal\tunladen-swallow\t
""")
# Unset only version mediation and verify unladen swallow is
# still selected.
python\tsystem\t2.7\tlocal\tunladen-swallow\t
""")
# Install python-34 and verify unladen swallow is still
# selected.
python\tsystem\t2.7\tlocal\tunladen-swallow\t
""")
# Install python-unladen-swallow-34 and verify that version
# is selected.
python\tsystem\t3.4\tlocal\tunladen-swallow\t
""")
# Set mediation version to 2.7 and verify that version of
# unladen swallow is selected.
python\tlocal\t2.7\tlocal\tunladen-swallow\t
""")
# Unset implementation mediation and verify unladen swallow
# is NOT selected.
python\tlocal\t2.7\tsystem\t\t
""")
# Remove python-27 and python-34 and then verify unladen swallow
# is selected.
python\tlocal\t2.7\tsystem\tunladen-swallow\t
""")
# Set mediation implementation to None explicitly and verify
# unladen swallow is NOT selected and link does not exist
# since no package satisfied mediation.
python\tlocal\t2.7\tlocal\t\t
""")
# Install unladen-swallow@3.5, then set mediation implementation
# to unladen-swallow@3.5 and verify the 3.5 implementation is
# selected.
"-V '' -I unladen-swallow@3.5 python")
python\tsystem\t3.5\tlocal\tunladen-swallow@3.5\t
""")
# Set mediation to unladen-swallow and verify
# unladen-swallow@3.5 remains selected.
python\tsystem\t3.5\tlocal\tunladen-swallow\t3.5
""")
# Remove installed links and ensure verify fails, then fix and
# ensure verify passes.
"python-unladen-swallow-34")
# Human-readable output shows any version selected but not
# explicitly requested in parentheses.
MEDIATOR VER. SRC. VERSION IMPL. SRC. IMPLEMENTATION
python system 3.5 local unladen-swallow(@3.5)
""")
# Set mediation to unladen-swallow@ and verify unladen-swallow
# 3.4 is selected.
python\tsystem\t3.4\tlocal\tunladen-swallow@\t
""")
# Remove links and ensure verify fails for for unladen-swallow
# 3.4, but passes for 2.7 and 3.5, and that fix will allow
# verify to pass again.
"python-unladen-swallow-35")
# Remove all packages; then verify that installing a single
# package that has multiple version mediations works as
# expected.
# Install apache-php52; verify that php 5.2.5 is selected.
php\tsystem\t5.2.5\tsystem\t\t
""")
# Test available mediations.
php\tsystem\t5.2.5\tsystem\t\t
php\tsystem\t5.2\tsystem\t\t
""")
# Set mediation version to 5.2 and verify 5.2.5 is NOT selected.
php\tlocal\t5.2\tsystem\t\t
""")
# Remove all packages; then verify that installing a single
# package that has multiple mediation implementations works as
# expected.
# Install multi-impl-python; verify that unladen swallow is NOT
# selected.
python\tsystem\t\tsystem\tcpython\t
""")
# Test available mediations.
python\tsystem\t\tsystem\tcpython\t
python\tsystem\t\tsystem\tunladen-swallow\t
""")
# Set mediation implementation to unladen swallow and verify it
# was selected.
python\tsystem\t\tlocal\tunladen-swallow\t
""")
# Remove all packages; then verify that installing a single
# package that has multiple mediation and version
# implementations works as expected.
# Verify that the default implementation of Python 3.4 was
# selected even though the package offers Python 2.7 and an
# unladen swallow implemenation of each version of Python.
python\tsystem\t3.4\tsystem\t\t
""")
# Test available mediations.
python\tsystem\t3.4\tsystem\t\t
python\tsystem\t3.4\tsystem\tunladen-swallow\t
python\tsystem\t2.7\tsystem\t\t
python\tsystem\t2.7\tsystem\tunladen-swallow\t
""")
"""Verify that package mediation works as expected for install,
update, and uninstall with hardlinks.
"""
# Some installs are done with extra verbosity to ease in
# debugging tests when they fail.
# Check that installed links point to svr4-vi and that
# verify passes.
vi\tsystem\t\tsystem\tsvr4\t
""")
# Install vim package and verify link still points to svr4-vi
# and that verify passes.
vi\tsystem\t\tsystem\tsvr4\t
""")
# Set mediation to use vim implementation of vi, and then
# verify link points to that implementation.
vi\tsystem\t\tlocal\tvim\t
""")
# Remove vi link and then ensure verify fails, fix will fix it,
# and then verify will succeed.
# Unset mediation, verify mediation reverts to svr4-vi, then
# uninstall svr4-vi and verify mediation reverts to vim.
vi\tsystem\t\tsystem\tsvr4\t
""")
vi\tsystem\t\tsystem\tvim\t
""")
# Install nvi and verify mediation changes to nvi due to
# mediator priority of vendor.
vi\tvendor\t\tvendor\tnvi\t
""")
# Update to vim@2 and verify mediation changes to vim due to
# mediator priority of site.
vi\tsite\t\tsite\tvim\t
""")
# Install svr4-vi and verify mediation remains set to vim due to
# mediator priority of site.
vi\tsite\t\tsite\tvim\t
""")
# Uninstall all packages; then verify that a single package
# containing multiple varianted, mediated hardlinks works as
# expected.
# Install multi-ver-variant and verify version 2 non-debug is
# selected.
foo\tsystem\t2\tsystem\t\t
""")
# Set debug variant and verify version 2 debug is selected.
foo\tsystem\t2\tsystem\t\t
""")
# Set mediator version to 1 and verify version 1 debug is
# selected.
foo\tlocal\t1\tsystem\t\t
""")
# Reset debug variant and verify version 1 non-debug is
# selected.
foo\tlocal\t1\tsystem\t\t
""")
if __name__ == "__main__":