#
# 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 errno
import os
import shutil
import stat
import sys
import tempfile
import unittest
pkgcontents = \
"""
#Begin Comment
set name=pkg.description value="core kernel software for a specific instruction-set architecture"
set name=pkg.summary value="Core Solaris Kernel"
set name=variant.arch value=$(ARCH)
set name=variant.opensolaris.zone value=global value=nonglobal
dir path=boot group=sys
dir path=etc group=sys
dir path=kernel group=sys
$(i386_ONLY)dir path=kernel/$(ARCH64) group=sys
dir path=lib
#Middle Comment
$(i386_ONLY)driver name=acpi_drv perms="* 0666 root sys"
driver name=aggr perms="* 0666 root sys"
driver name=arp perms="arp 0666 root sys"
driver name=bl perms="* 0666 root sys"
driver name=bridge clone_perms="bridge 0666 root sys" policy="read_priv_set=net_rawaccess write_priv_set=net_rawaccess"
$(sparc_ONLY)driver name=bscbus alias=SUNW,bscbus
$(i386_ONLY)driver name=bscbus alias=SVI0101
$(sparc_ONLY)driver name=bscv alias=SUNW,bscv perms="* 0644 root sys"
$(i386_ONLY)driver name=bscv
driver name=clone
driver name=cn perms="* 0620 root tty"
driver name=conskbd perms="kbd 0666 root sys"
driver name=consms perms="mouse 0666 root sys"
driver name=cpuid perms="self 0644 root sys"
$(i386_ONLY)driver name=cpunex alias=cpus
driver name=crypto perms="crypto 0666 root sys"
driver name=cryptoadm perms="cryptoadm 0644 root sys"
$(sparc_ONLY)driver name=dad alias=ide-disk perms="* 0640 root sys"
driver name=devinfo perms="devinfo 0640 root sys" perms="devinfo,ro 0444 root sys"
driver name=dld perms="* 0666 root sys"
driver name=dlpistub perms="* 0666 root sys"
$(sparc_ONLY)driver name=i8042 alias=8042
$(i386_ONLY)driver name=i8042
driver name=icmp perms="icmp 0666 root sys" policy="read_priv_set=net_icmpaccess write_priv_set=net_icmpaccess"
driver name=icmp6 perms="icmp6 0666 root sys" policy="read_priv_set=net_icmpaccess write_priv_set=net_icmpaccess"
$(i386_ONLY)driver name=intel_nb5000 \\
alias=pci8086,25c0 \\
alias=pci8086,25d0 \\
alias=pci8086,25d4 \\
alias=pci8086,25d8 \\
alias=pci8086,3600 \\
alias=pci8086,4000 \\
alias=pci8086,4001 \\
alias=pci8086,4003 \\
alias=pci8086,65c0
$(i386_ONLY)driver name=intel_nhm \\
alias=pci8086,3423 \\
alias=pci8086,372a
$(i386_ONLY)driver name=intel_nhmex alias=pci8086,3422
driver name=ip perms="ip 0666 root sys" \\
policy="read_priv_set=net_rawaccess write_priv_set=net_rawaccess"
driver name=ip6 perms="ip6 0666 root sys" \\
policy="read_priv_set=net_rawaccess write_priv_set=net_rawaccess"
driver name=ipnet perms="lo0 0666 root sys" \\
policy="read_priv_set=net_observability write_priv_set=net_observability"
driver name=ippctl
driver name=ipsecah perms="ipsecah 0666 root sys" \\
policy="read_priv_set=sys_ip_config write_priv_set=sys_ip_config"
driver name=ipsecesp perms="ipsecesp 0666 root sys" \\
policy="read_priv_set=sys_ip_config write_priv_set=sys_ip_config"
driver name=iptun
driver name=iwscn
driver name=kb8042 alias=pnpPNP,303
driver name=keysock perms="keysock 0666 root sys" \\
policy="read_priv_set=sys_ip_config write_priv_set=sys_ip_config"
driver name=kmdb
driver name=kssl perms="* 0666 root sys"
driver name=llc1 clone_perms="llc1 0666 root sys"
driver name=lofi perms="* 0600 root sys" perms="ctl 0644 root sys"
driver name=log perms="conslog 0666 root sys" perms="log 0640 root sys"
$(i386_ONLY)driver name=mc-amd \\
alias=pci1022,1100 \\
alias=pci1022,1101 \\
alias=pci1022,1102
driver name=mm perms="allkmem 0600 root sys" perms="kmem 0640 root sys" \\
perms="mem 0640 root sys" perms="null 0666 root sys" \\
perms="zero 0666 root sys" \\
policy="allkmem read_priv_set=all write_priv_set=all" \\
policy="kmem read_priv_set=none write_priv_set=all" \\
policy="mem read_priv_set=none write_priv_set=all"
driver name=mouse8042 alias=pnpPNP,f03
$(i386_ONLY)driver name=mpt class=scsi \\
alias=pci1000,30 \\
alias=pci1000,50 \\
alias=pci1000,54 \\
alias=pci1000,56 \\
alias=pci1000,58 \\
alias=pci1000,62 \\
alias=pciex1000,56 \\
alias=pciex1000,58 \\
alias=pciex1000,62
driver name=nulldriver \\
alias=scsa,nodev \\
alias=scsa,probe
driver name=openeepr perms="openprom 0640 root sys" policy=write_priv_set=all
driver name=options
$(sparc_ONLY)driver name=pci_pci class=pci \\
alias=pci1011,1 \\
alias=pci1011,21 \\
alias=pci1011,24 \\
alias=pci1011,25 \\
alias=pci1011,26 \\
alias=pci1014,22 \\
alias=pciclass,060400
$(i386_ONLY)driver name=pci_pci class=pci \\
alias=pci1011,1 \\
alias=pci1011,21 \\
alias=pci1014,22 \\
alias=pciclass,060400 \\
alias=pciclass,060401
$(sparc_ONLY)driver name=pcieb \\
alias=pciex108e,9010 \\
alias=pciex108e,9020 \\
alias=pciex10b5,8114 \\
alias=pciex10b5,8516 \\
alias=pciex10b5,8517 \\
alias=pciex10b5,8518 \\
alias=pciex10b5,8532 \\
alias=pciex10b5,8533 \\
alias=pciex10b5,8548 \\
alias=pciexclass,060400
$(i386_ONLY)driver name=pcieb \\
alias=pciexclass,060400 \\
alias=pciexclass,060401
$(sparc_ONLY)driver name=pcieb_bcm alias=pciex1166,103
driver name=physmem perms="* 0600 root sys"
driver name=poll perms="* 0666 root sys"
$(sparc_ONLY)driver name=power alias=ali1535d+-power
$(i386_ONLY)driver name=power
driver name=pseudo alias=zconsnex
driver name=ptc perms="* 0666 root sys"
driver name=ptsl perms="* 0666 root sys"
$(sparc_ONLY)driver name=ramdisk alias=SUNW,ramdisk perms="* 0600 root sys" \\
perms="ctl 0644 root sys"
$(i386_ONLY)driver name=ramdisk perms="* 0600 root sys" \\
perms="ctl 0644 root sys"
driver name=random perms="* 0644 root sys" policy=write_priv_set=sys_devices
driver name=rts perms="rts 0666 root sys"
driver name=sad perms="admin 0666 root sys" perms="user 0666 root sys"
driver name=scsi_vhci class=scsi-self-identifying perms="* 0666 root sys" \\
policy="devctl write_priv_set=sys_devices"
$(sparc_ONLY)driver name=sd perms="* 0640 root sys" \\
alias=ide-cdrom \\
alias=scsiclass,00 \\
alias=scsiclass,05
$(i386_ONLY)driver name=sd perms="* 0640 root sys" \\
alias=scsiclass,00 \\
alias=scsiclass,05
driver name=sgen perms="* 0600 root sys" \\
alias=scsa,08.bfcp \\
alias=scsa,08.bvhci
driver name=simnet clone_perms="simnet 0666 root sys" perms="* 0666 root sys"
$(i386_ONLY)driver name=smbios perms="smbios 0444 root sys"
driver name=softmac
driver name=spdsock perms="spdsock 0666 root sys" \\
policy="read_priv_set=sys_ip_config write_priv_set=sys_ip_config"
driver name=st alias=scsiclass,01 perms="* 0666 root sys"
driver name=sy perms="tty 0666 root tty"
driver name=sysevent perms="* 0600 root sys"
driver name=sysmsg perms="msglog 0600 root sys" perms="sysmsg 0600 root sys"
driver name=tcp perms="tcp 0666 root sys"
driver name=tcp6 perms="tcp6 0666 root sys"
driver name=tl perms="* 0666 root sys" clone_perms="ticlts 0666 root sys" \\
clone_perms="ticots 0666 root sys" clone_perms="ticotsord 0666 root sys"
$(sparc_ONLY)driver name=ttymux alias=multiplexer
$(i386_ONLY)driver name=tzmon
$(sparc_ONLY)driver name=uata \\
alias=pci1095,646 \\
alias=pci1095,649 \\
alias=pci1095,680 \\
alias=pci10b9,5229 \\
alias=pci10b9,5288 class=dada class=scsi
$(i386_ONLY)driver name=ucode perms="* 0644 root sys"
driver name=udp perms="udp 0666 root sys"
driver name=udp6 perms="udp6 0666 root sys"
$(i386_ONLY)driver name=vgatext \\
alias=pciclass,000100 \\
alias=pciclass,030000 \\
alias=pciclass,030001 \\
alias=pnpPNP,900
driver name=vnic clone_perms="vnic 0666 root sys" perms="* 0666 root sys"
driver name=wc perms="* 0600 root sys"
$(i386_ONLY)file path=boot/solaris/bin/create_diskmap group=sys mode=0555
file path=boot/solaris/bin/create_ramdisk group=sys mode=0555
file path=boot/solaris/bin/extract_boot_filelist group=sys mode=0555
$(i386_ONLY)file path=boot/solaris/bin/update_grub group=sys mode=0555
file path=boot/solaris/filelist.ramdisk group=sys
file path=boot/solaris/filelist.safe group=sys
file path=etc/name_to_sysnum group=sys original_name=SUNWckr:etc/name_to_sysnum \\
preserve=renameold
$(i386_ONLY)file path=kernel/$(ARCH64)/genunix group=sys mode=0755 \\
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
$(i386_ONLY)file path=kernel/drv/acpi_drv.conf group=sys reboot-needed=false
$(i386_ONLY)file path=kernel/drv/acpi_toshiba group=sys
file path=kernel/drv/bridge.conf group=sys reboot-needed=false
$(i386_ONLY)file path=kernel/drv/bscbus.conf group=sys reboot-needed=false
file path=kernel/drv/clone.conf group=sys reboot-needed=false
file path=kernel/drv/conskbd.conf group=sys reboot-needed=false
file path=kernel/drv/consms.conf group=sys reboot-needed=false
file path=kernel/drv/cpuid.conf group=sys reboot-needed=false
file path=kernel/drv/crypto.conf group=sys reboot-needed=false
file path=kernel/drv/cryptoadm.conf group=sys reboot-needed=false
file path=kernel/drv/devinfo.conf group=sys reboot-needed=false
file path=kernel/drv/dlpistub.conf group=sys reboot-needed=false
file path=kernel/drv/icmp6.conf group=sys reboot-needed=false
$(i386_ONLY)file path=kernel/drv/intel_nb5000 group=sys
$(i386_ONLY)file path=kernel/drv/intel_nb5000.conf group=sys reboot-needed=false
$(i386_ONLY)file path=kernel/drv/intel_nhm.conf group=sys reboot-needed=false
$(i386_ONLY)file path=kernel/drv/intel_nhmex group=sys
$(i386_ONLY)file path=kernel/drv/intel_nhmex.conf group=sys reboot-needed=false
file path=kernel/drv/ipnet.conf group=sys reboot-needed=false
file path=kernel/drv/ippctl.conf group=sys reboot-needed=false
file path=kernel/drv/ipsecah.conf group=sys reboot-needed=false
file path=kernel/drv/ipsecesp.conf group=sys reboot-needed=false
file path=kernel/drv/iptun.conf group=sys reboot-needed=false
file path=kernel/drv/iwscn.conf group=sys reboot-needed=false
file path=kernel/drv/keysock.conf group=sys reboot-needed=false
$(i386_ONLY)file path=kernel/drv/mc-amd.conf group=sys reboot-needed=false
$(i386_ONLY)file path=kernel/drv/nulldriver group=sys
file path=kernel/drv/openeepr.conf group=sys reboot-needed=false
file path=kernel/drv/options.conf group=sys reboot-needed=false
file path=kernel/drv/pcieb.conf group=sys reboot-needed=false
file path=kernel/drv/physmem.conf group=sys reboot-needed=false
$(i386_ONLY)file path=kernel/drv/power.conf group=sys reboot-needed=false
file path=kernel/drv/pseudo.conf group=sys reboot-needed=false
file path=kernel/drv/ramdisk.conf group=sys reboot-needed=false
file path=kernel/drv/random.conf group=sys reboot-needed=false
file path=kernel/drv/scsi_vhci.conf group=sys \\
original_name=SUNWckr:kernel/drv/scsi_vhci.conf preserve=true \\
reboot-needed=false
reboot-needed=false
file path=kernel/drv/simnet.conf group=sys reboot-needed=false
$(i386_ONLY)file path=kernel/drv/smbios.conf group=sys reboot-needed=false
file path=kernel/drv/softmac.conf group=sys reboot-needed=false
file path=kernel/drv/spdsock.conf group=sys reboot-needed=false
preserve=true reboot-needed=false
file path=kernel/drv/sysevent.conf group=sys reboot-needed=false
file path=kernel/drv/sysmsg.conf group=sys reboot-needed=false
$(i386_ONLY)file path=kernel/drv/tzmon.conf group=sys reboot-needed=false
reboot-needed=false
$(i386_ONLY)file path=kernel/drv/ucode.conf group=sys reboot-needed=false
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
$(i386_ONLY)file path=kernel/kiconv/kiconv_emea group=sys mode=0755 \\
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
$(i386_ONLY)file path=kernel/misc/consconfig group=sys mode=0755 \\
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
$(i386_ONLY)file path=kernel/misc/pci_autoconfig group=sys mode=0755 \\
reboot-needed=true
mode=0755 reboot-needed=true
mode=0755 reboot-needed=true
mode=0755 reboot-needed=true
reboot-needed=true
mode=0755 reboot-needed=true
mode=0755 reboot-needed=true
reboot-needed=true
reboot-needed=true
mode=0755 reboot-needed=true
$(i386_ONLY)file path=kernel/misc/scsi_vhci/scsi_vhci_f_asym_emc group=sys \\
mode=0755 reboot-needed=true
$(i386_ONLY)file path=kernel/misc/scsi_vhci/scsi_vhci_f_asym_lsi group=sys \\
mode=0755 reboot-needed=true
$(i386_ONLY)file path=kernel/misc/scsi_vhci/scsi_vhci_f_asym_sun group=sys \\
mode=0755 reboot-needed=true
$(i386_ONLY)file path=kernel/misc/scsi_vhci/scsi_vhci_f_sym group=sys mode=0755 \\
reboot-needed=true
$(i386_ONLY)file path=kernel/misc/scsi_vhci/scsi_vhci_f_sym_emc group=sys \\
mode=0755 reboot-needed=true
$(i386_ONLY)file path=kernel/misc/scsi_vhci/scsi_vhci_f_sym_hds group=sys \\
mode=0755 reboot-needed=true
$(i386_ONLY)file path=kernel/misc/scsi_vhci/scsi_vhci_f_tape group=sys mode=0755 \\
reboot-needed=true
$(i386_ONLY)file path=kernel/misc/scsi_vhci/scsi_vhci_f_tpgs group=sys mode=0755 \\
reboot-needed=true
$(i386_ONLY)file path=kernel/misc/scsi_vhci/scsi_vhci_f_tpgs_tape group=sys \\
mode=0755 reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
reboot-needed=true
file path=lib/svc/method/svc-dumpadm mode=0555
file path=lib/svc/method/svc-scheduler mode=0555
file path=lib/svc/manifest/system/dumpadm.xml group=sys mode=0444
file path=lib/svc/manifest/system/scheduler.xml group=sys mode=0444
legacy pkg=SUNWckr arch=$(ARCH) category=system \\
desc="core kernel software for a specific instruction-set architecture" \\
hotline="Please contact your local service provider" \\
name="Core Solaris Kernel (Root)" vendor="Sun Microsystems, Inc." \\
version=11.11,REV=2009.11.11
license common/crypto/THIRDPARTYLICENSE.cryptogams \\
license=common/crypto/THIRDPARTYLICENSE.cryptogams
license common/crypto/aes/amd64/THIRDPARTYLICENSE.gladman \\
license=common/crypto/aes/amd64/THIRDPARTYLICENSE.gladman
license common/crypto/aes/amd64/THIRDPARTYLICENSE.openssl \\
license=common/crypto/aes/amd64/THIRDPARTYLICENSE.openssl
license common/crypto/ecc/THIRDPARTYLICENSE \\
license=common/crypto/ecc/THIRDPARTYLICENSE
license common/crypto/md5/amd64/THIRDPARTYLICENSE \\
license=common/crypto/md5/amd64/THIRDPARTYLICENSE
license common/mpi/THIRDPARTYLICENSE license=common/mpi/THIRDPARTYLICENSE
license cr_Sun license=cr_Sun
license lic_CDDL license=lic_CDDL
license uts/common/inet/ip/THIRDPARTYLICENSE.rts \\
license=uts/common/inet/ip/THIRDPARTYLICENSE.rts
license uts/common/inet/tcp/THIRDPARTYLICENSE \\
license=uts/common/inet/tcp/THIRDPARTYLICENSE
license uts/common/io/THIRDPARTYLICENSE.etheraddr \\
license=uts/common/io/THIRDPARTYLICENSE.etheraddr
license uts/common/sys/THIRDPARTYLICENSE.icu \\
license=uts/common/sys/THIRDPARTYLICENSE.icu
license uts/common/sys/THIRDPARTYLICENSE.unicode \\
license=uts/common/sys/THIRDPARTYLICENSE.unicode
license uts/intel/io/acpica/THIRDPARTYLICENSE \\
license=uts/intel/io/acpica/THIRDPARTYLICENSE
$(i386_ONLY)link path=boot/solaris/bin/root_archive \\
target=../../../usr/sbin/root_archive
#End Comment
"""
needs_formatting = """\
# This comment was the first line in the file.
# The depend actions here should have their type attribute first, followed by
# fmri, other attributes, facets, and then variants. In addition, they should
# be sorted by type and then fmri.
depend fmri=zoo fmri=apple fmri=barge type=require-any
depend fmri=baz type=require
depend fmri=zorch@2.0 type=optional
depend type=require fmri=bar
# This action should be line wrapped after each pkg.debug attribute.
depend fmri=__TBD pkg.debug.depend.file=libGL.so.1 pkg.debug.depend.path=lib pkg.debug.depend.path=usr/lib pkg.debug.depend.reason=usr/bin/xdriinfo pkg.debug.depend.type=elf type=require
# These lines through the depend action are to test for comment duplication, bug
# 18858.
$(MAN_INCLUDE)<include network-ftp.man.p5m>
# keep ping on system during upgrade from earlier releases
# legacy and license actions should appear after group actions, which should
# appear before depend actions.
license a8c4507c0abeaa04fa24adda980a2558890c0249 chash=4636ad2345de0ab201674162c134796f8f1ecb72 license=cr_Oracle pkg.csize=88 pkg.size=71
legacy arch=i386 category=system desc="The Image Packaging System (IPS), or pkg(7), is the software delivery system used on OpenSolaris systems. This package contains the core command-line components and depot server." hotline="Please contact your local service provider" name="Image Packaging System" pkg=SUNWipkg variant.arch=i386 vendor="Sun Microsystems, Inc." version=0.0.0,REV=2011.04.08.15.41.42
# This transform is the first; wrapping should be maintained although leading
# spaces should be trimmed.
<transform pkg variant.mumble=set-default -> \\
emit set name=variant.mumble \\
value=$(ARCH)>
# These filesystem action attributes should be re-ordered as path, owner, group,
# mode, other attributes, facet, variant. In addition, the actions should be
# sorted by path.
group=root facet.devel=true owner=root
# These actions contain path and hash attributes with whitespace, quotes, and
# equal characters and should retain them when formatted (including hash
# attributes).
# This action contains a hash attribute which doesn't need special handling, so
# should be transformed to the standard position.
# This action has exactly 80 characters, so shouldn't be wrapped.
dir mode=0755 path=etc variant.arch=i386 group=root facet.devel=false owner=root
# This action has one attribute past 80 characters, so only variant should be
# wrapped after the attributes are reordered.
# This action has only one attribute past 80 characters, so should be unwrapped.
file \\
# This transform is the second; wrapping should be maintained.
<transform pkg variant.arch=set-default -> \\
emit set name=variant.arch value=$(ZARCH)>
# This action should be line wrapped after each alias attribute.
driver name=intel_nb5000 alias=pci8086,25c0 alias=pci8086,25d0 alias=pci8086,25d4 alias=pci8086,25d8 alias=pci8086,3600 alias=pci8086,4000 alias=pci8086,4001 alias=pci8086,4003 alias=pci8086,65c0
# This driver action's aliases should be sorted by their alias prefix first, and
# then numerically for each component that can be parsed as hexadecimal, not
# alphabetically or asciibetically.
driver alias=usb1044,800a alias=usb13b1,20 alias=usb148f,2573 alias=usb15a9,4 alias=usb7d1,3c03 alias=usb7d1,3c04 alias=usbb05,1723 clone_perms="rum 0666 root sys" name=rum perms="* 0666 root sys" variant.arch=i386
# This driver's attributes should appear in the order: name, perms, clone_perms,
# privs, policy, devlink, alias.
driver name=driver alias="bobcat" clone_perms="driver 0666 root sys" devlink=type=ddi_pseudo;name=sv\\t\\D perms="driver 0666 root sys" policy="write_priv_set=net_rawaccess" privs=sys_config
# This comment was for set name=foo; its attributes should be reordered and
# wrapped.
set name=foo value=bar variant.arch=i386 variant.arch=sparc variant.opensolaris.zone=global variant.opensolaris.zone=nonglobal
set name=pkg.summary value="No dir was harmed in the making of this summary."
# This comment was for set name=pkg.description; its value should remain quoted
# and on a single, separate line.
set name=pkg.description \\
value='PolicyKit provides an authorization API intended to be used by privileged programs ("mechanisms") offering service to unprivileged programs ("clients") through some form of IPC mechanism such as D-Bus or Unix pipes.'
# This transform is the third; it should remain unwrapped.
<transform pkg variant.arch=set-default -> emit set name=variant.arch value=$(ARCH)>
# This comment was for pkg.fmri; it should be the first set action and the comment should
# not be unwrapped even though its first line is > 80 characters.
# This comment was the last line of the manifest."""
v1_fmt = """\
# This comment was the first line in the file.
# The depend actions here should have their type attribute first, followed by
# fmri, other attributes, facets, and then variants. In addition, they should
# be sorted by type and then fmri.
# These lines through the depend action are to test for comment duplication, bug
# 18858.
$(MAN_INCLUDE)<include network-ftp.man.p5m>
# keep ping on system during upgrade from earlier releases
# This transform is the first; wrapping should be maintained although leading
# spaces should be trimmed.
<transform pkg variant.mumble=set-default -> emit set name=variant.mumble value=$(ARCH)>
# This transform is the second; wrapping should be maintained.
<transform pkg variant.arch=set-default -> emit set name=variant.arch value=$(ZARCH)>
# This transform is the third; it should remain unwrapped.
<transform pkg variant.arch=set-default -> emit set name=variant.arch value=$(ARCH)>
# This comment was for pkg.fmri; it should be the first set action and the comment should
# not be unwrapped even though its first line is > 80 characters.
set name=pkg.fmri \\
# This comment was for set name=pkg.description; its value should remain quoted
# and on a single, separate line.
set name=pkg.description \\
value='PolicyKit provides an authorization API intended to be used by privileged programs ("mechanisms") offering service to unprivileged programs ("clients") through some form of IPC mechanism such as D-Bus or Unix pipes.'
set name=pkg.summary value="No dir was harmed in the making of this summary."
# This comment was for set name=foo; its attributes should be reordered and
# wrapped.
set name=foo value=bar variant.arch=i386 variant.arch=sparc \\
variant.opensolaris.zone=global variant.opensolaris.zone=nonglobal
# This action has exactly 80 characters, so shouldn't be wrapped.
dir path=etc group=root mode=0755 owner=root facet.devel=false \\
variant.arch=i386
# This action has one attribute past 80 characters, so only variant should be
# wrapped after the attributes are reordered.
variant.arch=i386
# This driver's attributes should appear in the order: name, perms, clone_perms,
# privs, policy, devlink, alias.
driver name=driver alias=bobcat clone_perms="driver 0666 root sys" \\
devlink=type=ddi_pseudo;name=sv\\t\\D perms="driver 0666 root sys" \\
policy=write_priv_set=net_rawaccess privs=sys_config
# This action should be line wrapped after each alias attribute.
driver name=intel_nb5000 \\
alias=pci8086,25c0 \\
alias=pci8086,25d0 \\
alias=pci8086,25d4 \\
alias=pci8086,25d8 \\
alias=pci8086,3600 \\
alias=pci8086,4000 \\
alias=pci8086,4001 \\
alias=pci8086,4003 \\
alias=pci8086,65c0
# This driver action's aliases should be sorted by their alias prefix first, and
# then numerically for each component that can be parsed as hexadecimal, not
# alphabetically or asciibetically.
driver name=rum clone_perms="rum 0666 root sys" perms="* 0666 root sys" \\
alias=usb1044,800a \\
alias=usb13b1,20 \\
alias=usb148f,2573 \\
alias=usb15a9,4 \\
alias=usb7d1,3c03 \\
alias=usb7d1,3c04 \\
alias=usbb05,1723 variant.arch=i386
variant.arch=i386
# This action contains a hash attribute which doesn't need special handling, so
# should be transformed to the standard position.
# These actions contain path and hash attributes with whitespace, quotes, and
# equal characters and should retain them when formatted (including hash
# attributes).
# This action has only one attribute past 80 characters, so should be unwrapped.
file \\
legacy pkg=SUNWipkg arch=i386 category=system \\
desc="The Image Packaging System (IPS), or pkg(7), is the software delivery system used on OpenSolaris systems. This package contains the core command-line components and depot server." \\
hotline="Please contact your local service provider" \\
name="Image Packaging System" vendor="Sun Microsystems, Inc." \\
version=0.0.0,REV=2011.04.08.15.41.42 variant.arch=i386
# legacy and license actions should appear after group actions, which should
# appear before depend actions.
license a8c4507c0abeaa04fa24adda980a2558890c0249 license=cr_Oracle \\
chash=4636ad2345de0ab201674162c134796f8f1ecb72 pkg.csize=88 pkg.size=71
# These filesystem action attributes should be re-ordered as path, owner, group,
# mode, other attributes, facet, variant. In addition, the actions should be
# sorted by path.
depend type=require-any fmri=apple fmri=barge fmri=zoo
# This action should be line wrapped after each pkg.debug attribute.
depend fmri=__TBD pkg.debug.depend.file=libGL.so.1 \\
depend fmri=bar type=require
depend fmri=baz type=require
depend fmri=zorch@2.0 type=optional
# This comment was the last line of the manifest.
"""
v2_fmt = """\
# This comment was the first line in the file.
# The depend actions here should have their type attribute first, followed by
# fmri, other attributes, facets, and then variants. In addition, they should
# be sorted by type and then fmri.
# These lines through the depend action are to test for comment duplication, bug
# 18858.
$(MAN_INCLUDE)<include network-ftp.man.p5m>
# keep ping on system during upgrade from earlier releases
# This transform is the first; wrapping should be maintained although leading
# spaces should be trimmed.
<transform pkg variant.mumble=set-default -> \\
emit set name=variant.mumble \\
value=$(ARCH)>
# This transform is the second; wrapping should be maintained.
<transform pkg variant.arch=set-default -> \\
emit set name=variant.arch value=$(ZARCH)>
# This transform is the third; it should remain unwrapped.
<transform pkg variant.arch=set-default -> emit set name=variant.arch value=$(ARCH)>
# This comment was for pkg.fmri; it should be the first set action and the comment should
# not be unwrapped even though its first line is > 80 characters.
set name=pkg.fmri \\
set name=pkg.summary value="No dir was harmed in the making of this summary."
# This comment was for set name=pkg.description; its value should remain quoted
# and on a single, separate line.
set name=pkg.description \\
value='PolicyKit provides an authorization API intended to be used by privileged programs ("mechanisms") offering service to unprivileged programs ("clients") through some form of IPC mechanism such as D-Bus or Unix pipes.'
# This comment was for set name=foo; its attributes should be reordered and
# wrapped.
set name=foo value=bar variant.arch=i386 variant.arch=sparc \\
variant.opensolaris.zone=global variant.opensolaris.zone=nonglobal
# This action has exactly 80 characters, so shouldn't be wrapped.
dir path=etc owner=root group=root mode=0755 facet.devel=false variant.arch=i386
# These filesystem action attributes should be re-ordered as path, owner, group,
# mode, other attributes, facet, variant. In addition, the actions should be
# sorted by path.
variant.arch=i386
# This action contains a hash attribute which doesn't need special handling, so
# should be transformed to the standard position.
# These actions contain path and hash attributes with whitespace, quotes, and
# equal characters and should retain them when formatted (including hash
# attributes).
# This action has one attribute past 80 characters, so only variant should be
# wrapped after the attributes are reordered.
variant.arch=i386
# This action has only one attribute past 80 characters, so should be unwrapped.
# This driver's attributes should appear in the order: name, perms, clone_perms,
# privs, policy, devlink, alias.
driver name=driver perms="driver 0666 root sys" \\
clone_perms="driver 0666 root sys" privs=sys_config \\
policy=write_priv_set=net_rawaccess devlink=type=ddi_pseudo;name=sv\\t\\D \\
alias=bobcat
# This action should be line wrapped after each alias attribute.
driver name=intel_nb5000 \\
alias=pci8086,25c0 \\
alias=pci8086,25d0 \\
alias=pci8086,25d4 \\
alias=pci8086,25d8 \\
alias=pci8086,3600 \\
alias=pci8086,4000 \\
alias=pci8086,4001 \\
alias=pci8086,4003 \\
alias=pci8086,65c0
# This driver action's aliases should be sorted by their alias prefix first, and
# then numerically for each component that can be parsed as hexadecimal, not
# alphabetically or asciibetically.
driver name=rum perms="* 0666 root sys" clone_perms="rum 0666 root sys" \\
alias=usb7d1,3c03 \\
alias=usb7d1,3c04 \\
alias=usbb05,1723 \\
alias=usb1044,800a \\
alias=usb13b1,20 \\
alias=usb148f,2573 \\
alias=usb15a9,4 variant.arch=i386
legacy pkg=SUNWipkg arch=i386 category=system \\
desc="The Image Packaging System (IPS), or pkg(7), is the software delivery system used on OpenSolaris systems. This package contains the core command-line components and depot server." \\
hotline="Please contact your local service provider" \\
name="Image Packaging System" vendor="Sun Microsystems, Inc." \\
version=0.0.0,REV=2011.04.08.15.41.42 variant.arch=i386
# legacy and license actions should appear after group actions, which should
# appear before depend actions.
license a8c4507c0abeaa04fa24adda980a2558890c0249 license=cr_Oracle \\
chash=4636ad2345de0ab201674162c134796f8f1ecb72 pkg.csize=88 pkg.size=71
depend type=optional fmri=zorch@2.0
# This action should be line wrapped after each pkg.debug attribute.
depend type=require fmri=__TBD pkg.debug.depend.file=libGL.so.1 \\
pkg.debug.depend.path=lib \\
depend type=require fmri=bar
depend type=require fmri=baz
depend type=require-any fmri=apple fmri=barge fmri=zoo
# This comment was the last line of the manifest.
"""
"w") as f:
"w") as f:
"""Verify that pkgfmt -c format checking works as expected."""
# Copy man to man2 before executing tests.
# Verify pkgfmt exits 1 when checking format for manifest that
# needs formatting (both from a file and from stdin).
# Ensure "error:" is in output (for the benefit of ON nightly).
# Verify pkgfmt exits 1 when checking format for multiple
# manifests that need formatting.
# Verify formatted manifest is identical to expected.
# Test using environment variable.
# Verify pkgfmt exits 1 when any of the manifests named need
# formatting. (Ordering matters here, the good one must be
# specified last.)
# Verify pkgfmt exits 0 when a manifest doesn't need formatting.
# Format the second manifest.
# Verify pkgfmt exits 0 when none of the manifests named need
# formatting.
# Verify pkgfmt -c accepts a manifest in v1 or v2 format, and
# that the output for each version matches expected.
# Verify pkgfmt -c accepts both a v1 and v2 format manifest
# at the same time.
"""display that pkgfmt makes no diff in manifest"""
# Remove comments from source file; they don't sort
# since pkgfmt tries to maintain comment position in
# file.
# remove backslashes in place
# sort into alternate order and format
"""Verify pkgfmt handles unprivileged user gracefully."""
# Should fail since manifest needs formatting and user can't
# replace file.
# Now reformat the file.
# Should not fail even though user is unprivileged.
"""Verify pkgfmt handles comments, does stdin"""