#
# 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 sys
try:
except ImportError:
pkgs = """
open A@1.0,5.11-0
add dir mode=0755 owner=root group=bin path=etc
close
# B@1.0 is published as part of pkgs2
# C@1.0 is published as part of pkgs3
open D@1.0,5.11-0
add dir mode=0755 owner=root group=bin path=etc
add file etc/file4 mode=0555 owner=root group=bin path=etc/file4 revert-tag=bob revert-tag=ted revert-tag=carol
close
open A@1.1,5.11-0
add dir mode=0755 owner=root group=bin path=etc
close
open B@1.1,5.11-0
add dir mode=0755 owner=root group=bin path=etc
close
open C@1.1,5.11-0
add dir mode=0755 owner=root group=bin path=etc
add file etc/file3 mode=0555 owner=root group=bin path=etc/file3 revert-tag=bob revert-tag=ted preserve=true
close
open D@1.1,5.11-0
add dir mode=0755 owner=root group=bin path=etc
add file etc/file4 mode=0555 owner=root group=bin path=etc/file4 revert-tag=bob revert-tag=ted revert-tag=carol preserve=true
close
open W@1.0,5.11-0
add dir mode=0755 owner=root group=bin path=etc revert-tag=bob=*
close
open X@1.0,5.11-0
close
open Y@1.0,5.11-0
close
"""
# A set of packages that we publish with additional hash attributes
pkgs2 = """
open B@1.0,5.11-0
add dir mode=0755 owner=root group=bin path=etc
close
open dev@1.0,5.11-0
add dir mode=0755 owner=root group=bin path=dev revert-tag=init-dev=*
close
open dev2@1.0,5.11-0
add dir mode=0755 owner=root group=bin path=dev revert-tag=init-dev=*
add file dev/cfg/bar2 path=dev/cfg/bar2 mode=0555 owner=root group=bin preserve=true revert-tag=init-dev
close
"""
# A set of packages that we publish with additional hash attributes
pkgs3 = """
open C@1.0,5.11-0
add dir mode=0755 owner=root group=bin path=etc
close
"""
f.write("\nbogus\n")
debug_hash="sha1+sha256"))
if sha512_supported:
else:
# try reverting non-editable files
# modify files
# make sure we broke 'em
# We expect that the SHA-2 hash is used whenever there are SHA-2
# hashes on the action. Even though this client is run in
# "SHA-1" mode as well as "SHA-2" mode, we always verify with
# the most-preferred hash available.
sha2 = "e3868252b2b2de64e85f5b221e46eb23c428fe5168848eb36d113c66628131ce"
if sha512_supported:
sha2 = "13729cb7183961b48ce300c2588c86ad123e7c636f38a0f3c8408a75fd079d09"
# revert damage to A by path
# revert damage to D by tag
# revert damage to C,D by tag
# revert damage to B, C, D by tag and test the parsable output.
# When reverting damage, we always verify using the
# most-preferred hash, but retrieve content with the
# least-preferred hash: -D hash=sha1+sha256 and
# -D hash=sha1+sha512t_256 should have no effect here whatsoever,
# but -D hash=sha256 and -D hash=sha512t_256 should fail because
# our repository stores its files by the SHA1 hash.
exit=1)
if sha512_supported:
# fix A & update to versions w/ editable files
# handle missing files too
# check that we handle missing files when tagged
# make sure we got the default contents
# check that we handle files that don't exist correctly
# since tags can be missing, just nothing to do for
# tags that we cannot find
"""exercise new directory revert facility"""
# first try reverting tag that doesn't exist
# now revert a tag that exists, but doesn't need
# any work done
# now create some unpackaged files
# revert them
# now create some unpackaged directories and files
# revert them
# install a package w/ implicit directories
# revert them
# mix and match w/ regular tests
# generate some problems
"""duplicate usage in /dev as per Ethan's mail"""
if __name__ == "__main__":