t_pkglint.py revision 2046
# 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. # See the License for the specific language governing permissions # and limitations under the License. # When distributing Covered Code, include this CDDL HEADER in each # 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] # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. # WARNING pkglint.action002.2 unusual mode 2755 in usr/sbin/prtdiag delivered by # We deliver prtdiag as a link on one platform, as a file on another set name=org.opensolaris.consolidation value=osnet set name=pkg.description value="core kernel software for a specific instruction-set architecture" set name=info.classification value=org.opensolaris.category.2008:System/Core set name=pkg.summary value="Core Solaris Kernel" set name=variant.arch value=i386 value=sparc file 1d5eac1aab628317f9c088d21e4afda9c754bb76 chash=43dbb3e0bc142f399b61d171f926e8f91adcffe2 elfarch=i386 elfbits=32 elfhash=64c67b16be970380cd5840dd9753828e0c5ada8c group=sys mode=2755 owner=root path=usr/sbin/prtdiag pkg.csize=5490 pkg.size=13572 variant.arch=i386 # The errors for this check are pretty unpleasant # ERROR pkglint.dupaction008 path usr/sbin/prtdiag is delivered by multiple action types # ERROR pkglint.dupaction007 path usr/sbin/prtdiag is reference-counted but has different # attributes across 2 duplicates: group: sys -> system/kernel # chash: 43dbb3e0bc142f399b61d171f926e8f91adcffe2 -> system/kernel # elfhash: 64c67b16be970380cd5840dd9753828e0c5ada8c -> system/kernel # WARNING pkglint.action002.2 unusual mode 2755 in usr/sbin/prtdiag delivered by # ERROR pkglint.dupaction001.2 path usr/sbin/prtdiag is a duplicate delivered by # declaring overlapping variants variant.arch "pkglint.dupaction007",
"pkglint.action002.2",
"pkglint.dupaction001.2"]
# We deliver prtdiag as a link on one platform, as a file on another # but have forgotten to set the variant properly on the file action set name=org.opensolaris.consolidation value=osnet set name=pkg.description value="core kernel software for a specific instruction-set architecture" set name=info.classification value=org.opensolaris.category.2008:System/Core set name=pkg.summary value="Core Solaris Kernel" set name=variant.arch value=i386 value=sparc file 1d5eac1aab628317f9c088d21e4afda9c754bb76 chash=43dbb3e0bc142f399b61d171f926e8f91adcffe2 elfarch=i386 elfbits=32 elfhash=64c67b16be970380cd5840dd9753828e0c5ada8c group=sys mode=2755 owner=root path=usr/sbin/prtdiag pkg.csize=5490 pkg.size=13572 variant.arch=sparc # we try to deliver usr/sbin/fsadmin twice with the same variant value set name=org.opensolaris.consolidation value=osnet set name=variant.opensolaris.zone value=global value=nonglobal set name=variant.other value=carrots set name=variant.arch value=i386 value=sparc set name=pkg.description value="Pkglint test package" set name=description value="Pkglint test package" set name=info.classification value=org.opensolaris.category.2008:System/Packaging set name=pkg.summary value="Pkglint test package" dir group=bin mode=0755 owner=root path=usr/lib/X11 dir group=bin mode=0755 alt=foo owner=root path=usr/lib/X11/fs file nohash group=bin mode=0755 owner=root path=usr/sbin/fsadmin pkg.csize=953 pkg.size=1572 variant.other=carrots file nohash group=bin mode=0755 owner=root path=usr/sbin/fsadmin pkg.csize=1234 pkg.size=1234 variant.other=carrots file nohash elfarch=i386 elfbits=32 elfhash=2d5abc9b99e65c52c1afde443e9c5da7a6fcdb1e group=bin mode=0755 owner=root path=usr/bin/xfs pkg.csize=68397 pkg.size=177700 variant.arch=i386 # we declare dependencies on the same package name twice, with variants set name=org.opensolaris.consolidation value=sfw set name=pkg.description value="Pkglint test package" set name=description value="Pkglint test package" set name=info.classification value=org.opensolaris.category.2008:System/Packaging set name=pkg.summary value="Pkglint test package" set name=variant.opensolaris.zone value=global value=nonglobal set name=variant.arch value=sparc value=i386 set name=variant.foo value=bar value=baz depend fmri=shell/zsh@4.3.9-0.133 type=require variant.foo=bar depend fmri=shell/zsh@4.3.9-0.133 type=require variant.foo=bar # There are 2 dependencies on sfw-incorporation, but only one is a require # incorporation, so this should not generate errors. set name=pkg.depend.install-hold value=core-os set name=pkg.description value="This package constrains system package versions to the same build. WARNING: Proper system update and correct package selection depend on the presence of this incorporation. Removing this package will result in an unsupported system." set name=description value="incorporation to lock all system packages to same build" set name=pkg.summary value="incorporation to lock all system packages to same build" set name=variant.arch value=sparc value=i386 set name=org.opensolaris.consolidation value=None set name=info.classification value=org.opensolaris.category.2008:System/Packaging # as we're declaring complimentary variants, we shouldn't report errors set name=org.opensolaris.consolidation value=sfw set name=variant.opensolaris.zone value=global value=nonglobal set name=pkg.description value="Pkglint test package" set name=description value="Pkglint test package" set name=info.classification value=org.opensolaris.category.2008:System/Packaging set name=pkg.summary value="Pkglint test package" set name=variant.arch value=sparc value=i386 set name=variant.other value=other value=thing set name=variant.foo value=bar value=baz depend fmri=shell/zsh@4.3.9-0.133 type=require variant.foo=bar depend fmri=shell/zsh@4.3.9-0.134 type=require variant.foo=baz # We try to deliver usr/sbin/fsadmin twice without specifying any variants set name=org.opensolaris.consolidation value=osnet set name=variant.opensolaris.zone value=global value=nonglobal set name=variant.arch value=i386 value=sparc set name=pkg.description value="Pkglint test package" set name=description value="Pkglint test package" set name=info.classification value=org.opensolaris.category.2008:System/Packaging set name=pkg.summary value="Pkglint test package" dir group=bin mode=0755 owner=root path=usr/lib/X11 dir group=bin mode=0755 alt=foo owner=root path=usr/lib/X11/fs file nohash group=bin mode=0755 owner=root path=usr/sbin/fsadmin pkg.csize=953 pkg.size=1572 file nohash group=bin mode=0755 owner=root path=usr/sbin/fsadmin pkg.csize=1234 pkg.size=1234 file nohash group=bin mode=0755 owner=root path=usr/sbin/fsadmin pkg.csize=1234 pkg.size=1234 file nohash group=bin mode=0755 owner=root path=usr/sbin/fsadmin pkg.csize=1234 pkg.size=1234 file nohash group=bin mode=0755 owner=root path=usr/sbin/fsadmin pkg.csize=1234 pkg.size=1234 file nohash elfarch=i386 elfbits=32 elfhash=2d5abc9b99e65c52c1afde443e9c5da7a6fcdb1e group=bin mode=0755 owner=root path=usr/bin/xfs pkg.csize=68397 pkg.size=177700 variant.arch=i386 # we deliver some duplicate ref-counted actions (dir, link, hardlink) with differing set name=org.opensolaris.consolidation value=osnet set name=variant.opensolaris.zone value=global value=nonglobal set name=variant.other value=carrots set name=variant.arch value=i386 value=sparc set name=pkg.description value="Pkglint test package" set name=description value="Pkglint test package" set name=info.classification value=org.opensolaris.category.2008:System/Packaging set name=pkg.summary value="Pkglint test package" dir group=bin mode=0755 owner=root path=usr/lib/X11 dir group=bin mode=0755 alt=foo owner=root path=usr/lib/X11/fs dir group=sys mode=0755 owner=root path=/usr/lib/X11 # 3 errors get reported for this manifest: # usr/sbin/fsadmin delivered by [<pkg.fmri.PkgFmri 'pkg://opensolaris.org/pkglint/test@1.1.0,5.11-0.141:20100604T143737Z' at 0x8733e2c>] is a duplicate, declaring overlapping variants ['variant.other'] "pkglint.dupaction007",
"pkglint.dupaction001.2"]
# we try to deliver usr/sbin/fsadmin with different action types, declaring a variant on one. set name=org.opensolaris.consolidation value=osnet set name=variant.opensolaris.zone value=global value=nonglobal set name=variant.arch value=i386 value=sparc set name=variant.other value=carrots set name=pkg.description value="Pkglint test package" set name=description value="Pkglint test package" set name=info.classification value=org.opensolaris.category.2008:System/Packaging set name=pkg.summary value="Pkglint test package" dir group=bin mode=0755 owner=root path=usr/lib/X11 dir group=bin mode=0755 alt=foo owner=root path=usr/lib/X11/fs dir group=bin mode=0755 owner=root path=usr/sbin/fsadmin variant.other=carrots file nohash group=bin mode=0755 owner=root path=usr/sbin/fsadmin pkg.csize=1234 pkg.size=1234 variant.other=carrots file nohash elfarch=i386 elfbits=32 elfhash=2d5abc9b99e65c52c1afde443e9c5da7a6fcdb1e group=bin mode=0755 owner=root path=usr/bin/xfs pkg.csize=68397 pkg.size=177700 variant.arch=i386 # path usr/lib/X11/fs is ref-counted but has different attributes across duplicates in [<pkg.fmri.PkgFmri 'pkg://opensolaris.org/pkglint/test@1.1.0,5.11-0.141:20100604T143737Z' at 0x87369ec>] set name=org.opensolaris.consolidation value=osnet set name=variant.opensolaris.zone value=global value=nonglobal set name=variant.arch value=i386 value=sparc set name=pkg.description value="Pkglint test package" set name=description value="Pkglint test package" set name=info.classification value=org.opensolaris.category.2008:System/Packaging set name=pkg.summary value="Pkglint test package" dir group=bin mode=0755 owner=root path=usr/lib/X11 dir group=bin mode=0755 alt=foo owner=root path=usr/lib/X11/fs link group=bin mode=0755 alt=foo owner=foor path=usr/lib/X11/fs target=bar file nohash group=bin mode=0755 owner=root path=usr/sbin/fsadmin pkg.csize=1234 pkg.size=1234 file nohash elfarch=i386 elfbits=32 elfhash=2d5abc9b99e65c52c1afde443e9c5da7a6fcdb1e group=bin mode=0755 owner=root path=usr/bin/xfs pkg.csize=68397 pkg.size=177700 variant.arch=i386 # We try to deliver the same set action twice set name=org.opensolaris.consolidation value=osnet set name=pkg.description value="core kernel software for a specific instruction-set architecture" set name=info.classification value=org.opensolaris.category.2008:System/Core set name=pkg.summary value="Core Solaris Kernel" set name=variant.arch value=i386 value=sparc # We try to deliver the same set action twice, with different variants set name=pkg.description value="core kernel software for a specific instruction-set architecture" set name=info.classification value=org.opensolaris.category.2008:System/Core set name=pkg.summary value="Core Solaris Kernel" set name=org.opensolaris.consolidation value=osnet set name=variant.arch value=i386 value=sparc set name=test value=i386 variant.arch=sparc set name=test value=i386 variant.arch=i386 # We try to deliver the same set action twice, with variants set name=org.opensolaris.consolidation value=osnet set name=pkg.description value="core kernel software for a specific instruction-set architecture" set name=info.classification value=org.opensolaris.category.2008:System/Core set name=pkg.summary value="Core Solaris Kernel" set name=variant.arch value=i386 value=sparc set name=test value=i386 variant.arch=sparc set name=test value=i386 variant.arch=sparc "opensolaris.action001.3",
"opensolaris.action001.2",
"opensolaris.action001.3",
"opensolaris.action001.1",
"opensolaris.action001.3"]
# We try to deliver a series of invalid usernames, some result in multiple set name=org.opensolaris.consolidation value=osnet set name=pkg.description value="core kernel software for a specific instruction-set architecture" set name=info.classification value=org.opensolaris.category.2008:System/Core set name=pkg.summary value="Core Solaris Kernel" set name=variant.arch value=i386 value=sparc user gcos-field="pkg(5) server UID" group=pkg5srv uid=97 username="" user gcos-field="pkg(5) server UID" group=pkg5srv uid=98 username=1pkg5srv user gcos-field="pkg(5) server UID" group=pkg5srv uid=99 username=pkg5srvZZ user gcos-field="pkg(5) server UID" group=pkg5srv uid=100 username=pkg5s:v user gcos-field="pkg(5) server UID" group=pkg5srv uid=101 username=pkg5-_. # We deliver a license action that also specifies a path set name=variant.arch value=i386 value=sparc set name=pkg.description value="core kernel software for a specific instruction-set architecture" set name=org.opensolaris.consolidation value=osnet set name=info.classification value=org.opensolaris.category.2008:System/Core set name=pkg.summary value="Core Solaris Kernel" # We actually emit 4 messages here in testing, 2 for the legitmate errors, # 2 for the "linted"-handling code, saying that we're not linting these actions "pkglint.action002.2",
"pkglint.dupaction003.2"]
# we deliver some duplicate ref-counted actions (dir, link, hardlink) with differing # attributes, but since they're marked as linted, we should get no output, we should # still get the duplicate user though, as well as the unusual mode check for the # version of the path that's 0751 set name=org.opensolaris.consolidation value=osnet set name=variant.opensolaris.zone value=global value=nonglobal set name=variant.other value=carrots set name=variant.arch value=i386 value=sparc set name=pkg.description value="Pkglint test package" set name=description value="Pkglint test package" set name=info.classification value=org.opensolaris.category.2008:System/Packaging set name=pkg.summary value="Pkglint test package" dir group=bin mode=0755 owner=root path=usr/lib/X11 pkg.linted=True dir group=bin mode=0755 alt=foo owner=root path=usr/lib/X11/fs pkg.linted=True dir group=staff mode=0751 owner=root path=/usr/lib/X11 user ftpuser=false gcos-field="Network Configuration Admin" group=netadm uid=17 username=netcfg user ftpuser=false gcos-field="Network Configuration Admin" group=netadm uid=19 username=netcfg # We'll actually report one lint message here, that we're not # doing any linting for this manifest because of pkg.linted # - the default log handler used by the pkglint CLI only marks # a failure if it's > level.INFO, but for testing, we record all # This manifest is marked as pkg.linted, and should not have manifest # checks run on it. In particular, we should not complain about the lack # of variant.arch nor the unusual permission, 0751 set name=org.opensolaris.consolidation value=osnet set name=variant.opensolaris.zone value=global value=nonglobal set name=variant.other value=carrots # set name=variant.arch value=i386 value=sparc set name=pkg.description value="Pkglint test package" set name=description value="Pkglint test package" set name=info.classification value=org.opensolaris.category.2008:System/Packaging set name=pkg.summary value="Pkglint test package" set name=pkg.linted value=True dir group=bin mode=0755 owner=root path=usr/lib/X11 dir group=bin mode=0755 alt=foo owner=root path=usr/lib/X11/fs dir group=staff mode=0751 owner=root path=/usr/lib/X11 user ftpuser=false gcos-field="Network Configuration Admin" group=netadm uid=17 username=netcfg user ftpuser=false gcos-field="Network Configuration Admin" group=netadm uid=19 username=netcfg # We deliver a legacy actions without a required attribute, "desc". Since we # can't find the package pointed to by the legacy 'pkg' attribute, we should # not complain about those. set name=pkg.description value="core kernel software for a specific instruction-set architecture" set name=info.classification value=org.opensolaris.category.2008:System/Core set name=pkg.summary value="Core Solaris Kernel" set name=variant.arch value=i386 value=sparc set name=org.opensolaris.consolidation value=osnet legacy arch=i386 category=system hotline="Please contact your local service provider" name="Core Solaris Kernel (Root)" pkg=SUNWckr variant.arch=i386 vendor="Sun Microsystems, Inc." version=11.11,REV=2009.11.11 legacy arch=sparc category=system desc="core kernel software for a specific instruction-set architecture" hotline="Please contact your local service provider" name="Core Solaris Kernel (Root)" pkg=SUNWckr variant.arch=sparc vendor="Sun Microsystems, Inc." version=11.11,REV=2009.11.11 # we try to deliver usr/sbin/fsadmin twice with the same variant value set name=org.opensolaris.consolidation value=osnet set name=variant.opensolaris.zone value=global value=nonglobal set name=pkg.description value="Pkglint test package" set name=description value="Pkglint test package" set name=info.classification value=org.opensolaris.category.2008:System/Packaging set name=pkg.summary value="Pkglint test package" set name=variant.arch value=i386 value=sparc set name=variant.other value="carrots" value="turnips" dir group=bin mode=0755 owner=root path=usr/lib/X11 dir group=bin mode=0755 alt=foo owner=root path=usr/lib/X11/fs file nohash group=bin mode=0755 owner=root path=usr/sbin/fsadmin pkg.csize=953 pkg.size=1572 variant.other=carrots file nohash group=bin mode=0755 owner=root path=usr/sbin/fsadmin pkg.csize=1234 pkg.size=1234 variant.other=turnips file nohash elfarch=i386 elfbits=32 elfhash=2d5abc9b99e65c52c1afde443e9c5da7a6fcdb1e group=bin mode=0755 owner=root path=usr/bin/xfs pkg.csize=68397 pkg.size=177700 variant.arch=i386 # we declare allowed variants for usr/lib/X11/fs, despite them # delivering to the same path name. Ref-counted actions, but # different variants, this should not be reported as an error # We also check that the 'target' difference in the link /usr/lib/foo # doesn't result in lint errors. set name=org.opensolaris.consolidation value=osnet set name=variant.opensolaris.zone value=global value=nonglobal set name=pkg.description value="Pkglint test package" set name=description value="Pkglint test package" set name=info.classification value=org.opensolaris.category.2008:System/Packaging set name=pkg.summary value="Pkglint test package" set name=variant.arch value=i386 value=sparc set name=variant.bar value=other value=foo dir group=bin mode=0755 owner=root path=usr/lib/X11 dir group=bin mode=0755 alt=foo owner=root path=usr/lib/X11/fs variant.bar=other dir group=bin mode=0755 alt=foo owner=root path=usr/lib/X11/fs variant.bar=foo file nohash group=bin mode=0755 owner=root path=usr/sbin/fsadmin pkg.csize=1234 pkg.size=1234 file nohash elfarch=i386 elfbits=32 elfhash=2d5abc9b99e65c52c1afde443e9c5da7a6fcdb1e group=bin mode=0755 owner=root path=usr/bin/xfs pkg.csize=68397 pkg.size=177700 variant.arch=i386 # as we're declaring complimentary variants, we shouldn't report errors set name=org.opensolaris.consolidation value=sfw set name=variant.opensolaris.zone value=global value=nonglobal set name=pkg.description value="Pkglint test package" set name=description value="Pkglint test package" set name=info.classification value=org.opensolaris.category.2008:System/Packaging set name=pkg.summary value="Pkglint test package" set name=variant.arch value=sparc value=i386 set name=variant.other value=other value=thing set name=variant.foo value=bar value=baz depend fmri=shell/zsh@4.3.9-0.133 type=require variant.foo=bar depend fmri=shell/zsh@4.3.9-0.134 type=require variant.foo=baz # We deliver an obsolete package that has a pkg.description set name=pkg.obsolete value=true variant.arch=i386 set name=pkg.description value="This is a package description" set name=variant.opensolaris.zone value=global value=nonglobal variant.arch=i386 set name=variant.arch value=i386 # We deliver an obsolete package that has actions other than 'set'. # (bogus signature on this manifest, just for testing) set name=pkg.obsolete value=true variant.arch=i386 set name=variant.opensolaris.zone value=global value=nonglobal variant.arch=i386 set name=variant.arch value=i386 dir mode=0555 owner=root group=sys path=/usr/bin signature algorithm=sha256 value=75b662e14a4ea8f0fa0507d40133b0347a36bc1f63112487f4738073edf4455d version=0 # This is a perfectly valid example of an obsolete package set name=pkg.obsolete value=true variant.arch=i386 set name=variant.opensolaris.zone value=global value=nonglobal variant.arch=i386 set name=variant.arch value=i386 # We've reported a package as having been renamed, yet try to deliver # actions other than 'set' and 'depend' # (bogus signature on this manifest, just for testing) set name=org.opensolaris.consolidation value=sfw set name=pkg.renamed value=true set name=variant.opensolaris.zone value=global value=nonglobal set name=variant.arch value=sparc value=i386 depend fmri=shell/zsh@4.3.9-0.133 type=require dir mode=0555 owner=root group=sys path=/usr/bin signature algorithm=sha256 value=75b662e14a4ea8f0fa0507d40133b0347a36bc1f63112487f4738073edf4455d version=0 # This is a perfectly valid example of a renamed package # (bogus signature on this manifest, just for testing) set name=org.opensolaris.consolidation value=sfw set name=pkg.renamed value=true set name=variant.opensolaris.zone value=global value=nonglobal set name=variant.arch value=sparc value=i386 depend fmri=shell/zsh@4.3.9-0.133 type=require signature algorithm=sha256 value=75b662e14a4ea8f0fa0507d40133b0347a36bc1f63112487f4738073edf4455d version=0 # we try to set a variant we've never described in the manifest set name=org.opensolaris.consolidation value=osnet set name=variant.opensolaris.zone value=global value=nonglobal set name=variant.arch value=i386 value=sparc set name=pkg.description value="Pkglint test package" set name=description value="Pkglint test package" set name=info.classification value=org.opensolaris.category.2008:System/Packaging set name=pkg.summary value="Pkglint test package" dir group=bin mode=0755 owner=root path=usr/lib/X11 dir group=bin mode=0755 alt=foo owner=root path=usr/lib/X11/fs file nohash elfarch=i386 elfbits=32 elfhash=2d5abc9b99e65c52c1afde443e9c5da7a6fcdb1e group=bin mode=0755 owner=root path=usr/bin/xfs pkg.csize=68397 pkg.size=177700 variant.arch=i386 # we try to deliver an action with a variant value we haven't described set name=org.opensolaris.consolidation value=osnet set name=variant.opensolaris.zone value=global value=nonglobal set name=variant.arch value=i386 value=sparc set name=pkg.description value="Pkglint test package" set name=description value="Pkglint test package" set name=info.classification value=org.opensolaris.category.2008:System/Packaging set name=pkg.summary value="Pkglint test package" dir group=bin mode=0755 owner=root path=usr/lib/X11 dir group=bin mode=0755 alt=foo owner=root path=usr/lib/X11/fs file nohash elfarch=i386 elfbits=32 elfhash=2d5abc9b99e65c52c1afde443e9c5da7a6fcdb1e group=bin mode=0755 owner=root path=usr/bin/xfs pkg.csize=68397 pkg.size=177700 variant.arch=i386 # We try to deliver an 'unknown' action set name=pkg.description value="core kernel software for a specific instruction-set architecture" set name=info.classification value=org.opensolaris.category.2008:System/Core set name=pkg.summary value="Core Solaris Kernel" set name=variant.arch value=i386 value=sparc set name=org.opensolaris.consolidation value=osnet # we deliver a directory with an unexecutable mode 0422 set name=org.opensolaris.consolidation value=osnet set name=variant.opensolaris.zone value=global value=nonglobal set name=pkg.description value="Pkglint test package" set name=description value="Pkglint test package" set name=info.classification value=org.opensolaris.category.2008:System/Packaging set name=pkg.summary value="Pkglint test package" set name=variant.arch value=i386 value=sparc dir group=bin mode=0424 owner=root path=usr/lib/X11 dir group=bin mode=0755 alt=foo owner=root path=usr/lib/X11/fs file nohash group=bin mode=0755 owner=root path=usr/sbin/fsadmin pkg.csize=1234 pkg.size=1234 file nohash elfarch=i386 elfbits=32 elfhash=2d5abc9b99e65c52c1afde443e9c5da7a6fcdb1e group=bin mode=0755 owner=root path=usr/bin/xfs pkg.csize=68397 pkg.size=177700 variant.arch=i386 """Records log messages to a buffer""" """Ensure that lint checks are functioning.""" "Expected %s failures for %s, got %s: %s" %
"Differences in reported vs. actual" " lint ids for %s: %s vs. %s" %
"""Tests that exercise reference vs. lint repository checks and test linting of multiple packages at once.""" ref_mf[
"ref-ancient-sample1.mf"] =
""" # A sample package which delivers several actions, to an earlier release than # 0.140. This manifest has an intentional error, which we should detect when # linting against build 139. set name=pkg.description value="core kernel software for a specific instruction-set architecture" set name=info.classification value=org.opensolaris.category.2008:System/Core set name=pkg.summary value="Core Solaris Kernel" set name=org.opensolaris.consolidation value=osnet set name=variant.arch value=i386 value=sparc dir group=sys mode=0755 owner=root path=etc ref_mf[
"ref-old-sample1.mf"] =
""" # A sample package which delivers several actions, to an earlier release than set name=pkg.description value="core kernel software for a specific instruction-set architecture" set name=info.classification value=org.opensolaris.category.2008:System/Core set name=pkg.summary value="Core Solaris Kernel" set name=org.opensolaris.consolidation value=osnet set name=variant.arch value=i386 value=sparc dir group=sys mode=0755 owner=root path=etc ref_mf[
"ref-sample1.mf"] =
""" # A sample package which delivers several actions, to 0.141 set name=pkg.description value="core kernel software for a specific instruction-set architecture" set name=info.classification value=org.opensolaris.category.2008:System/Core set name=pkg.summary value="Core Solaris Kernel" set name=org.opensolaris.consolidation value=osnet set name=variant.arch value=i386 value=sparc dir group=sys mode=0755 owner=root path=etc ref_mf[
"ref-sample2.mf"] =
""" # A sample package which delivers several actions set name=pkg.description value="additional reference actions for pkglint" set name=info.classification value=org.opensolaris.category.2008:System/Core set name=pkg.summary value="Core Solaris Kernel" set name=org.opensolaris.consolidation value=osnet set name=variant.arch value=i386 value=sparc dir group=sys mode=0755 owner=root path=etc dir group=sys mode=0755 owner=root path=etc ref_mf[
"ref-sample3.mf"] =
""" # A sample package which delivers several actions set name=pkg.description value="additional reference actions for pkglint" set name=info.classification value=org.opensolaris.category.2008:System/Core set name=pkg.summary value="Core Solaris Kernel" set name=org.opensolaris.consolidation value=osnet set name=variant.arch value=i386 value=sparc dir group=sys mode=0755 owner=root path=etc ref_mf[
"dummy-ancestor.mf"] =
""" # This is a dummy package designed trip a lint of no-ancestor-legacy.mf # we don't declare a dependency on the FMRI delivered by it. set name=pkg.description value="additional reference actions for pkglint" set name=info.classification value=org.opensolaris.category.2008:System/Core set name=pkg.summary value="Core Solaris Kernel" set name=org.opensolaris.consolidation value=osnet set name=variant.arch value=i386 value=sparc # A set of manifests to be linted. Note that these are all self # consistent, passing all lint checks on their own. # Errors are designed to show up when linted against the ref_* # manifests, as imported to our reference repository. lint_mf[
"deliver-old-sample1.mf"] =
""" # We deliver something a package older version than our ref_repo has, # 0.140 instead of 0.141, this should cause errors unless we're # linting against the 0.140 build in the repository. # (the errors being, a name clash for system/kernel and a path clash # for etc/passwd - essentially pkglint sees the 0.140 package being a # duplicate of the 0.141 package) set name=pkg.description value="core kernel software for a specific instruction-set architecture" set name=info.classification value=org.opensolaris.category.2008:System/Core set name=pkg.summary value="Core Solaris Kernel" set name=org.opensolaris.consolidation value=osnet set name=variant.arch value=i386 value=sparc dir group=sys mode=0755 owner=root path=etc lint_mf[
"deliver-new-sample1.mf"] =
""" # We deliver a newer version than our reference repo has set name=pkg.description value="core kernel software for a specific instruction-set architecture" set name=info.classification value=org.opensolaris.category.2008:System/Core set name=pkg.summary value="Core Solaris Kernel" set name=org.opensolaris.consolidation value=osnet set name=variant.arch value=i386 value=sparc dir group=sys mode=0755 owner=root path=etc lint_mf[
"deliver-new-sample1-duplicate.mf"] =
""" # We deliver a newer version than our reference repo has, intentionally # duplicating a file our reference repository has in sample2 set name=pkg.description value="core kernel software for a specific instruction-set architecture" set name=info.classification value=org.opensolaris.category.2008:System/Core set name=pkg.summary value="Core Solaris Kernel" set name=org.opensolaris.consolidation value=osnet set name=variant.arch value=i386 value=sparc dir group=sys mode=0755 owner=root path=etc lint_mf[
"no-ancestor-legacy.mf"] = \
# We deliver a legacy action, but declare a package in the legacy action pkg= # field from the ref repo which doesn't depend on us. Only one failure, # because the 2nd legacy action below points to a non-existent package. set name=pkg.description value="core kernel software for a specific instruction-set architecture" set name=info.classification value=org.opensolaris.category.2008:System/Core set name=pkg.summary value="Core Solaris Kernel" set name=variant.arch value=i386 value=sparc set name=org.opensolaris.consolidation value=osnet legacy arch=i386 category=system desc="core kernel software for a specific instruction-set architecture" hotline="Please contact your local service provider" name="Core Solaris Kernel (Root)" pkg=SUNWckr variant.arch=i386 vendor="Sun Microsystems, Inc." version=11.11,REV=2009.11.11 legacy arch=sparc category=system desc="core kernel software for a specific instruction-set architecture" hotline="Please contact your local service provider" name="Core Solaris Kernel (Root)" pkg=SUNWthisdoesnotexist variant.arch=sparc vendor="Sun Microsystems, Inc." version=11.11,REV=2009.11.11 [
"opensolaris.org",
"opensolaris.org",
"opensolaris.org"],
"""Test basic handling of repo URIs with the lint engine, reference repo is error free, cache dir torn down appropriately. "Unexpected lint errors messages reported against " "Cache dir does not exist after teardown!")
"lint image dir still existed after teardown!")
# This shouldn't appear when we're not using a reference repo "ref image dir existed!")
"Cache dir was not torn down as expected")
"""Ensure we can lint an empty repository""" "Lint messages reported from a clean reference repository.")
# this should be an empty test: we have no packages in the # lint repository, so we end up doing nothing "Lint messages reported from a empty lint repository.")
"""Package version handling during lint runs. In particular, it verifies that packages for linting are merged correctly into pkglint's view of what the ref repository would look like, were the lint package to be published to the "Expected %s failures for %s, got %s: %s" %
"Differences in reported vs. actual" " lint ids for %s: %s vs. %s" %
# this manifest should report duplicates when # linted against a 0.141 repository, but none # when linted against a 0.140 repository. The duplicates # were tested when 'deliver-old-sample1.mf' was linted # above - this time, we lint against 0.140 and expect "Unexpected lint messages when linting against old " "version of reference repo: %s" %
# ensure we detect the error when linting against the reference "No lint messages produced when linting the " "contents of an old repository")
"Expected exactly 1 lint message when linting the " "contents of an old repository, got %s" %
"Expected pkglint.dupaction001.1 message when " "linting the contents of an old repository, got " """The lint manifests in this test class should be lint-clean themselves - they should only report errors when linting against our reference repository.""" "Unexpected lint messages when linting individual " "manifests that should contain no errors: %s" %
"Read a list of filenames, return a list of Manifest objects" lines = []
# giant string of all input lines linecnts = []
# tuples of starting line no., ending line no "Problem reading manifest %s line: %s: %s " %
"Manifest %s does not declare fmri." %
filename,