ó ¦TµKc@s«ddlZddlZddlZddlZddljjZddljZddl j Z ddl j j Z defd„ƒYZdefd„ƒYZejZdS(iÿÿÿÿNtUpdateLogExceptioncBseZdd„ZRS(cCs ||_dS(N(t_args(tselftargs((s3/usr/lib/python2.7/vendor-packages/pkg/updatelog.pyt__init__%sN(t__name__t __module__tNoneR(((s3/usr/lib/python2.7/vendor-packages/pkg/updatelog.pyR$st UpdateLogcBs,eZdZed„ƒZed„ƒZRS(sCompatibility class for receiving incremental catalog updates from v0 repositories. The catalog format is a + or -, an isoformat timestamp, and a catalog entry in server-side format. They must be in order and separated by spaces.cCs¹|jddƒ}y<|dkr7tj|||ƒntjj|||ƒWndtk r´}|jtjkr‡t j |j ƒ‚n|jtj kr®t j |j ƒ‚n‚nXdS(s~Take a connection object and a catalog path. This method receives a catalog from the server. If it is an incremental update, it is processed by the updatelog. If it is a full update, we call the catalog to handle the request. Ts is the timestamp when the local copy of the catalog was last modified.sX-Catalog-Typetfullt incrementalN(t getheaderRt _recv_updatestcatalogt ServerCatalogtrecvtEnvironmentErrorterrnotEACCESt api_errorstPermissionsExceptiontfilenametEROFStReadOnlyFileSystemException(tctpathttstpubt update_typete((s3/usr/lib/python2.7/vendor-packages/pkg/updatelog.pyR0s  cCs1tjj|ƒs"tj|ƒntj|ƒ}|}|}d}d}g}g}d} i} x|D]‡} | jddƒ} t| ƒdkr˜qhqh| dtj krtj| dƒ} | |krï| |krå|}| }nd| d| df}|j |ƒqïqh| ddkrhtj| dƒ} | |krï| |krZ|}| }n| dt dƒkrìyt j | dƒ}Wn%t jk r®}|} |}qhnXd | dd |j|jf}|j |ƒ|d7}qìqïqhqhW| r| ‚ntjjtjj|d ƒƒ}tjd |ƒ\}}tj|d ƒ}yt|dƒ}Wndtk rÆ}|jtjkr©t|dƒjƒt|dƒ}qÇ|jƒtj|ƒ‚nX|jdƒx{|D]s}|dt dƒkr|d7}n||krA|jƒ|jƒtj|ƒtd|‚n|j|ƒqÛW|jdtj ƒ|j!|ƒt|ƒdkr”|j!|ƒn|jƒ|jƒtj"|tj#j$ƒtj%||ƒttjjtjj|dƒƒdƒ}t&j'dƒ}xH|D]@}|j(|ƒ}|dkr|j)dƒ| |j)dƒs    ¶