t_pkg_image_update.py revision 3025
#
# 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
#
import testutils
if __name__ == "__main__":
import pkg5unittest
import os
import random
import unittest
foo10 = """
open foo@1.0,5.11-0
add dir mode=0755 owner=root group=bin path=/lib
close """
foo11 = """
open foo@1.1,5.11-0
add dir mode=0755 owner=root group=bin path=/lib
close """
bar10 = """
open bar@1.0,5.11-0
add dir mode=0755 owner=root group=bin path=/bin
close """
bar11 = """
open bar@1.1,5.11-0
add dir mode=0755 owner=root group=bin path=/bin
close """
baz10 = """
open baz@1.0,5.11-0
add dir mode=0755 owner=root group=bin path=/lib
close """
baz11 = """
open baz@1.1,5.11-0
add dir mode=0755 owner=root group=bin path=/lib
close """
qux10 = """
open qux@1.0,5.11-0
add depend type=require fmri=pkg:/quux@1.0
add dir mode=0755 owner=root group=bin path=/lib
close """
qux11 = """
open qux@1.1,5.11-0
add depend type=require fmri=pkg:/quux@1.1
add dir mode=0755 owner=root group=bin path=/lib
close """
quux10 = """
open quux@1.0,5.11-0
add depend type=require fmri=pkg:/corge@1.0
add dir mode=0755 owner=root group=bin path=/usr
close """
quux11 = """
open quux@1.1,5.11-0
add depend type=require fmri=pkg:/corge@1.1
add dir mode=0755 owner=root group=bin path=/usr
close """
corge10 = """
open corge@1.0,5.11-0
add dir mode=0755 owner=root group=bin path=/bin
close """
corge11 = """
open corge@1.1,5.11-0
add dir mode=0755 owner=root group=bin path=/bin
close """
incorp10 = """
open incorp@1.0,5.11-0
add depend type=incorporate fmri=foo@1.0
add depend type=incorporate fmri=bar@1.0
add set name=pkg.depend.install-hold value=test
close """
incorp11 = """
open incorp@1.1,5.11-0
add depend type=incorporate fmri=foo@1.1
add depend type=incorporate fmri=bar@1.1
add set name=pkg.depend.install-hold value=test
close """
# Two repositories are created for test2.
"test2", "test4", "test5"])
# Copy contents of repository 2 to repos 4 and 5.
for i in (4, 5):
{ "test1": "test%d" % i })
"""Test update with bad options."""
"""Install packages from multiple publishers, then verify that
removal of the second publisher will not prevent an
update."""
# Install a package from the preferred publisher.
# Install a package from a second publisher.
# Remove the publisher of an installed package, then add the
# publisher back, but with an empty repository. An update
# should still be possible.
# Add two publishers with the same packages as a removed one;
# an update should be possible despite the conflict (as
# the newer versions will simply be ignored).
# Remove one of the conflicting publishers. An update
# should still be possible even though the conflicts no longer
# exist and the original publisher is unknown (see bug 6856).
# Remove the remaining test publisher.
"""Verify that updates work as expected when different
publishers offer the same package."""
# First, verify that the preferred status of a publisher will
# not affect which source is used for update when two
# publishers offer the same package and the package publisher
# was preferred at the time of install.
# Next, verify that the preferred status of a publisher will
# not cause an upgrade of a package if the newer version is
# offered by the preferred publisher and the package publisher
# was not preferred at the time of isntall and was not used
# to install the package.
# Also verify that the client still accepts 'image-update'
# as a synonym for 'update' for compatibility.
# Finally, cleanup and verify no packages are installed.
"""Verify that update only updates specified packages."""
# Install a package from the preferred publisher.
# Install a package from a second publisher.
# Update just bar, and then verify foo wasn't updated.
# Now update bar back to 1.0 and then verify that update '*',
# update '*@*', or update without arguments will update all
# packages.
# Now rollback everything to 1.0, and then verify that
# '@latest' will take everything to the latest version.
def test_bug_18536(self):
"""Test that when a package specified on the command line can't
be upgraded because of a sticky publisher, the exception raised
is correct."""
def test_nothingtodo(self):
"""Test that if we have multiple facets of equal length that
we don't accidently report that there are image updates when
there are not."""
facet_max = 1000
for i in range(15):
# skip dups
continue
def test_ignore_missing(self):
"""Test that update shows correct behavior w/ and w/o
--ignore-missing."""
a_1 = """
open a@1.0,5.11-0
close """
pub2_a_1 = """
open pkg://pub2/a@1.0,5.11-0
close """
a_11 = """
open a@1.1,5.11-0
close """
a_2 = """
open a@2.0,5.11-0
close """
pub2_a_2 = """
open pkg://pub2/a@2.0,5.11-0
close """
a_3 = """
open a@3.0,5.11-0
close """
aa_1 = """
open aa@1.0,5.11-0
close """
aa_2 = """
open aa@2.0,5.11-0
close """
afoo_1 = """
close """
bfoo_1 = """
close """
fooa_1 = """
open foo/a@1.0,5.11-0
close """
foob_1 = """
open foo/b@1.0,5.11-0
close """
# Test that naming a specific publisher and stem will override
# the general wildcard.
# Test that naming a specific publisher will correctly change
# the publisher of the installed package.
# Test that a specific publisher and stem will override an
# unspecified publisher with a specific stem.
# Test that a specific publisher with a wildcard will override a
# unspecified publisher with a wildcard.
# Test that a specific stem without a specific publisher
# overrides a specific publisher without a specific stem.
# Test that conflicting publishers results in an error.
if __name__ == "__main__":