+
    j%                         ^ RI t ^ RIt^ RIt^ RIt^ RIt^ 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Ht  ! R R]4      tR# )	    N)gettext)urlopen)	HTTPError)get_dist)readlinec                      a  ] tR t^(t o RtRtRtR]P                  9   t	R t
R tR tR tR	 tR
 tR tR tR tR tR tR tRtV tR# )DistUpgradeFetcherCorez1base class (without GUI) for the upgrade fetcher z http://archive.ubuntu.com/ubuntumainDEBUG_UPDATE_MANAGERc                J    Wn         \        4       V n        W n        . V n        R # )N)new_distr   current_dist_name	_progressrun_options)selfr   progresss   &&&D/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeFetcherCore.py__init__DistUpgradeFetcherCore.__init__/   s     !)!    c                z    V P                   '       d)   \        P                  P                  VR,           4       R# R# )z!helper to show debug information 
N)DEBUGsysstderrwrite)r   msgs   &&r   _debugDistUpgradeFetcherCore._debug6   s&    :::JJS4Z( r   c                   R V P                   9   d   R# V P                  P                  e   V P                  P                  p\        P                  ! 4       p \        P
                  ! ^4       \        V4      pVP                  4       P                  RR4      p\        P
                  ! T4       \        4        \        X4       \        \        R	4      R
R7       \        4       pVP                  4       P!                  4       P#                  \        R4      4      '       d   R# R#   \         d)    T P                  \        R4      \        R4      4        R# \         d)    T P                  \        R4      \        R4      4        R# i ; i)z(--frontend=DistUpgradeViewNonInteractiveTzUTF-8replacez'Could not find the release announcementzThe server may be overloaded.Fz+Could not download the release announcementz&Please check your internet connection.zContinue [yN]  )endy)r   r   releaseNotesURIsocketgetdefaulttimeoutsetdefaulttimeoutr   readdecoder   error_IOErrorprintr   striplower
startswith)r   uritimeoutrelease_notesnotesress   &     r   showReleaseNotes'DistUpgradeFetcherCore.showReleaseNotes;   s.   59I9II==((4--//C..0G((+ '%**,33GYG $$W-ea !r*j99;))!C&11  

1FG<=? 

1JKEFHs   AD$ $/FF%FFc                2    \        V4       \        V4       R# )zlminimal implementation for error display, should be overwriten
by subclasses that want to more fancy method
F)r.   )r   summarymessages   &&&r   r+   DistUpgradeFetcherCore.errorV   s     	ggr   c           	     P   V P                   P                  '       Ed	   V P                  R ,           \        P                  P                  V P                   P                  4      ,           pV P                  R ,           \        P                  P                  V P                   P                  4      ,           p\        \        R4      R\        P                  P                  V4      R\        P                  P                  V4      /,          4       V P                  W4      '       d   R# R# )/z0authenticate '%(file)s' against '%(signature)s' file	signatureTF)
r   upgradeToolSigtmpdirospathbasenameupgradeToolr.   r,   gpgauthenticate)r   fsigs   &  r   authenticate#DistUpgradeFetcherCore.authenticate^   s    =='''c!BGG$4$4T]]5N5N$OOA++#bgg&6&6,,'. .C!FG((+RWW--c2K4 4 5 ##A++r   c                f    RRRVV.p\         P                  ! V\         P                  R7      pV^ 8H  # )z.authenticate a file against a given signature z/usr/bin/gpgvz	--keyringz./usr/share/keyrings/ubuntu-archive-keyring.gpg)r   )
subprocesscallPIPE)r   r?   r@   gpgrets   &&&  r   rG   &DistUpgradeFetcherCore.gpgauthenticatej   s9     I	
 ooc*//:axr   c                   \         P                  P                  V P                  \         P                  P	                  V P
                  4      4      p\        \        R 4      \         P                  P	                  V4      ,          4       \         P                  P                  V4      '       g   R#  \        P                  ! V P                  R,           \         P                  P	                  V P
                  4      ,           R4      pV F  pVP                  V4       K  	  VP                  4        R#   \        P                   d)   p\        P                  ! RT,          4        Rp?R# Rp?ii ; i)zextracting '%s'Fr>   rzfailed to open tarfile (%s)NT)rC   rD   joinrB   rE   r2   r.   r,   existstarfileopenextractclose	ReadErrorloggingr+   )r   fnametartarinfoes   &    r   extractDistUpgrader*DistUpgradeFetcherCore.extractDistUpgraderv   s    T[["''*:*:488*DEa!"RWW%5%5e%<<=ww~~e$$	,,t{{S0!ww//9 :;>@CG$ IIK     	MM7!;<	s   2B D4 4E1	E,,E1c                "   V P                   : R V P                  P                  : 2;V n        p\        P
                  P                  V4      '       g<   V P                  \        R4      \        R4      R,           \        R4      ,           4      # R# )r>   zCould not run the upgrade toolz.  zThis is most likely a bug in the upgrade tool. Please report it as a bug using the command 'ubuntu-bug ubuntu-release-upgrader-core'.T)	rB   r   namescriptrC   rD   rV   r+   r,   )r   re   s   & r   verifyDistUpgrader)DistUpgradeFetcherCore.verifyDistUpgrader   sy    
 +/++t}}7I7IJJfww~~f%%::a @A @AEI !A BBC C r   c                   \         P                  ! RR7      pWn        \        P                  ! V4       \
        P                  ! RV,          4       V P                  ^ 8  dA   \        P                  P                  RR4       \        P                  P                  RR4       \        P                  ! V P                  4      pV P                  P                  e;   V P                  P                  p\        P                  ! VV\!        R4      R7      pV V P                  P"                  Eea   V P                  P"                  V n        \        P                  ! VV P$                  \!        R	4      R7      pV VP'                  4       pWbP(                  8w  d    \
        P*                  ! R
V,          4       R# \        P,                  P/                  V P                  P                  4      \        P,                  P/                  V P                  P"                  4      3 Fl  p\        P,                  P1                  V4      '       d'   \        P,                  P3                  V4      ^ 8  d   KN  \
        P*                  ! RV,          4        R# 	  R# R# )z-download the tarball with the upgrade script zubuntu-release-upgrader-)prefixzusing tmpdir: '%s'zDebug::Acquire::http1zDebug::Acquire::ftpzUpgrade tool signature)descrzUpgrade toolzfetch result != continue (%s)Fzfile '%s' missingT)tempfilemkdtemprB   rC   chdirr\   debugr   apt_pkgconfigsetAcquirer   r   rA   AcquireFiler,   rF   r2   runRESULT_CONTINUEwarningrD   rE   rV   getsize)r   rB   fetcherr2   af1af2resultrH   s   &       r   fetchDistUpgrader(DistUpgradeFetcherCore.fetchDistUpgrader   s   !!)CD
*V34::>NN5s;NN4c://$..1==''3--..C%%g&),-.F,GIC ==$$0}}00DH%%g&*hh,-n,=?C [[]F000 ?& HIgg&&t}}'C'CDgg&&t}}'@'@ACq))bggooa.@1.DOO$7!$;< 	C
 r   c                    V P                   .V P                  ,           p\        P                  ! 4       ^ 8w  d#   \        P                  ! RRR.V,           4       R# \        P                  ! V P                   V4       R# )r   z/usr/bin/sudosudoz-EN)re   r   rC   getuidexecv)r   argss   & r   runDistUpgrader&DistUpgradeFetcherCore.runDistUpgrader   sO    }t///99;!HH_vtnt&;<HHT[[$'r   c                r    \         P                  ! R 4       \        P                  ! V P                  4       R# )z..N)rC   rn   shutilrmtreerB   )r   s   &r   cleanupDistUpgradeFetcherCore.cleanup   s    
dkk"r   c                >   V P                  4       '       g   R # V P                  4       '       g'   V P                  \        R4      \        R4      4       R # V P	                  4       '       g7   V P                  \        R4      \        R4      4       V P                  4        R # V P                  4       '       g'   V P                  \        R4      \        R4      4       R # V P                  4       '       g7   V P                  \        R4      \        R4      4       V P                  4        R #  \        P                  ! V P                  \        P                  4      '       g&   \        R	V P                  ,          4      p^Vn        VhV P                  4        R#   \         d|   pTP                  ^8X  d+   T P                  \        R
4      \        R4      4        R p?R# T P                  \        R
4      \        R4      TP                  ,          4        R p?R# R p?ii ; i)NzFailed to fetchz=Fetching the upgrade failed. There may be a network problem. zAuthentication failedz_Authenticating the upgrade failed. There may be a problem with the network or with the server. zFailed to extractz[Extracting the upgrade failed. There may be a problem with the network or with the server. zVerification failedz[Verifying the upgrade failed.  There may be a problem with the network or with the server. zCan not execute '%s'zCan not run the upgradezyThis usually is caused by a system where /tmp is mounted noexec. Please remount without noexec and run the upgrade again.FzThe error message is '%s'.T)r7   r}   r+   r,   rJ   r   ra   rf   rC   accessre   X_OKOSErrorerrnor   strerror)r   exr`   s   &  r   ru   DistUpgradeFetcherCore.run   s   $$&&%%''JJq*+ % &'   ""JJq01 I JK LLN''))JJq,- I JK &&((JJq./ I JK LLN	I 99T[["''223dkkAB  "   		Iww"}

167 A BC 

1679:QZZGI I		Is$   *4F 5F H!5H5HH)r   r   r   r   re   rB   r2   N)__name__
__module____qualname____firstlineno____doc__DEFAULT_MIRRORDEFAULT_COMPONENTrC   environr   r   r   r7   r+   rJ   rG   ra   rf   r}   r   r   ru   __static_attributes____classdictcell__)__classdict__s   @r   r	   r	   (   sc     87N"bjj0E)
6

"%N(#- -r   r	   )rC   rp   r\   rW   rl   r   r&   r   rM   r   r,   urllib.requestr   urllib.errorr   utilsr   DistUpgradeViewTextr   objectr	    r   r   <module>r      s?   . 
       
    " "  )OV Or   