ó –­PSc@sdZddlZddlZddlZddlZddlZddlmZddlm Z dej fd„ƒYZ dS(s“module describing a (hard) link packaging object This module contains the HardLinkAction class, which represents a hardlink-type packaging object.iÿÿÿÿN(tmisc(tActionExecutionErrortHardLinkActioncBsBeZdZgZdZejeZd„Zd„Z d„Z RS(s4Class representing a hardlink-type packaging object.thardlinkcCsx|jd}|ddkr^|jd}tjjtjjtjj|ƒd|ƒƒ}ntjj|ƒd}|S(s3 return a path for target that is relative to imagettargetit/tpathi(tattrstosRtnormpathtjointsplit(tselfRR((s:/usr/lib/python2.7/vendor-packages/pkg/actions/hardlink.pytget_target_path1s   +cCsf|jƒ}|j|jjƒƒ}|j||ƒtjjtjj|ƒƒs€|j tjj|ƒdt j d|j ƒn"tjj|ƒr¢|j |ƒntjjtjjj|jjƒ|fƒƒ}ytj||ƒWnytk ra}|jtjkrt|d|ƒ‚ntdƒi|d6|d6}t|d|d|d|j ƒ‚nXdS( s-Client-side method that installs a hard link.tmodetfmriterrorsBUnable to create hard link %(path)s; target %(target)s is missing.RRtdetailsN(R tget_installed_pathtimagetget_roottfsobj_checkpathRRtexiststdirnametmakedirsRt PKG_DIR_MODEtdestination_fmritremoveR tsepR tlinktEnvironmentErrorterrnotENOENTRt_(R tpkgplantorigRRt fulltargetteterr_txt((s:/usr/lib/python2.7/vendor-packages/pkg/actions/hardlink.pytinstallCs*    c KsY|j|tjƒ\}}}}}|rC|s6t‚|||fS|jƒ}|j|jƒƒ} tjj tjj j |jƒ|fƒƒ}tjj |ƒsÄ|j tdƒ|jdƒn|r×|||fSyHtj| ƒjtj|ƒjkr|j tdƒ|jƒƒnWn*tk rK} |j tdƒ| ƒnX|||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.sTarget '%s' does not existRs0Broken: Path and Target (%s) inodes not the samesUnexpected Error: %s(tverify_fsobj_commontstattS_IFREGtAssertionErrorR RRRRR RR RtappendR!Rtst_inotOSError( R timgtargstlstatterrorstwarningstinfotabortRRR%((s:/usr/lib/python2.7/vendor-packages/pkg/actions/hardlink.pytverifyfs( $    $( t__name__t __module__t__doc__t __slots__tnametgenerict _orderdictt ordinalityR R'R6(((s:/usr/lib/python2.7/vendor-packages/pkg/actions/hardlink.pyR)s   #( R9RR<RRR)tpkgRtpkg.client.api_errorsRt LinkActionR(((s:/usr/lib/python2.7/vendor-packages/pkg/actions/hardlink.pyts