#
# 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 stat
import time
foo10 = """
open foo@1.0,5.11-0
close """
foo11 = """
open foo@1.1,5.11-0
close """
bar10 = """
open bar@1.0,5.11-0
close """
baz10 = """
open baz@1.0,5.11-0
close """
pkg410 = """
open pkg4@1.0,5.11-0
close """
obsolete10 = """
open obso@1.0,5.11-0
add set name=pkg.obsolete value=true
close """
"""Test bad options to pkg freeze."""
# Test that if the user gives two arguments, and one's invalid,
# no packages are frozen.
# Test that printing a FreezePkgsException works.
exit=1)
expected = """\
pkg freeze: The following packages were frozen at two different versions by
the patterns provided. The package stem and the versions it was frozen at are
provided:
foo foo@1.2 foo@1.3
The following patterns contained wildcards but matched no
installed packages.
z*
The following patterns attempted to freeze the listed packages
at a version different from the version at which the packages are installed.
b*@1.1
bar
baz
pkg4@1.2
The following patterns don't match installed packages and
contain no version information. Uninstalled packages can only be frozen by
providing a version at which to freeze them.
foo
"""
"""Test that the pkg freeze and unfreeze cli handle exceptions
and provide the correct arguments to the api."""
# Test that unfreezing a package that isn't frozen gives an
# exitcode of 4.
# This fails because bar isn't installed and no version is
# provided.
# Test that freeze and unfreeze both display the list of frozen
# packages when no arguments are given.
# Test that a frozen package can't be updated.
# Check that -n with unfreeze works as expected.
# Test that unfreezing a package allows it to move.
# Test that freezing a package at a different version than the
# installed version fails.
# Test -n
# Test that the -c option works and that reasons show up in the
# output when the solver can't produce a solution. This also
# tests that wildcarding a package name with a specified version
# works as expected.
# Test that the reason a package was frozen is included in the
# output of a failed install.
"""Test that pkg freeze and unfreeze display the frozen packages
without needing privs, and that they don't stack trace when run
without privs."""
# Test that if the freeze file can't be read, we handle the
# exception appropriately.
"frozen_dict")
# Make sure that we can read the file again.
# Test that we don't stack trace if the version is unexpected.
"""Test operations involving freezing and relaxing freezes down
to the timestamp level."""
# Sleep for one second to ensure this new package has a
# different timestamp than the old one.
# Test that dispaying a timestamp freeze works.
# This should fail because new_foo isn't the version frozen.
# Check that the output of pkg list is correct in terms of the F
# column.
expected = "foo 1.0-0 ---\n"
expected = "foo 1.0-0 -f-\n"
# This should install the original foo@1.0 package.
# Relax the freeze so it doesn't include the timestamp.
# Test that pkg list reflects the relaxed freeze.
expected = "foo 1.0-0 if-\n"
expected = "foo 1.0-0 -f-\n"
# This should work and take foo to the foo@1.0 with the newer
# timestamp.
# Test that freezing using just the name freezes the installed
# package down to the timestamp. This also tests that freezing
# the same package with a different version overrides the
# previous setting.
# Test that freezing '*' freezes all installed packages and only
# installed packages down to timestamp.
# Test that unfreezeing '*' unfreezes all packages.
foo1 = """
open foo@1.1,5.11-0
close """
foo2 = """
open foo@1.2,5.12-0
close """
# This test suite needs actual depots.
"""Test whether the frozen state is displayed for the installed
package when the configured origin is removed."""
"""Test whether the frozen state is displayed for the installed
package when the configured origin is changed and the new origin
also contains the package."""
"""Test whether the frozen state is displayed for the installed
package when the frozen package is not in the catalog of the
new origin."""
# Test the frozen state is displayed when the configured origin of
# the publisher is changed and the package is not in the catalog
# of the new origin.
# Test the frozen state is removed after the origin of the publisher
# is changed back and the package is unfrozen.