+
    j4                         ^ 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	t	^ RI
t
^ RIt ^ RIHtHt ^ RI	HtHt ^RIHtHtHt ^RIHt ^RIHt  ! R R]4      t ! R	 R
]4      t ! R R]4      tR# )    N)NoSectionErrorNoOptionError)PIPEPopen)DistUpgradeViewInstallProgressAcquireProgress)get)DistUpgradeConfigc                   &   a  ] tR t^+t o R tRtV tR# )NonInteractiveAcquireProgressc           
     v   \         P                  ! WW#V4       V\        P                  8X  d   \	        R WP
                  \        P                  ! \        V P                  4      4      3,          4       \        P                  P                  4       '       d!   \        P                  P                  4        R# R# R# )zfetched %s (%.2f/100) at %sb/sN)r	   update_statusapt_pkg	STAT_DONEprintpercentsize_to_strintcurrent_cpssysstdoutisattyflush)selfuridescr
shortDescrstatuss   &&&&&K/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeViewNonInteractive.pyr   +NonInteractiveAcquireProgress.update_status,   s    %%dFKW&&&2\\7#6#6s4;K;K7L#M6O O Pzz  ""

  " # '     N)__name__
__module____qualname____firstlineno__r   __static_attributes____classdictcell____classdict__s   @r    r   r   +   s     # #r"   r   c                   T   a  ] tR t^6t o RtR tR tR tR tR t	R t
R tR	 tR
tV tR# )NonInteractiveInstallProgressz
Non-interactive version of the install progress class

This ensures that conffile prompts are handled and that
hanging scripts are killed after a (long) timeout via ctrl-c
c                `   \         P                  ! V 4       \        P                  ! R 4       R\        P
                  9  d   R\        P
                  R&   R\        P
                  R&   R\        P
                  R&   \        R4      V n        Wn        ^ V n	         V P                  P                  RR	R
4      '       d!   \        P                  P                  RR4       RT n         T P                  P!                  RR4      T n        R#   \        \        3 d     L>i ; i  \"         d     R# i ; i)z*setting up environ for non-interactive useDEBIAN_FRONTENDnoninteractivenoneAPT_LISTCHANGES_FRONTEND1RELEASE_UPGRADER_NO_APPORT.NonInteractiveForceOverwriteFzDPkg::Options::z--force-overwritei`	  TerminalTimeoutN)r   __init__loggingdebugosenvironr   configlogdirinstall_run_numbergetWithDefaultr   setr   r   timeoutgetint	Exception)r   r?   s   &&r    r9   &NonInteractiveInstallProgress.__init__>   s      &BCBJJ.,<BJJ()17

-.36

/0',"#	{{))*:;KUSS""#45HI 	;;--.>?PQDL . 		  		s%   AD $!D DDD-,D-c                   \         P                  ! R V: RV: R24       V P                  P                  RRR4      '       g   R# \        P                  ! \
        P                  4      pRVR&   . pR	V9   d   R
pRpRpV: RV: RV: 2pMcRV9   d   RpRpRpV: RV: 2pMLRV9   d   R
pRpRpV: RV: RV: 2pM1RV9   d   R
pRpRpV: RV: RV: 2pM\        RV: RV: R24       R# \
        P                  P                  V4      '       g    \         P                  ! RV,          4       R# \        V4      ;_uu_ 4       p	V	P                  4       R,          P                  4       P                  4       ^ ,          p
RRR4       RX
9   g   RV
9   d   R.pM-R V
9   d
   R!.pR"VR#&   M\         P                  ! R$V
,          4       \        V4      ;_uu_ 4       p	V	P                  4       pRRR4       R%X9   d   R&VR'&   R(VR)&   R*p
R+R.pVP!                  V
4       VP#                  X4       VP!                  V4       VP!                  V4       VR8X  do   \%        R,V,          R-\&        R-R.7      P)                  4       ^ ,          pV'       d7   VP!                  VP                  R/^4      ^,          P                  4       4       MVR8X  d   \
        P                  P+                  V4      pVP                  R04      ^ ,          p\%        R1V,          R-\&        R-R.7      P)                  4       ^ ,          pV'       d7   VP!                  VP                  R/^4      ^,          P                  4       4       \         P,                  ! R2V: R3V: R424       \.        P0                  ! WCR57      p\         P,                  ! V: R6V: 24       R#   + '       g   i     ELL; i  + '       g   i     EL; i)7z got a error from dpkg for pkg: 'z': ''r6   DebugBrokenScriptsFNr;   	PYCENTRALzpost-installationz/var/lib/dpkg/info/postinst	configure/r5   zpre-installationz/var/lib/dpkg/tmp.ci/preinstinstallzpre-removalprermremovezpost-removalpostrmz+UNKNOWN (trigger?) dpkg/script failure for  (z) z+can not find failed maintainer script '%s' :   NNbashz/bin/shz-experlz-dzAutoTrace NonStopPERLDB_OPTSzunknown interpreter: '%s'z. /usr/share/debconf/confmodule	developerDEBCONF_DEBUGr3   DEBIAN_HAS_FRONTENDz/usr/share/debconf/frontendshz%dpkg-query -s %s|grep ^Config-VersionT)shellr   universal_newlines:_zdpkg-query -s %s|grep ^Versionzre-running 'z' ())envz script returned: )r:   errorr>   rA   copyr<   r=   r   pathexistsopenreadlinestripsplitwarningreadappendextendr   r   communicatebasenamer;   
subprocesscall)r   pkgerrormsgr=   cmdprefixnameargumentmaintainer_scriptfinterp
debug_optsmaintainer_script_textversionrets   &&&            r    rb   #NonInteractiveInstallProgress.errorW   sH   S(ST{{))15: : ))BJJ'& (**FD"H.4c4 @8+,FD H+14 8h&*FDH.4c4 @x'*FDH.4c4 @3PXYZ ww~~/00MMGJ[[\#$$ZZ\"%++-335a8F %f)v"5JJ%8GM"OO7&@A #$$%&VVX" %,0FF'2GO$-0G)*2FuJ 	

6

:

$%

8 :CcI"&t/355@[]1FG 

7==Q/288:;Y''""3'C))C.#C<sB"&t/355@[]1FG 

7==Q/288:;W=>ooc/$s;<W %$$ %$$s   ;OOO	O(	c                V   \         P                  ! R V,          4       \        P                  ! ^4        \        P
                  ! V P                  R4       \         P                  ! RV,          4       R#   \         d)   p\         P                  ! RT,          4        Rp?R# Rp?ii ; i)z.got a conffile-prompt from dpkg for file: '%s's   n
z0replied no to the conffile-prompt for file: '%s'z/error '%s' when trying to write to the conffileN)	r:   rj   timesleepr<   write	master_fdrE   rb   )r   currentnewes   &&& r    conffile&NonInteractiveInstallProgress.conffile   s|    H  	! 	

1	M
((4>>6
*
//L!" # 	M
--I!K
L
L	Ms   >A5 5B( B##B(c                ,   \         P                  ! V 4       \        P                  ! 4       V n        V P                  P                  R RR4      pV'       dk   \        P                  P                  V P                  RV P                  ,          4      p\        P                  ! RV,          4       \        VR4      V n        M\        \        P                  R4      V n        V P                  P!                  R\        P                  ! 4       ,          4       R# )r6   DpkgProgressLogFzdpkg-progress.%s.logz!writing dpkg progress log to '%s'wz
%s: Start
N)r   start_updater   last_activityr>   rA   r<   rd   joinr?   r@   r:   r;   rf   dpkg_progress_logdevnullr   )r   progress_logfullpaths   &  r    r   *NonInteractiveInstallProgress.start_update   s    $$T*!YY[{{112BCTV[\ww||DKK1G$JaJa1abHMM=HI%)(C%8D"%)"**c%:D"$$]TYY[%@Ar"   c                   \         P                  ! V 4       V P                  P                  R \        P                  ! 4       ,          4       V P                  P                  4        V ;P                  ^,          un        R# )z%s: Finished
N)r   finish_updater   r   r   closer@   r   s   &r    r   +NonInteractiveInstallProgress.finish_update   sS    %%d+$$%5		%CD$$&1$r"   c           
         V P                   P                  \        P                  ! 4       : R V: R V: R V: R24       R# )r^   
N)r   r   r   )r   rr   r   
status_strs   &&&&r    status_change+NonInteractiveInstallProgress.status_change   s.    $$		8?8;8B&D 	Er"   c                   \         P                  ! V 4       V P                  R 8X  d   R # V P                  V P                  ,           \
        P
                  ! 4       8  d^   \        P                  ! RV P                  : RV P                  : R24       \        P                  ! V P                  \        ^4      4       \        P                  ! V P                  .. . R4      p\        V^ ,          4      ^ 8  d   \
        P
                  ! 4       V n         \        P                  ! V P                  ^4      p\         P"                  P                  RVP%                  \&        P(                  ! 4       RR7      ,          4       \        P                  ! T P                  .. . R4      pK  \         P"                  P-                  4        R #   \*         d     R # i ; i)Nzno activity z
 seconds (z) - sending ctrl-cg?z%signore)errors)r   update_interfacestatusfdr   rC   r   r:   rj   r   r<   r   r   chrselectlenrk   r   r   decodelocalegetpreferredencodingOSErrorr   )r   resss   &  r    r   .NonInteractiveInstallProgress.update_interface   s@   ((.==D -<OOLL$++/ 0 HHT^^CF+ mmT^^,R37#a&kAo $		4774>>1-qzzqxx//1( (0 (D !D E
 /2c:3

	  s   A+G GGc                F   \         P                  ! R 4       R\        P                  R&   R\        P                  R&   \        P
                  ! 4       w  V n        V n        V P                  ^ 8w  d(   \         P                  ! RV P                  ,          4       V P                  # )zdoing a pty.fork()dumbTERMtruePAGERz
pid is: %s)r:   r;   r<   r=   ptyforkpidr   r   s   &r    r   "NonInteractiveInstallProgress.fork   sh    *+#

6$

7%(XXZ"4>88q=MM,12xxr"   )r>   r   r@   r   r?   r   r   rC   N)r$   r%   r&   r'   __doc__r9   rb   r   r   r   r   r   r   r(   r)   r*   s   @r    r-   r-   6   s<     2^=@M
B%
E
2	 	r"   r-   c                      a a ] tR t^t oRtRR ltR tR tR tRR lt	R t
V 3R ltRR	 ltRR
 ltRR ltR tRR ltR tRtVtV ;t# )DistUpgradeViewNonInteractivez,non-interactive version of the upgrade view c                F   \         P                  ! V 4       \        4       P                  R 4       \	        R4      V n        \        4       V n        \        V4      V n	        \        P                  P                  P                  4       V n        V P                  \         n        R# )r6   r5   N)r   r9   get_telemetryset_updater_typer   r>   r   _acquireProgressr-   _installProgressaptprogressbase
OpProgress_opProgress
excepthookr   __excepthook__)r   datadirr?   s   &&&r    r9   &DistUpgradeViewNonInteractive.__init__   sl      &(()9:', = ? =f E<<,,779!__r"   c                    ^ RI p\        P                  ! RV: RV: R24       VP                  WV4      p\        P                  ! RRP                  V4      ,          4       V P                  4        R# )z1on uncaught exceptions -> print error and reboot Nzgot exception 'z':  znot handled exception:
%s )	tracebackr:   	exceptionformat_exceptionrb   r   confirmRestart)r   typevaluetbr   liness   &&&&  r    r   (DistUpgradeViewNonInteractive.excepthook  sP    tUCD**4;2RWWU^CDr"   c                    V P                   # )z4return a OpProgress() subclass for the given graphic)r   r   s   &r    getOpCacheProgress0DistUpgradeViewNonInteractive.getOpCacheProgress  s    r"   c                    V P                   # )z"return an acquire progress object )r   r   s   &r    getAcquireProgress0DistUpgradeViewNonInteractive.getAcquireProgress      $$$r"   c                    V P                   # )z!return a install progress object )r   )r   caches   &&r    getInstallProgress0DistUpgradeViewNonInteractive.getInstallProgress  r   r"   c                    R# )zGupdate the current status of the distUpgrade based
on the current view
Nr#   )r   msgs   &&r    updateStatus*DistUpgradeViewNonInteractive.updateStatus  s     	r"   c                .   < \         \        V `  V4       R# )zwe have 5 steps current for a upgrade:
1. Analyzing the system
2. Updating repository information
3. Performing the upgrade
4. Post upgrade stuff
5. Complete
N)superr   setStep)r   step	__class__s   &&r    r   %DistUpgradeViewNonInteractive.setStep  s     	+T:4@r"   c                   \         P                  ! WVW44       \        P                  ! R V P                   Uu. uF  qfP
                  NK  	  up,          4       \        P                  ! RV P                   Uu. uF  qfP
                  NK  	  up,          4       \        P                  ! RV P                   Uu. uF  qfP
                  NK  	  up,          4       R# u upi u upi u upi )ztoinstall: '%s'ztoupgrade: '%s'ztoremove: '%s'T)r   confirmChangesr:   r;   	toInstallrv   	toUpgradetoRemove)r   summarychangesdownloadSizeactionsremoval_boldps   &&&&&& r    r   ,DistUpgradeViewNonInteractive.confirmChanges(  s    &&tg'3	>'4>>*J>a66>*JJK'4>>*J>a66>*JJK&$--)H-Q&&-)HHI +K*J)Hs   C
8C 
8C%
c                    R# )z/ask a Yes/No question and return True on 'Yes' Tr#   r   r   r   defaults   &&&&r    askYesNoQuestion.DistUpgradeViewNonInteractive.askYesNoQuestion0  s     r"   c                    R # )Tr#   r   s   &&&&r    askCancelContinueQuestion7DistUpgradeViewNonInteractive.askCancelContinueQuestion7  s    r"   c                h    \         P                  ! R4       V P                  P                  RRR4      # )z1generic ask about the restart, can be overridden zconfirmRestart() calledr6   
RealRebootF)r:   r;   r>   rA   r   s   &r    r   ,DistUpgradeViewNonInteractive.confirmRestart9  s)    /0{{))*:<OOr"   c                J    \         P                  ! V: RV: RV: R24       R# )zdisplay a error r   rS   r`   Nr:   rb   )r   r   r   extended_msgs   &&&&r    rb   #DistUpgradeViewNonInteractive.error>  s    gsLABr"   c                2    \         P                  ! R 4       R# )zview.abort calledNr  r   s   &r    abort#DistUpgradeViewNonInteractive.abortA  s    )*r"   )r   r   r   r>   )NN)N)NT)No)Cancel)r$   r%   r&   r'   r   r9   r   r   r   r   r   r   r   r   r   r   rb   r  r(   r)   __classcell__)r   r+   s   @@r    r   r      sP     3- %%
	P
C+ +r"   r   )r   r   r:   r   r   r   r<   r   r   rp   rc   apt.progressconfigparserr   r   r   r   r   r   r	   	telemetryr
   r   DistUpgradeConfigParserr   r   r-   r   r#   r"   r    <module>r     sf   ,      
 	 
     6 " N N + 6#O #EO EPD+O D+r"   