ó k~NOc@sodZddlZddlZddlZddlZddlZddlmZdejfd„ƒYZ dS(smodule describing a legacy packaging object This module contains the LegacyAction class, which represents a legacy SVr4 package. On installation, this action will lay down file with sufficient data to fool the SVr4 packaging tools into thinking that package is installed, albeit empty.iÿÿÿÿN(tmisct LegacyActionc BseZdZgZdZdZdZeZeZ e j eZ d „Z d„Zd„Zd„Zd„Zd„Zdd„ZRS(s2Class representing a legacy SVr4 packaging object.tlegacytpkgtcategorytdescthotlinetnametvendortversiontbasedirtpkginsttpstampt sunw_prodverscCs)tjjtjjd|jdƒƒgS(Ns var/sadm/pkgR(tostpathtnormpathtjointattrs(tself((s8/usr/lib/python2.7/vendor-packages/pkg/actions/legacy.pytdirectory_references7sc Cs>tjj|jjƒd|jdƒ}tjj|ƒsPtj|tj ƒntjj|dƒ}|j ||ƒ|j }t |ƒdkr|d }ni |jj ƒd6dd6dd 6dd 6dd 6|d 6|jdd6|jdd 6dd6dd6dd6t|jjƒd6}g|D]A}|jj|||ƒfD]}|rA|jƒ|f^qAq!} | jdtjdƒfƒt|dƒ5} x+| D]#\} } | jd| | fƒqWWdQXy/ttjj|jjƒdƒdƒjƒWn+tk r&} | jtjkr'‚q'nXtj|tjƒdS(sšClient-side method that installs the dummy package files. Use per-pkg hardlinks to create reference count for pkginfo files var/sadm/pkgRtpkginfoitarcht/R tsystemRRRRR R R RR tINSTDATEs%b %d %Y %H:%Mtwbs%s=%s Nsvar/sadm/install/contentsta( RRRtimagetget_rootRtisdirtmakedirsRt PKG_DIR_MODEt#_LegacyAction__old_refcount_cleanupt pkg_summarytlentget_archtNonetstrtdestination_fmriR tgettuppertappendttimetstrftimetopentwritetfiletclosetIOErrorterrnotENOENTtchmodt PKG_FILE_MODE(RtpkgplantorigtpkgdirRR"t svr4attrsRtbRtpfiletktvte((s8/usr/lib/python2.7/vendor-packages/pkg/actions/legacy.pytinstall;sL    ! ! cCswxptjdƒD]_}tjj|d|ƒ}ytj|ƒWqtk rn}|jtjkrhPn‚qXqWdS(s9Clean up the turds of the old refcounting implementation.is pkginfo.%dN( t itertoolstcountRRRtunlinktOSErrorR2R3(RRR8titlfileR>((s8/usr/lib/python2.7/vendor-packages/pkg/actions/legacy.pyt__old_refcount_cleanup{scKsÃg}g}g}tjj|jƒd|jdƒ}tjj|ƒst|jtdƒ|jdƒ|||fStjjtjj|dƒƒs¶|jtdƒ|jdƒn|||fS(s»Returns a tuple of lists of the form (errors, warnings, info). The error list will be empty if the action has been correctly installed in the given image.s var/sadm/pkgRs!Missing directory var/sadm/pkg/%sRs$Missing file var/sadm/pkg/%s/pkginfo( RRRRRRR*t_tisfile(RtimgtargsterrorstwarningstinfoR8((s8/usr/lib/python2.7/vendor-packages/pkg/actions/legacy.pytverify‰s !cCstjj|jjƒd|jdƒ}tjj|dƒ}|j||ƒytj|ƒWn+tk r‹}|j t j krŒ‚qŒnXdS(Ns var/sadm/pkgRR( RRRRRRR!RBRCR2R3(RR6R8RR>((s8/usr/lib/python2.7/vendor-packages/pkg/actions/legacy.pytremove¡scCs0dd|jddfdd|jddfgS(swGenerates the indices needed by the search dictionary. See generic.py for a more detailed explanation.Rt legacy_pkgRN(RR%(R((s8/usr/lib/python2.7/vendor-packages/pkg/actions/legacy.pytgenerate_indices²sc Cs tjj|d|dd ƒd S( s9Performs additional validation of action attributes that for performance or other reasons cannot or should not be done during Action object creation. An ActionError exception (or subclass of) will be raised if any attributes are not valid. This is primarily intended for use during publication or during error handling to provide additional diagonostics. 'fmri' is an optional package FMRI (object or string) indicating what package contained this action.tfmrit single_attrsRRRRRR N(scategorysdescshotlinesnamesvendorsversion(tgenerictActiont _validate(RRR((s8/usr/lib/python2.7/vendor-packages/pkg/actions/legacy.pytvalidate»s ( scategorysdescshotlinesnamespkgsvendorsversionsbasedirspkginstspstamps sunw_prodversN(t__name__t __module__t__doc__t __slots__Rtkey_attrt unique_attrstTruet refcountabletglobally_identicalRTt _orderdictt ordinalityRR?R!RNRORQR%RW(((s8/usr/lib/python2.7/vendor-packages/pkg/actions/legacy.pyR*s    @    ( RZRR2R@R+RTRRRUR(((s8/usr/lib/python2.7/vendor-packages/pkg/actions/legacy.pyt s