Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/UpdateManager/Core/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/UpdateManager/Core/MyCache.pyc


Oc@sddlZejddeddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
ZddlmZddlmZdZdZdefd	YZd
ejjfdYZdS(iNtignoresapt API not stable yet(tgettext(tUpdateOrigins/var/lib/synaptic/preferencess>http://changelogs.ubuntu.com/changelogs/pool/%s/%s/%s/%s_%s/%stHttpsChangelogsUnsupportedErrorcBseZdZRS(s https changelogs with credentials are unsupported because of the
        lack of certitifcation validation in urllib2 which allows MITM
        attacks to steal the credentials
    (t__name__t
__module__t__doc__(((s>/usr/lib/python2.7/dist-packages/UpdateManager/Core/MyCache.pyR)stMyCachecBseZdZddZdZdZdZedZ	edZ
dZdZd	Z
d
ZeddZdZd
ZdZdZdZdZRS(tUbuntucCstjj|||t|jdks1t|jsDt|ji|_i|_	|j
jdkr|jn|j
jdkr|j
j
dkstdS(Ni(tapttCachet__init__tlentreqReinstallPkgstAssertionErrort_dpkgJournalDirtyt
_initDepCachetall_changestall_newst	_depcachetbroken_counttsaveDistUpgradet	del_count(tselftprogresstrootdir((s>/usr/lib/python2.7/dist-packages/UpdateManager/Core/MyCache.pyR4s
		
cCsVtjjtjjdd}x-tj|D]}tjd|r2t	Sq2Wt
S(s`
        test if the dpkg journal is dirty
        (similar to debSystem::CheckUpdates)
        sDir::State::statuss/updatess[0-9]+(tostpathtdirnametapt_pkgtConfigt	find_filetlistdirtretmatchtTruetFalse(Rtdtf((s>/usr/lib/python2.7/dist-packages/UpdateManager/Core/MyCache.pyRGs	cCsC|jjtjjtr2|jjtn|jjdS(N(Rtread_pinfileRRtexiststSYNAPTIC_PINFILEtinit(R((s>/usr/lib/python2.7/dist-packages/UpdateManager/Core/MyCache.pyRSs
cCs|jdS(N(R(R((s>/usr/lib/python2.7/dist-packages/UpdateManager/Core/MyCache.pytclear[scCs>tj|j}tj}|j||j|j|jS(s< get the size of the packages that are required to download (RtPackageManagerRtAcquiretget_archivest_listt_recordstfetch_needed(Rtpmtfetcher((s>/usr/lib/python2.7/dist-packages/UpdateManager/Core/MyCache.pytrequiredDownload]scCs
|jjS(N(Rt
inst_count(R((s>/usr/lib/python2.7/dist-packages/UpdateManager/Core/MyCache.pytinstallCountdscCs
|jjS(N(Rt
keep_count(R((s>/usr/lib/python2.7/dist-packages/UpdateManager/Core/MyCache.pyt	keepCountgscCsv|jjt|jj}|jjdkr;|jn|jjdkr_|jjdkset|jj|S(s@ this functions mimics a upgrade but will never remove anything i(RtupgradeR#RR+RR(RtwouldDelete((s>/usr/lib/python2.7/dist-packages/UpdateManager/Core/MyCache.pyRis
*
cCs|jj}|jj|j}|d}d}x|jD]e\}}|j|j|jfr;|j	j
j|}|r||j|jf}	|	}Pqq;q;W|r|jr|jrtt
d|jd||j|jf<||j|jf}n|jdkr|Sx|jjD]}
|rQtj|
j|jdkrQq!nx|
jD]y\}}|j|j|jfr[|j	j
j|}|r||j|jf}	|	j|jkr|	}qqq[q[Wq!W|S(s9 match 'pkg' origin against 'matcher', take versions between
            installedVersion and candidateVersion into account too
            Useful if installed pkg A v1.0 is available in both
            -updates (as v1.2) and -security (v1.1). we want to display
            it as a security update then
        sOther updates (%s)iN(NN(t_pkgtcurrent_verRtget_candidate_vertNonet	file_listthas_keytarchivetorigint_pcacheR/t
find_indexRt_t
importancetversion_listRtVersionComparetver_str(Rtpkgtmatchertinst_vertcand_vert
update_origintverFileItertindext	indexfileR"tver((s>/usr/lib/python2.7/dist-packages/UpdateManager/Core/MyCache.pytmatchPackageOrigints8
,cCs>tj|d}t|dkr:dj|d}n|S(s strip of the epoch t:it(tstringtsplitRtjoin(Rtverstrtl((s>/usr/lib/python2.7/dist-packages/UpdateManager/Core/MyCache.pyt_strip_epochscCs@||}|j}d}|jjj|jj}|j}	|j|	}
|jd}t	|dkrz|d}n|d}|j
drd|d}n|r|}
nt|||||
|f}
tj
|
}|jdkr|jdkrtd	ntj|
}d}d
tj|}xtr;|j}|dkrXPntj||}|r.|j}|rd|kr|jddd}n|jd}|rd|kr|jddd}n|r	|r+tj||dkr+Pq+q.|r.tj||dkr.Pq.n||}q6W|S(s* helper that fetches the file in question tmaint/iitlibithttpsRUsKhttps locations with username/password are notsupported to fetch changelogss^%s \((.*)\)(.*)$RT(tsourcePackageNameRCRR=R;tsectiontcandidateVersionR[RWRt
startswithtCHANGELOGS_URIturlparseturlsplittschemetusernameRturllib2turlopenR!tescapeR#treadlineR"tinstalledVersiontgroupRRH(Rtnametfnametstrict_versioningtchangelogs_uriRJtsrcpkgtsrc_sectionRatsrcver_epochtsrcverRZtprefixturitrest	changelogtalllinestregexptlineR"t	installedtchangelogver((s>/usr/lib/python2.7/dist-packages/UpdateManager/Core/MyCache.pyt_get_changelog_or_newssV
		

			cCs||}|jj}|dkr&dS|jjjd}|sEdS|jddj}d|kr|jddjd}n|jj}|j	dd}|d||fS(NtSourcet(iit)R]s/%s_%s.changelog(
t	candidateRxR>trecordtgetRWtstriptrstriptversiont
rpartition(RRoRJtdeb_uritsrcrecRsRvtbase_uri((s>/usr/lib/python2.7/dist-packages/UpdateManager/Core/MyCache.pyt+_guess_third_party_changelogs_uri_by_sources
cCs;||}|jj}|r7dtj|dddSdS(s` guess changelogs uri based on ArchiveURI by replacing .deb
            with .changelog
        s%s.changelogt.iiN(RRxRVtrsplitR>(RRoRJR((s>/usr/lib/python2.7/dist-packages/UpdateManager/Core/MyCache.pyt+_guess_third_party_changelogs_uri_by_binarys

cCs6|j||j|y|jWnnXdS(N(tget_newst
get_changelogtrelease(RRotlock((s>/usr/lib/python2.7/dist-packages/UpdateManager/Core/MyCache.pytget_news_and_changelogs

cCsHy|j|dt}Wntk
r-dSX|rD||j|<ndS(s7 get the NEWS.Debian file from the changelogs location sNEWS.DebianN(RR#t	ExceptionR(RRotnews((s>/usr/lib/python2.7/dist-packages/UpdateManager/Core/MyCache.pyR%s
cCs|j|}|j|}d}x||gD]}|r1y/|j|dt|}|j|c|7<Wqtjtfk
r}td}qt	t
jtj
fk
r}tjdtd}qXq1q1W|j|c|7<dS(NRURzsAThis update does not come from a source that supports changelogs.serror on changelog fetchingsOFailed to download the list of changes. 
Please check your Internet connection.(RRRR$RRit	HTTPErrorRREtIOErrorthttplibt
BadStatusLinetsocketterrortloggingt	exception(RRotchangelogs_uri_binarytchangelogs_uri_sourcet
error_messageRrRzte((s>/usr/lib/python2.7/dist-packages/UpdateManager/Core/MyCache.pyt(_fetch_changelog_for_third_party_package.s"
cCsQ||j}td||j||jf|j|<|jg|D]}|j^qEkrn|j|dS||j}||jj	dd}yA|j
|d}t|dkrtd||f}nWnbtj
k
r}td||f}n7ttjtjfk
r9}d	G|GHtd
}nX|j|c|7<dS(s4 get the changelog file from the changelog location sGChanges for the versions:
Installed version: %s
Available version: %s

NRTs%3ARzisThe changelog does not contain any relevant changes.

Please use http://launchpad.net/ubuntu/+source/%s/%s/+changelog
until the changes become available or try again later.sThe list of changes is not available yet.

Please use http://launchpad.net/ubuntu/+source/%s/%s/+changelog
until the changes become available or try again later.scaught exception: sOFailed to download the list of changes. 
Please check your Internet connection.(tcandidateOriginRERmRbRtCHANGELOG_ORIGINRBRR`treplaceRRRiRRRRRR(RRotoriginstoRsRuRzR((s>/usr/lib/python2.7/dist-packages/UpdateManager/Core/MyCache.pyRFs&
+%

			N(RRRR>RRRR+tpropertyR4R6R8RRSR[R$RRRRRRR(((s>/usr/lib/python2.7/dist-packages/UpdateManager/Core/MyCache.pyR0s$						0	T		
				(twarningstfilterwarningst
FutureWarningR	RRRRVRiRReRR!tDistUpgrade.DistUpgradeCachetDistUpgradeRREt
UpdateListRR)RdRRtDistUpgradeCacheR(((s>/usr/lib/python2.7/dist-packages/UpdateManager/Core/MyCache.pyt<module>s$