XRc@sgddkZddkZddkZddkZddkZddkiiZddk Zddk i Z ddk i Z ddkiiZddkiiZddkiiZddkiZddklZlZlZlZddklZdZ de!fdYZ"de!fdYZ#d e#fd YZ$d e#fd YZ%d e#fdYZ&dS(iN(t PackageInfot LicenseInfotPackageCategoryt_get_pkg_cat_data(t itemgetteri t BaseInterfacecBseZdZdZRS(sfThis class represents a base API object that is provided by the server to clients. A base API object is required when creating objects for any other interface provided by the API. This allows the server to provide a set of private object references that are needed by interfaces to provide functionality to clients. cCs||_||_||_dS(N(t_depott_requestt_pub(tselftrequesttdepottpub((s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pyt__init__7s  (t__name__t __module__t__doc__R (((s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pyR/st _InterfacecBseZdZdZRS(s;Private base class used for api interface objects. cCsZttg}||jotit|n|i|_|i|_|i|_dS(N(tsettCURRENT_API_VERSIONt api_errorstVersionExceptionRRR(R t version_idtbasetcompatible_versions((s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pyR Es     (RRRR (((s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pyRBstCatalogInterfacecBs eZdZdZdZdZeiZeiZe dZ de i dZ de i e i dZe de i e i de dZe i d Zed Zed Zed Ze eiiddde d ZedZdZedZRS(saThis class presents an interface to server catalog objects that clients may use. iiicCsLy|iii|i}Wntij otdSX|id|S(sA generator function that produces FMRIs as it iterates over the contents of the server's catalog. 'ordered' is an optional boolean value that indicates that results should sorted by stem and then by publisher and be in descending version order. If False, results will be in a ascending version order on a per-publisher, per-stem basis.tordered((Rtrepot get_catalogRtsrepotRepositoryMirrorErrortitertfmris(R Rtc((s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pyR ^s  s5.11cs:y|iii|i}Wntij odSXtg}|D]}||iqD~}td|D|i ||d|d|d|t|i g}t |i d|t i } x9| D]1} x(|i| d|D]\} } i| t } x| D]}t }x|i||d|D]}|idjoqHn|i}|d}|d}|d jo&|d jo|itinPn|d jo&|d jo|itinPqHqHW| i|t|fq WqWqWtd fd tDS(sA generator function that produces a list of tuples of the form (fmri, states) in the catalog incorporated by the named package and its dependencies and any packages that are not incorporated by the named packages or their dependencies. FMRIs are returned ordered by stem and descending version. State is a set of PKG_STATES applicable to the 'fmri'.Ncss4x-|]&}|it|tfgfVqWdS(N(tpkg_nameRt frozenset(t.0tpfmri((s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pys s t build_releasetexcludestpubsRtnametvalues pkg.renamedttrues pkg.obsoleteic3s@x9|]2}x)t|ddtD] }|Vq)WqWdS(tkeytreverseN(tsortedtTrue(R$R)tentry(tsort_vertallowed(s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pys s (RRRRRRR#t publishertdictt'_CatalogInterface__get_allowed_packagest DEPENDENCYRtnamestiterkeystfmris_by_versiont setdefaulttget_entry_actionsR)tattrstaddtpkgdefstPKG_STATE_RENAMEDtPKG_STATE_OBSOLETERR.(R tpfmrisR&R'tcatt_[1]R%R(tcat_infot remainingR"tvertflisttasettftstatestfaR<tanametavalue((R2R1s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pytgen_allowed_packagesnsZ *              % cCst|ig}x|i||d|D]}|idjoq+n|iddjoq+ntii|iddd} | i} | pq+nt } xp|i | i d|D]V\} } | i | tii pqn|i| i t}x| D]}t}x|i||d|D]}|id joq+n|i}|d }|d }|d jo&|d jo|itinPn|djo&|d jo|itinPq+q+W|i|t|f|i||d|d|d|qWqWq+WdS(NR'tdependttypet incorporatetfmriR&s5.11R(RR)R*s pkg.renamedR+s pkg.obsoleteR2(R#R6R;R)R<tpkgRRtPkgFmritversiontFalseR9R"t is_successortCONSTRAINT_AUTOR:RR=R>R?R@R5(R RBR%R2R&R'R(RDtatifmritivertrecurseRFRGRHRIRJRKR<RLRM((s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pyt__get_allowed_packagess\                cCsjy|iii|i}Wntij otdSX|id|d|d|d|d|d|S(sA generator function that produces tuples of the form: ( ( pub, - (string) the publisher of the package stem, - (string) the name of the package version - (string) the version of the package ), states, - (list) states attributes - (dict) package attributes ) Results are always sorted by stem, publisher, and then in descending version order. 'collect_attrs' is an optional boolean that indicates whether all package attributes should be collected and returned in the fifth element of the return tuple. If False, that element will be an empty dictionary. 'matched' is an optional set to add matched patterns to. 'patterns' is an optional list of FMRI wildcard strings to filter results by. 'pubs' is an optional list of publisher prefixes to restrict the results to. 'unmatched' is an optional set to add unmatched patterns to. 'return_fmris' is an optional boolean value that indicates that an FMRI object should be returned in place of the (pub, stem, ver) tuple that is normally returned.t collect_attrstmatchedtpatternsR(t unmatchedt return_fmris((RRRRRRRt gen_packages(R R^R_R`R(RaRbRB((s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pyRcs% c(0Cs|ti}|oti|ng}g}g}x~|D]v}yd} |i|} Wn+tiij o} |i |q@q@X|i | d| p|i |q@q@W|i i i |i} ttitititig} tittig} g}xs|D]k}d}}}}d}}}ti|joI|i\}}}|i}|i}|i}|iid}nd}d}}}}}d}}}} }!}"| |@olt| |d|d|\}}"}!}|!dj o4g}#|!D]\}$}%|#t|$|%q~#}!qHnttitig| B|@ot i!|}&y|i i i |}'Wn(t"i#j o} |i |qnXt$i%i&|'p|i |qn|&i'd|'ti|jo|i(|&} nti|jo|&i)d|\}}n| |@oti*|jot+|&i,d|}nti-|jot+|&i,d|}nti.|jot+|&i,d|}nti/|jot+|&i,d |}qqn|i td |d |d |!d |d|d|d|d|d|d|d|d|d| d|d|d|d|d|d|"qWh||i06||i16||i26S(sUGathers information about fmris. fmri_strings is a list of fmri_names for which information is desired. It returns a dictionary of lists. The keys for the dictionary are the constants specified in the class definition. The values are lists of PackageInfo objects or strings.is%cR'R%tpathnametlinkthardlinktfiletdirtpkg_stemtsummarytcategory_info_listRJR3RUR&tbranchtpackaging_datetsizetcsizetlicensestlinkst hardlinkstfilestdirst dependenciest descriptionN(3Rt ALL_OPTIONSRtUnrecognizedOptionsToInfotNonetget_matching_pattern_fmrisRSRRt IllegalFmritappendtextendRRRRR#tSUMMARYt CATEGORIESt DESCRIPTIONt DEPENDENCIEStACTION_OPTIONStIDENTITYttupletreleaseR&Rlt get_timestamptstrftimeRRtSIZEtLICENSEStmanifesttManifestRtRepositoryErrortostpathtexistst set_contentt_CatalogInterface__licensestget_sizetLINKStlisttgen_key_attribute_value_by_typet HARDLINKStFILEStDIRSt INFO_FOUNDt INFO_MISSINGt INFO_ILLEGALS((R t fmri_stringst info_neededR'tbad_optsR tnotfoundtillegalstpatternR%tetrepo_cattcat_optstact_optstpisRIR R)RURR&RlRmRJRqRrRsRtRuRjRoRnRpRDRvRCtschemeRBtmfsttmpath((s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pytinfos          1            cCs=y|iii|i}Wntij odSX|iS(sReturns a datetime object representing the date and time at which the catalog was last modified. Returns None if not available. N(RRRRRRRyt last_modified(R R!((s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pyRs cCs=y|iii|i}Wntij odSX|iS(s|The total number of packages in the catalog. Returns None if the catalog is not available. N(RRRRRRRyt package_count(R R!((s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pyRs cCs=y|iii|i}Wntij odSX|iS(sThe total number of package versions in the catalog. Returns None if the catalog is not available. N(RRRRRRRytpackage_version_count(R R!((s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pyRs c s^|pgS|i}|ipgSdjo dnfdfd}|pod} |oti|d} ntidi|||dd} |ii i t | gd|i } | pdS|| d| Stidi|||} |ii i t | gd|i } | pdS| dS(sSearches the catalog for actions or packages (as determined by 'return_type') matching the specified 'tokens'. 'tokens' is a string using pkg(5) query syntax. 'case_sensitive' is an optional, boolean value indicating whether matching entries must have the same case as that of the provided tokens. 'return_type' is an optional, constant value indicating the type of results to be returned. This constant value should be one provided by the pkg.server.query_parser.Query class. 'start_point' is an optional, integer value indicating how many search results should be discarded before returning any results. None is interpreted to mean 0. 'num_to_return' is an optional, integer value indicating how many search results should be returned. None means return all results. 'matching_version' is a string in the format expected by the pkg.version.MatchingVersion class that will be used to further filter the search results as they are retrieved. 'return_latest' is an optional, boolean value that will cause only the latest versions of packages to be returned. Ignored if 'return_type' is not qp.Query.RETURN_PACKAGES. ic3sd}d}x |D]}|o|joPn|dtiijo|d}n*|dtiijo|dd}n|dj o||ijoqqnoB|dtiijo+|di}||joqq|}n|d7}|jo |VqqWdS(Niii(RytqptQuerytRETURN_PACKAGEStRETURN_ACTIONSRUR"(tresultstmvertfoundt last_stemtresultR%tstem(t num_to_returnt start_pointt return_latest(s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pytfilter_resultss.       csy|i}Wntj odSX|d}ti|g|}o6|tiijo#d}t|d||S||S(NicSsL|d}|d}|i|ijot|i|idSt||S(Nii(R"tcmpRU(tresatresbRYtb((s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pyt cmp_fmriss    R(tnextt StopIterationt itertoolstchainRRRR.(RRRt return_typeR(RR(s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pytfiltered_searchs  t R N( tsplittsearch_availableRyRUtMatchingVersionRRtjoinRRtsearchtstrR( R ttokenstcase_sensitiveRRRtmatching_versionRRRtquerytres_list((RRRRs4/usr/lib/python2.6/vendor-packages/pkg/server/api.pyRs8!         cCs=y|iii|i}Wntij otSX|iS(s~Returns a Boolean value indicating whether search functionality is available for the catalog. (RRtget_pub_rstoreRRtRepositoryUnknownPublisherRVR(R trstore((s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pyR/s cCsg}x|idD]}ti}|iii|id|i}t|d}ti||dt |i }|i |i t |i|d|qW|S(sRPrivate function. Returns the license info from the manifest mfst.tlicenseR trbt ignore_hashttext(tgen_actions_by_typetStringIORRRgthashRtmisctgunzip_from_streamR/tgetvaluetcloseR|RRR(R Rt license_lsttlictstlpathtlfileR((s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pyt __licenses:s !  cCsRy|iii|i}Wntij odSXt|do|iSdS(sgReturns the version of the catalog or None if no catalog is available. RUiN( RRRRRRRythasattrRU(R R!((s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pyRUIsN(RRRRRRR>R@R?RVR RtEmptyIRNR5RyRcRtpropertyRRRRRRRRRRU(((s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pyROs.   E3 ,y    } tConfigInterfacecBseZdZedZedZedZedZedZedZ edZ edZ ed Z ed Z d Zd Zd ZdZRS(sThis class presents a read-only interface to configuration information and statistics about the depot that clients may use. cCs |iiiS(sThe number of /catalog operation requests that have occurred during the current server session. (RRtcatalog_requests(R ((s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pyR^scCs |iiS(sqThe file system path where the server's content and web directories are located. (Rt content_root(R ((s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pyRescCs |iiiS(s}The number of /file operation requests that have occurred during the current server session. (RRt file_requests(R ((s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pyRlscCs |iiS(sThe number of /filelist operation requests that have occurred during the current server session. (Rtflist_requests(R ((s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pytfilelist_requestssscCs |iiS(sThe number of files served by /filelist operations requested during the current server session. (Rtflist_file_requests(R ((s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pytfilelist_file_requestszscCs |iiiS(sHThe number of package transactions awaiting completion. (RRtin_flight_transactions(R ((s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pyRscCs |iiiS(sThe number of /manifest operation requests that have occurred during the current server session. (RRtmanifest_requests(R ((s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pyRscCs |iiiS(suA Boolean value indicating whether the server is currently operating in mirror mode. (RRtmirror(R ((s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pyRscCs |iiiS(swA Boolean value indicating whether the server is currently operating in readonly mode. (RRt read_only(R ((s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pytreadonlyscCs |iiS(s`The file system path where the server's web content is located. (Rtweb_root(R ((s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pyRscCsXh}xK|iiiiD]1\}}g}|D] }||q6~||tpkg.fmrit pkg.manifestRtpkg.miscRtpkg.server.api_errorstserverRtpkg.server.repositoryt repositoryRtpkg.server.query_parsert query_parserRt pkg.versionRUtpkg.api_commonRRRRtoperatorRRtobjectRRRRR(((s4/usr/lib/python2.6/vendor-packages/pkg/server/api.pyts,      "  y