ó ®XRc@sfddlmZddljZddljjZddlZddl Z dej fd„ƒYZ dS(iÿÿÿÿ(tlint_fmri_successorNtPkgManifestCheckercBsdeZdZdZd„Zd„Zdd„Zedƒe_dd„Z ed ƒe _d d „Z ed ƒe _d d„Z edƒe _dd„Z edƒe _dd„Z edƒe _dd„Zedƒe_dd„Zedƒe_d„Zdd„Zedƒe_d d!„Zed"ƒe_d#d$„Zed%ƒe_ed&„ZRS('sA class to check manifests.spkglint.manifestcCsMtdƒ|_i|_i|_g|_i|_tt|ƒj|ƒdS(Ns8Checks for errors within the scope of a single manifest.( t_t descriptiont ref_lastnamestlint_lastnamestprocessed_lastnamest dependenciestsuperRt__init__(tselftconfig((s?/usr/lib/python2.7/vendor-packages/pkg/lint/pkglint_manifest.pyR (s     cCs*d„}d„}|jjtdƒƒxC|j|jd|jƒD]&}|||jƒ|||jƒqDW|jjtdƒƒxL|j|jd|jd|j ƒD]&}|||jƒ|||j ƒq©Wx1|j D]&}|||jƒ|||j ƒqÝW|j |j |jd|j ƒdS(NcSsnd|ksd|krdStjj|jjƒƒ}||krZ||j|jƒn|jg||qn|j |ƒqqWxa|jD]V\}}|jd| d|d | ƒs\| |ƒr˜q\n|j d ||fƒq\q\Wq€Wt|ƒdkrtd„|Dƒƒ}|jtdƒidj|ƒd6|jd6d|ƒnt|ƒdkr~td„|Dƒƒ}|jtdƒidj|ƒd6|jd6d| ƒn|rÌd|krÌ|jd|d | ƒ rÌ|jtdƒ|jd| ƒndS(s§Checks for correct use of variant tags. * if variant tags present, matching variant descriptions exist and are correctly specified, with the exception of variant.debug.* variants * All manifests that deliver file actions of a given architecture declare variant.arch These checks are only performed on published packages.Ns%s%s.1s%s%s.2s%s%s.3cSs |jdƒS(s)check whether we can ignore this variant.s variant.debug(t startswith(tvarname((s?/usr/lib/python2.7/vendor-packages/pkg/lint/pkglint_manifest.pytignore_variant+sR#Rtfiles pkg.filetypetelftelfarchR:s%s=%sicss|] }|VqdS(N((t.0tv((s?/usr/lib/python2.7/vendor-packages/pkg/lint/pkglint_manifest.pys Jss*variant(s) %(vars)s not defined by %(pkg)sR>tvarsR7R9css|] }|VqdS(N((RjRk((s?/usr/lib/python2.7/vendor-packages/pkg/lint/pkglint_manifest.pys QssGvariant(s) %(vars)s not in list of known values for variants in %(pkg)ss variant.archsvariant.arch not declared in %s(t do_pub_checksR;RCtget_all_variantsRRERFRRRGtget_variant_templatet differencet type_diffsRKt value_diffstlentsortedRBRRMR(R RR2RNtunknown_variantstundefined_variantst has_arch_filetpkg_varstundefined_lint_idtunknown_lint_idtmissing_arch_lint_idRfR#tvcttdifftkRktvlist((s?/usr/lib/python2.7/vendor-packages/pkg/lint/pkglint_manifest.pytvariantss`           " s*Variants used by packages should be valid.t004cCstjj|jjƒƒ}||jkr.dS||jkrAdS|j|}|j|kradSt|j|ƒdkrÔtd„|Dƒƒ}|j t dƒi|d6dj |ƒd6dd |j |fƒn|j d |d d |j |fƒs |jj|ƒndS( s„Warn when there's a namespace clash where the last component of the pkg name matches an existing one in the catalog.Nicss|]}|jƒVqdS(N(tget_fmri(RjR%((s?/usr/lib/python2.7/vendor-packages/pkg/lint/pkglint_manifest.pys sssDlast name component %(name)s in package name clashes across %(pkgs)sRR>tpkgsR9s%s%sRR:(R R RRRRRRsRtRLRRMRRFR(R RR2RNtlastnametfmristplist((s?/usr/lib/python2.7/vendor-packages/pkg/lint/pkglint_manifest.pytnaming_s$   s1Packages are encouraged to use unique leaf names.t005cCs+i}g}tdƒ}g}xE|jdƒD]4}d|jdkrMq.nd|jkr¶d|j|f}|jd|d|d |ƒs.|jtd ƒ|jd |ƒq.q.nd |j|f}|jd|d|d |ƒríq.n|jd} t| tƒr| g} nxJ| D]B} tj | ƒ} | |krM|g|| ´sR7R>tactionsN(RRRRRFtcriticalRRRtextract_pkg_nameRRstconflicting_variantsRnRtRBRM(R RR2RNt seen_depst duplicatestdup_msgR#R:R?R$t shortnameR8R‰t conflict_varstconflict_actionstdlist((s?/usr/lib/python2.7/vendor-packages/pkg/lint/pkglint_manifest.pytduplicate_deps‚sT              s4Packages should not have duplicate 'depend' actions.t006cCsvi}tdƒ}g}d|j|f}x|jdƒD]}d|j|f}|jd|d|d|ƒrxq;n|jd|kr¢|g||jd×sR>tnamesR7R9N( RRRRFRRRsRŒRnRtRBRMR(R RR2RNt seen_setst dup_set_msgRŽR:R#R8R‰R‘R’R“((s?/usr/lib/python2.7/vendor-packages/pkg/lint/pkglint_manifest.pytduplicate_sets½s2      s1Packages should not have duplicate 'set' actions.t007c Cs¾gt|jjƒƒD](}|jdƒr||j|f^q}|rº|jtdƒi|jd6djg|D]\}}d||f^qsƒd6dd|j|fd t ƒnd S( sqLogs an INFO message with the key/value pairs of all pkg.linted* attributes set on this manifest.s pkg.linteds6pkg.linted attributes detected for %(pkg)s: %(linted)sR7s, s%s=%sRFR9s%s%st ignore_lintedN( Rtt attributestkeysRdtinfoRRRMRRG(R RR2RNR8t linted_attrstval((s?/usr/lib/python2.7/vendor-packages/pkg/lint/pkglint_manifest.pyRFàs(  .s*Show manifests with pkg.linted attributes.t008cCsÙd|ks|jrdS|j s3|jjƒ rm|jtdƒ|jdd|j|fƒt|_dS|jd|ƒ}|j d|d|ƒx=|j dƒD],}|j |||j d |j|fƒq¥WdS( s7Checks that the info.classification attribute is valid.sinfo.classificationNsGUnable to perform manifest checks for info.classification attribute: %sR9s%s%s.1R#Rtvalues%s%s( tskip_classification_checktclassification_datatsectionsRBRtbad_classification_dataRRGR@RAtattrlistt _check_info_classification_valueR(R RR2RNR#titem((s?/usr/lib/python2.7/vendor-packages/pkg/lint/pkglint_manifest.pytinfo_classificationòs      s.info.classification attribute should be valid.cCsd}||kr:|jtdƒtƒdd|ƒdS|j|dƒ}|jddƒ}t|ƒdkr˜|jtd ƒtƒdd |ƒdS|\}} t} g} y7|jj|d ƒjd ƒ} | | kræt } nWn¶t j k rR|jj ƒ} |jtd ƒi|d6dj t| ƒƒd6|d6dd|ƒdSt jk rŸ|jtdƒi|jd6|d6|d6dd|ƒdSX| rªdS|jj|d ƒ} |jtdƒi|d6|d6|jd6| d6dd|ƒdS(Nsorg.opensolaris.category.2008:sHinfo.classification attribute does not contain '%(prefix)s' for %(fmri)sR9s%s.2tt/iis^info.classification value %(value)s does not match %(prefix)s
/ for %(fmri)ss%s.3tcategoryt,sminfo.classification value %(value)s does not contain one of the valid sections %(ref_sections)s for %(fmri)s.R¢s, t ref_sectionsRs%s.4szInvalid info.classification value for %(fmri)s: data file %(file)s does not have a 'category' key for section %(section)s.Rgtsections%s.5sŒinfo.classification attribute in %(fmri)s does not contain one of the values defined for the section %(section)s: %(ref_cats)s from %(path)sR tref_catss%s.6(RBRtlocalstreplacetsplitRsRGR¤RRCt ConfigParsertNoSectionErrorR¥RMRtt NoOptionErrortclassification_path(R R2R¢RR9tprefixtclassificationt componentsR°R­t valid_valuetref_categoriesR¥R±((s?/usr/lib/python2.7/vendor-packages/pkg/lint/pkglint_manifest.pyR¨ sV              t009cCsZ|jdd ƒ}|jdd ƒ}|dkrˆ|jd|ƒ}|jd|d|ƒ|jtdƒ|jdd|j|fƒn|dkrì|jd|ƒ}|jd|d|ƒ|jtd ƒ|jdd |j|fƒn||krV|rV|jd|ƒ}|jd|d|ƒ|jtd ƒ|jdd |j|fƒnd S(s}Warns when a package has an empty summary or description, or a description which is identical to the summary.spkg.descriptions pkg.summaryR«R#RsEmpty pkg.description in %sR9s%s%s.1sEmpty pkg.summary in %ss%s%s.3s)pkg.description matches pkg.summary in %ss%s%s.2N(RRDR@RARLRRR(R RR2RNtdesctsummR#((s?/usr/lib/python2.7/vendor-packages/pkg/lint/pkglint_manifest.pytbogus_descriptionPs,         s5A package's description should not match its summary.t010cCs`d|krdSd|kr dSd|kr\|jtdƒ|jdd|j|fƒndS(sçVarious checks for missing attributes * error when a package doesn't have a pkg.summary (pkg.fmri should be present too, but that would get caught before we get here) s pkg.renamedNs pkg.obsoletes pkg.summarys%Missing attribute 'pkg.summary' in %sR9s%s%s.2(RBRRR(R RR2RN((s?/usr/lib/python2.7/vendor-packages/pkg/lint/pkglint_manifest.pyt missing_attrsqs     s.Standard package attributes should be present.t011cCsëg}x€|jdƒD]o}d|jkr2tn|jd}|jdƒsTqn|jdƒpo|jdƒsxqn|j|ƒqW|s“dSd|kr£dS|jtdƒid j|ƒd 6|j d 6d d |j |fƒdS(sbIf we deliver files to lib/svc/manifest or var/svc/manifest, we should include an org.opensolaris.smf.fmri attribute in the manifest. This only reports a warning, because without pkglint content-checking support, we do not know whether the file actually contains any services or instances.RgR s.xmlslib/svc/manifestsvar/svc/manifestNsorg.opensolaris.smf.fmrisSMF manifests were delivered by %(pkg)s, but no org.opensolaris.smf.fmri attribute was found. Manifests found were: %(manifests)sR>t manifestsR7R9s%s%s( RRtcontinetendswithRdRRLRRMRR(R RR2RNt smf_manifestsR#R ((s?/usr/lib/python2.7/vendor-packages/pkg/lint/pkglint_manifest.pytmissing_smf_fmri†s(   sQPackages delivering SMF services should have org.opensolaris.smf.fmri attributes.c sx†|D]~}||kr-|||| R  J I   8       D     % ( tpkg.lint.engineRtpkg.fmriRt pkg.lint.basetlintR\tos.pathR RµtManifestCheckerR(((s?/usr/lib/python2.7/vendor-packages/pkg/lint/pkglint_manifest.pyts