+
    di4J                     L   ^ RI t ] P                  ! RR]4       ^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RI	H
t
 ^ RIHt ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIHt  ^ R	IHt R
tRt]R,           t ! R R]4      t ! R R]P<                  P>                  4      tR#   ] d    Rt LDi ; i)    Nignorezapt API not stable yet)	HTTPError)urlopen)urlsplit)BadStatusLine)gettext)	Launchpadz/var/lib/synaptic/preferencesz.https://changelogs.ubuntu.com/changelogs/pool/z%s/%s/%s/%s_%s/%sc                       ] tR t^3tRtRtR# )HttpsChangelogsUnsupportedErrorzhttps changelogs with credentials are unsupported because of the
lack of certitifcation validation in urllib2 which allows MITM
attacks to steal the credentials
 N)__name__
__module____qualname____firstlineno____doc____static_attributes__r       </usr/lib/python3/dist-packages/UpdateManager/Core/MyCache.pyr   r   3   s    
 	r   r   c                      a  ] tR t^<t o RtRR ltR tR tR t]	R 4       t
]	R 4       tR	 t]	R
 4       tR tR tR tR tRR ltR tR tR tRR ltR tR tR tR tRtV tR# )MyCacheUbuntuNc                @   \         P                  P                  WV4       W n        \	        V P
                  4      ^ 8X  g   Q hV P                  4       '       d   Q hV P                  4        / V n        / V n	        / V n
        V P                  P                  ^ 8  d   V P                  4        V P                  P                  ^ 8X  d   V P                  P                  ^ 8X  g   Q hRV n        \         P"                  P%                  R4      pV'       d   \&        P(                  ! RRP+                  V Uu. uF  pRV,           NK  	  up4      ,           R,           4      V n        \.        P0                  ! RR.R	R
7      P3                  4       p\&        P(                  ! RRP+                  V Uu. uF9  pVP5                  R4      '       g   RV,           R,           V,           MWT,           NK;  	  up4      ,           R,           4      V n        R# RV n        RV n        R# u upi u upi )r   NzAPT::VersionedKernelPackages(|^)unamez-rT)universal_newlinesz.*)aptCache__init__rootdirlenreq_reinstall_pkgs_dpkgJournalDirty_initDepCacheall_changesall_newspro_versions	_depcachebroken_countsaveDistUpgrade	del_count	launchpadapt_pkgconfig
value_listrecompilejoinversioned_kernel_pkgs_regexp
subprocesscheck_outputrstrip
startswithrunning_kernel_pkgs_regexp)selfprogressr"   apt_versioned_kernel_pkgsprunning_kernel_versions   &&&   r   r!   MyCache.__init__@   s   		473 4**+q000 ))++++>>&&*  "NN''1,1I1IQ1N	
N$+NN$=$=*%
! %02

((-FG-FC!GG-FGHI1D-
 &0%<%<$D&fh # /1jj((
 ";	 ";A  !||D11 q4*@@48: ";	 	/D+ 15D-.2D+) Hs   1H(H#Hc                   \         P                  P                  \        P                  P                  R4      4      R,           p\         P                  ! V4       F#  p\        P                  ! RV4      '       g   K"   R# 	  R# )zH
test if the dpkg journal is dirty
(similar to debSystem::CheckUpdates)
zDir::State::statusz/updatesz[0-9]+TF)	ospathdirnamer/   r0   	find_filelistdirr2   match)r;   dfs   &  r   r%   MyCache._dpkgJournalDirtyt   s^     GGOOGNN445IJK 	
 AAxx!$$  r   c                    V P                   P                  4        \        P                  P	                  \
        4      '       d    V P                   P                  \
        4       V P                   P                  4        R # N)r*   read_pinfilerB   rC   existsSYNAPTIC_PINFILEinitr;   s   &r   r&   MyCache._initDepCache   sK     	##%77>>*++NN''(89r   c                &    V P                  4        R # rL   )r&   rQ   s   &r   clearMyCache.clear   s    r   c                    \         P                  ! V P                  4      p\         P                  ! 4       pVP	                  W P
                  V P                  4       VP                  # )z:get the size of the packages that are required to download)r/   PackageManagerr*   Acquireget_archives_list_recordsfetch_needed)r;   pmfetchers   &  r   required_downloadMyCache.required_download   sF     ##DNN3//#
T]];###r   c                .    V P                   P                  # rL   )r*   
inst_countrQ   s   &r   install_countMyCache.install_count   s    ~~(((r   c                .    V P                   P                  # rL   )r*   
keep_countrQ   s   &r   rf   MyCache.keep_count   s    ~~(((r   c                .    V P                   P                  # rL   )r*   r-   rQ   s   &r   r-   MyCache.del_count   s    ~~'''r   c                "   V F  pV'       g   K  RpV Fh  pVP                   VP                  P                  8w  g?   \        P                  ! VP
                  VP                  VP
                  4      '       d   Kf  RpKj  	  V'       g   K   R# 	  R# )z<Return True if any of the dependencies in deps match target.TF)namepackage	shortnamer/   	check_depversionrelation)r;   targetdepsdep_orrG   base_deps   &&&   r   _check_dependenciesMyCache._check_dependencies   sy     FE"MMV^^%=%==",,(9(98;K;K  "E # u  r   c                   VP                   pV'       g   R # V  F  pVP                  pVf   K  V P                  W$P                  R4      4      '       g   K=  V P                  W$P                  R4      4      '       g   Ke  \        P
                  ! VP                  P                  : RVP                  : R24        R# 	  R # )F	ConflictsReplacesz Conflicts/Replaces z; allowing removalT)	installed	candidateru   get_dependencieslogginginforl   rm   )r;   pkgrq   cpkgr{   s   &&   r   find_removal_justification"MyCache.find_removal_justification   s    DI$++66{C ..66zB  LL$,,66G    r   c                P   V P                   P                  R4       V P                   P                  pV^ 8  db   V  Uu. uF  q"P                  '       g   K  VNK  	  ppV\	        V4      8X  g   Q hV F%  pV P                  V4      '       g   K  V^,          pK'  	  V^ 8  dJ   V P                  4        V P                   P                  ^ 8X  d   V P                   P                  ^ 8X  g   Q hMV P                   P                  ^ 8X  g   Q hV P                   P                  4        V# u upi )z>this functions mimics a upgrade but will never remove anythingT)r*   upgrader-   marked_deleter#   r   rT   r+   )r;   wouldDeleter   deleted_pkgss   &   r   r,   MyCache.saveDistUpgrade   s     	t$nn..?+/E4C3D3DCC4LE#l"3333#223771$K $ ?JJL++q0NN,,121 >>..!333  Fs   D#D#c                x    VP                  R4      p\        V4      ^8  d   RP                  VR,          4      pV# )zstrip of the epoch: :   NN)splitr#   r4   )r;   verstrvers_no_epochs   && r   _strip_epochMyCache._strip_epoch   s5    S)}!WW]2./Fr   c                   W,          pVP                   P                  pRpVP                  P                  P	                  VP
                  4      P                  pVP                   P                  p	V P                  V	4      p
VP                  R4      p\        V4      ^8  d
   V^ ,          pV^ ,          pVP                  R4      '       d   RV^,          ,           pV'       d   TpM\        VVVVV
V3,          p\        V4      pVP                  R8X  d   VP                  '       d   \!        R4      h\#        V4      pRpR\$        P&                  ! V4      ,          p VP)                  4       P+                  RR	4      pVR8X  d    V# \$        P,                  ! VV4      pV'       d   \/        VP0                  R
R4      pV'       d!   RV9   d   VP                  R^4      ^,          pVP3                  ^4      pV'       d!   RV9   d   VP                  R^4      ^,          pV'       d)   V'       d    \4        P6                  ! VV4      ^ 8  d    V# M'V'       d    \4        P6                  ! VV4      ^ 8X  d    V# VV,           pEK%  )z(helper that fetches the file in questionmain/libhttpszKhttps locations with username/password are notsupported to fetch changelogsr   z^%s \((.*)\)(.*)$zUTF-8replacero   Nr   )r{   source_name_pcacher*   get_candidate_ver_pkgsectionsource_versionr   r   r#   r9   CHANGELOGS_URIr   schemeusernamer   r   r2   escapereadlinedecoderG   getattrrz   groupr/   version_compare)r;   rk   fnamestrict_versioningchangelogs_urir   srcpkgsrc_sectionr   srcver_epochsrcversplit_sectionprefixurires	changelogalllinesregexplinerG   rz   changelogvers   &&&&&                 r   _get_changelog_or_newsMyCache._get_changelog_or_news   s>   
 j ** ++''99#((CKK }}33""<0c*}!'*K U##VAY&F
  C $ C sm:: S\\\10  CL	 &"))F*;<%%'..w	BDrzB A HHVT*E $CMM9dC		!1 )Q 7 :I${{1~C<$7#/#5#5c1#=a#@L %!#33L)L   "#33L)L   $Hr   c                "   \         '       g   \        P                  ! R4       R# W,          P                  pVP                   F]  p\        V4      P                  R9  d   K  \        P                  ! RV4      pVf   K<  VP                  ^4      VP                  ^4      re M	  \        P                  ! R4       R# V P                  f   \         P                  ! RRRR7      V n        V P                  P                  P                  R	V: R
V: 2R7      pVf   \        P                  ! R4       R# VP                  VP                   RVP"                  R7      pV'       g   \        P                  ! R4       R# V^ ,          P%                  4       # )zRReturn the changelog URI from the Launchpad API

Return None in case of an error.
z9Launchpadlib not available, cannot retrieve PPA changelogNzhttp.*/(.*)/(.*)/ubuntu/.*z)Unable to find a valid PPA candidate URL.zupdate-manager
productiondevel)ro   ~z/ubuntu/)	referencez6Unable to retrieve the archive from the Launchpad API.T)r   exact_matchro   z;No published sources were retrieved from the Launchpad API.)zppa.launchpad.netzppa.launchpadcontent.net)r	   r}   warningr{   urisr   hostnamer2   searchr   errorr.   login_anonymouslyarchivesgetByReferencegetPublishedSourcesr   r   changelogUrl)	r;   rk   cdtr   rG   userppaarchivespphss	   &&       r   _extract_ppa_changelog_uri"MyCache._extract_ppa_changelog_uriH  sV   
 yOOK j""88C}%% .  II:C@E !KKNEKKNc  MMEF >>!&88 ,DN ..))88)-s3 9 
 ?MMH ++&& , 

 MM! Qx$$&&r   c                   W,          pVP                   P                  pVf   R # VP                   P                  P                  R4      pV'       g   R # VP	                  R4      ^ ,          P                  4       pRV9   d)   VP	                  R4      ^,          P                  R4      pMVP                   P                  pVP                  R4      ^ ,          pVRV: RV: R2,           # )NSourcer   r   r   _z
.changelog)	r{   r   recordgetr   stripr8   r   
rpartition)r;   rk   r   deb_urisrcrecr   r   base_uris   &&      r   +_guess_third_party_changelogs_uri_by_source3MyCache._guess_third_party_changelogs_uri_by_source  s    j--##?%%))(3c"1%++-&=\\#&q)005F]]11F%%c*1-???r   c                    W,          pVP                   P                  pV'       d!   RVP                  R^4      ^ ,          ,          # R# )zKguess changelogs uri based on ArchiveURI by replacing .deb
with .changelog
z%s.changelog.N)r{   r   rsplit)r;   rk   r   r   s   &&  r   +_guess_third_party_changelogs_uri_by_binary3MyCache._guess_third_party_changelogs_uri_by_binary  s;     j--##!GNN3$:1$===r   c                n    V P                  V4       V P                  V4       V'       d   V! V4       R # R # rL   )get_newsget_changelog)r;   rk   cbcb_argss   &&&&r   get_news_and_changelogMyCache.get_news_and_changelog  s+    d4 wK r   c                     V P                  VRR4      pT'       d   Y P                  T&   R# R#   \         d     R# i ; i)z5get the NEWS.Debian file from the changelogs locationzNEWS.DebianTN)r   	Exceptionr(   )r;   rk   newss   && r   r   MyCache.get_news  sE    	..t]DID "&MM$   		s   / >>c                   R pV F8  pVP                   P                  R4      '       g   K&   V P                  V4      p M	  V P                  V4      pV P                  V4      pRpVVV3 FA  pV'       g   K   V P                  VRRV4      p	V P                  V;;,          V	,          uu&   KC  	  V P                  V;;,          V,          uu&   R #   \         d    \        P
                  ! R4        K  i ; i  \        \        3 d    \        R4      p K  \        \        \        P                   3 d&    \        P
                  ! R4       \        R4      p K  i ; i)	NzLP-PPA-z'Unable to connect to the Launchpad API.r   r   FzAThis update does not come from a source that supports changelogs.zerror on changelog fetchingOFailed to download the list of changes. 
Please check your Internet connection.)originr9   r   r   r}   	exceptionr   r   r   r'   r   r   r   IOErrorr   socketr   )
r;   rk   originschangelogs_uri_ppar   changelogs_uri_binarychangelogs_uri_sourceerror_messager   r   s
   &&&       r   (_fetch_changelog_for_third_party_package0MyCache._fetch_changelog_for_third_party_package  sW   !F}}''	22)-)H)H)N&	  <<TB 	 <<TB 	 !!
N
 ~ $ ; ;k5.!I $$T*i7*
0 	-/I ! %%A. "#BC $%;%M  = %%&CD$%A%Ms/   C83C8!C54C58EE5"EEc                <    V F  w  r# pW0P                   V&   K  	  R # rL   )r)   )r;   pro_pkgsrk   ro   _as   &&   r   create_pro_cacheMyCache.create_pro_cache  s!    '/#TB&-d# (0r   c                   W,          P                   P                  pV P                  P                  WV,          P                   P                  4      p\        R4      V\        W,          P                  RR4      V3,          V P                  V&   V P                  V Uu. uF  qDP                  NK  	  up9  d   V P                  W4       R# W,          P                   P                  pW,          P                   P                  P                  RR4      p V P                  VR4      p\!        V4      ^ 8X  d   \        R4      WV3,          pT P                  T;;,          T,          uu&   R# u upi   \"         d    \        R4      YV3,          p LF\$        \&        \(        P*                  3 d"   p\-        R	T4       \        R
4      p Rp?LRp?ii ; i)z2get the changelog file from the changelog locationzFChanges for %s versions:
Installed version: %s
Available version: %s

ro   Nr   z%3Ar   zThe 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.zThe 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.zcaught exception: r   )r{   r   r)   r   ro   r   r   rz   r'   CHANGELOG_ORIGINr   r   r   r   r   r   r#   r   r   r   r   r   print)	r;   rk   r   ro   or   r   r   es	   &&       r   r   MyCache.get_changelog  s   *&&..##''4j.B.B.J.JK!"("

 DJ(()T:
	"
   7(C7a7(CC99$H%%11z++::BB3N	33D+FI9~"M
 *+	& 	)+9 )D  	'I
 &'I 5 	&*9I	s*   E,5E1 1GG/G0GG)r'   r(   r.   r)   r"   r:   r5   rL   )FN)NN)r   r   r   r   r   r!   r%   r&   rT   propertyr_   rc   rf   r-   ru   r   r,   r   r   r   r   r   r   r   r   r   r   r   __classdictcell__)__classdict__s   @r   r   r   <   s     23h $ $ ) )) ( (&&.aF5'n@"
',0d.), ),r   r   ) warningsfilterwarningsFutureWarningr   r/   r}   rB   urllib.errorr   urllib.requestr   urllib.parser   http.clientr   r   r6   r2   DistUpgrade.DistUpgradeCacheDistUpgrader   r   launchpadlib.launchpadr	   ImportErrorrO   CHANGELOGS_POOLr   r   r   DistUpgradeCacher   r   r   r   <module>r     s   .    ":M J 
   	 " " ! %   	 #  0 3 B #66	i 	N,k**22 N,#  Is   B 	B#"B#