%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/DistUpgrade/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/DistUpgrade/__pycache__/DistUpgradeViewNonInteractive.cpython-312.pyc

�

&��e&6��(�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
Z
mZddl	mZmZddlmZmZmZddlmZddlmZGd�d	e�ZGd
�de�ZGd�d
e�Zedk(r�e�Ze�Ze�ZejAdd�ejB�Z"ejFddD]Z$e"e$jK��e"jMee�ejNd�ejPd�yy)�N)�NoSectionError�
NoOptionError)�PIPE�Popen�)�DistUpgradeView�InstallProgress�AcquireProgress)�get)�DistUpgradeConfigc��eZdZd�Zy)�NonInteractiveAcquireProgressc
�Z�tj|||||�|tjk(rt	d||j
tjt|j��fz�tjj�rtjj�yyy)Nzfetched %s (%.2f/100) at %sb/s)
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.pyrz+NonInteractiveAcquireProgress.update_status,s����%�%�d�C��
�F�K��W�&�&�&��2��T�\�\�7�#6�#6�s�4�;K�;K�7L�#M�6O�O�
P��z�z� � �"��
�
� � �"�#�'�N)�__name__�
__module__�__qualname__r�r"r!rr+s��#r"rc�@�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zy
)�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�@�tj|�tjd�dtj
vrdtj
d<dtj
d<dtj
d<t
d�|_||_d	|_		|jjd
dd�r tjjd
d�d|_	|jj!d
d�|_y#ttf$rY�;wxYw#t"$rYywxYw)Nz*setting up environ for non-interactive use�DEBIAN_FRONTEND�noninteractive�none�APT_LISTCHANGES_FRONTEND�1�RELEASE_UPRADER_NO_APPORT�.r�NonInteractive�ForceOverwriteFzDPkg::Options::z--force-overwritei`	�TerminalTimeout)r	�__init__�logging�debug�os�environr�config�logdir�install_run_number�getWithDefaultr�setrr�timeout�getint�	Exception)rr:s  r!r4z&NonInteractiveInstallProgress.__init__>s���� � ��&��
�
�B�C��B�J�J�.�,<�B�J�J�(�)�17��
�
�-�.�25��
�
�.�/�'��,������"#���	��{�{�)�)�*:�;K�U�S����"�"�#4�5H�I����	��;�;�-�-�.>�?P�Q�D�L���
�.�	��	���	��	�s$�=C<�!D�<D�
D�	D�Dc��tjd|�d|�d��|jjddd�syt	jt
j�}d|d<g}d	|vrd
}d}d}|�d
|�d|��}nOd|vrd}d}d}|�d
|��}n=d|vrd
}d}d}|�d
|�d|��}n(d|vrd
}d}d}|�d
|�d|��}ntd|�d|�d��yt
jj|�stjd|z�yt|�5}	|	j�ddj�j�d}
ddd�d
vsd|
vrd g}n%d!|
vr	d"g}d#|d$<ntjd%|
z�t|�5}	|	j�}ddd�d&vrd'|d(<d)|d*<d+}
d,d g}|j!|
�|j#�|j!|�|j!|�|dk(r\t%d-|zd.t&d.�/�j)�d}
|
r�|j!|
jd0d1�d1j��n�|dk(r�t
jj+|�}|jd2�d}t%d3|zd.t&d.�/�j)�d}
|
r2|j!|
jd0d1�d1j��tj,d4|�d5|�d6��t/j0||�7�}tj,|�d8|���y#1swY���xYw#1swY���xYw)9Nz got a error from dpkg for pkg: 'z': '�'r1�DebugBrokenScriptsFr6�	PYCENTRALzpost-installationz/var/lib/dpkg/info/�postinst�	configure�/r0zpre-installationz/var/lib/dpkg/tmp.ci/�preinst�installzpre-removal�prerm�removezpost-removal�postrmz+UNKNOWN (trigger?) dpkg/script failure for � (z) z+can not find failed maintainer script '%s' �r�bashz/bin/shz-ex�perlz-dzAutoTrace NonStop�PERLDB_OPTSzunknown interpreter: '%s'z. /usr/share/debconf/confmodule�	developer�
DEBCONF_DEBUGr.�DEBIAN_HAS_FRONTENDz/usr/share/debconf/frontend�shz%dpkg-query -s %s|grep ^Config-VersionT)�shellr�universal_newlines�:r�_zdpkg-query -s %s|grep ^Versionzre-running 'z' (�))�envz script returned: )r5�errorr9r<�copyr7r8r�path�exists�open�readline�strip�split�warning�read�append�extendrr�communicate�basenamer6�
subprocess�call)r�pkg�errormsgr8�cmd�prefix�name�argument�maintainer_script�f�interp�
debug_opts�maintainer_script_text�version�rets               r!r\z#NonInteractiveInstallProgress.errorWsE���
�
�S�(�S�T��{�{�)�)��1�5�:���)�)�B�J�J�'��&�������(�*�*�F��D�"�H�.4�c�4� @��
�8�
+�,�F��D� �H�+1�4� 8��
�h�
&�*�F��D��H�.4�c�4� @��
�x�
'�*�F��D��H�.4�c�4� @���3�PX�Y�Z���w�w�~�~�/�0��M�M�G�J[�[�\��
�#�
$�	9���Z�Z�\�!�"�%�+�+�-�3�3�5�a�8�F�	9��f��)�v�"5���J������J�%8�G�M�"��O�O�7�&�@�A��#�
$�	.��%&�V�V�X�"�	.�,�0F�F�'2�G�O�$�-0�G�)�*�2�F��u��J�	�
�
�6���
�
�:���
�
�$�%��
�
�8���:���C�c�I�"&�t�/3�5�5@�[�]�1�F�G���
�
�7�=�=��Q�/��2�8�8�:�;�
�Y�
��'�'�"�"�3�'�C��)�)�C�.��#�C��<�s�B�"&�t�/3�5�5@�[�]�1�F�G���
�
�7�=�=��Q�/��2�8�8�:�;��
�
��W�=�>��o�o�c�w�/���
�
�$�s�;�<�W	9�	9��	.�	.�s�3L6�M�6M�M
c�,�tjd|z�tjd�	t	j
|jd�tjd|z�y#t$r"}tjd|z�Yd}~yd}~wwxYw)Nz.got a conffile-prompt from dpkg for file: '%s'�sn
z0replied no to the conffile-prompt for file: '%s'z/error '%s' when trying to write to the conffile)	r5rd�time�sleepr7�write�	master_fdr@r\)r�current�new�es    r!�conffilez&NonInteractiveInstallProgress.conffile�s|�����H�� �	!�	
�
�
�1�
�	M�
�(�(�4�>�>�6�
*�
�/�/�L�!�"�#���	M�
�-�-�I�!�K�
L�
L��	M�s�8A(�(	B�1B�Bc��tj|�tj�|_|jjddd�}|ratjj|jd|jz�}tjd|z�t|d�|_nttjd�|_|jj!dtj�z�y)Nr1�DpkgProgressLogFzdpkg-progress.%s.logz!writing dpkg progress log to '%s'�wz
%s: Start
)r	�start_updater{�
last_activityr9r<r7r^�joinr:r;r5r6r`�dpkg_progress_log�devnullr})r�progress_log�fullpaths   r!r�z*NonInteractiveInstallProgress.start_update�s����$�$�T�*�!�Y�Y�[����{�{�1�1�2B�CT�V[�\����w�w�|�|�D�K�K�1G�$�Ja�Ja�1a�b�H��M�M�=��H�I�%)�(�C�%8�D�"�%)�"�*�*�c�%:�D�"����$�$�]�T�Y�Y�[�%@�Ar"c���tj|�|jjdt	j�z�|jj�|xjdz
c_y)Nz
%s: Finished
r)r	�
finish_updater�r}r{�closer;�rs r!r�z+NonInteractiveInstallProgress.finish_update�sS���%�%�d�+����$�$�%5��	�	��%C�D����$�$�&����1�$�r"c
�v�|jjtj��d|�d|�d|�d��y)NrX�
)r�r}r{)rrlr�
status_strs    r!�
status_changez+NonInteractiveInstallProgress.status_change�s.�����$�$��	�	��8?�8;�8B�&D�	Er"c��tj|�|jdk(ry|j|jztj
�krYt
jd|j�d|j�d��tj|jtd��tj|jgggd�}t|d�dkDr�tj
�|_	tj|jd�}t j"jd|j%t'j(�d	�
�z�tj|jgggd�}t|d�dkDr��t j"j-�y#t*$rYywxYw)Nzno activity z
 seconds (z) - sending ctrl-c�g�������?rrz%s�ignore)�errors)r	�update_interface�statusfdr�r>r{r5rdr r7r}r~�chr�select�lenrerr�decode�locale�getpreferredencoding�OSErrorr)r�res�ss   r!r�z.NonInteractiveInstallProgress.update_interface�sS���(�(��.��=�=�D� ��������-�����<��O�O��L�L�$�+�+�/�
0�
�H�H�T�^�^�C��F�+��m�m�T�^�^�,�R��3�7���#�a�&�k�A�o� $�	�	��4����7�7�4�>�>�1�-�q��z�z����q�x�x��/�/�1�(�(0�(D�!D�E�
������/��2�c�:�3��#�a�&�k�A�o�	�
�
�����	����s�;A%F4�4	G�?Gc�4�tjd�dtjd<dtjd<t	j
�\|_|_|jdk7r"tjd|jz�|jS)Nzdoing a pty.fork()�dumb�TERM�true�PAGERrz
pid is: %s)r5r6r7r8�pty�fork�pidr~r�s r!r�z"NonInteractiveInstallProgress.fork�sh���
�
�*�+�#��
�
�6��$��
�
�7��%(�X�X�Z�"���4�>��8�8�q�=��M�M�,����1�2��x�x�r"N)r#r$r%�__doc__r4r\r�r�r�r�r�r�r&r"r!r(r(6s4����2^=�@M�
B�%�
E�
�2	r"r(c�x��eZdZdZdd�Zd�Zd�Zd�Zdd�Zd�Z	�fd�Z
	dd	�Zdd
�Zdd�Z
d�Zdd
�Zd�Z�xZS)�DistUpgradeViewNonInteractivez- non-interactive version of the upgrade view c�B�tj|�t�jd�t	d�|_t
�|_t|�|_	tjjj�|_|jt _y)Nr1r0)rr4�
get_telemetry�set_updater_typerr9r�_acquireProgressr(�_installProgress�apt�progress�base�
OpProgress�_opProgress�
excepthookr�__excepthook__)r�datadirr:s   r!r4z&DistUpgradeViewNonInteractive.__init__sl��� � ��&���(�(�)9�:�'��,��� =� ?��� =�f� E����<�<�,�,�7�7�9���!�_�_��r"c���ddl}tjd|�d|�d��|j|||�}tjddj|�z�|j
�y)z2 on uncaught exceptions -> print error and reboot rNzgot exception 'z': � znot handled exception:
%s�)�	tracebackr5�	exception�format_exceptionr\r��confirmRestart)r�type�value�tbr��liness      r!r�z(DistUpgradeViewNonInteractive.excepthooksR������t�U�C�D��*�*�4���;���
�
�2�R�W�W�U�^�C�D����r"c��|jS)z5 return a OpProgress() subclass for the given graphic)r�r�s r!�getOpCacheProgressz0DistUpgradeViewNonInteractive.getOpCacheProgresss�����r"c��|jS)z# return an acquire progress object )r�r�s r!�getAcquireProgressz0DistUpgradeViewNonInteractive.getAcquireProgress����$�$�$r"c��|jS)z" return a install progress object )r�)r�caches  r!�getInstallProgressz0DistUpgradeViewNonInteractive.getInstallProgressr�r"c��y)z\ update the current status of the distUpgrade based
            on the current view
        Nr&)r�msgs  r!�updateStatusz*DistUpgradeViewNonInteractive.updateStatuss��	
r"c�,��tt|�|�y)z� we 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�z%DistUpgradeViewNonInteractive.setSteps���	�+�T�:�4�@�r"c��tj||||||�tjd|jD�cgc]}|j
��c}z�tjd|jD�cgc]}|j
��c}z�tjd|jD�cgc]}|j
��c}z�ycc}wcc}wcc}w)Nztoinstall: '%s'ztoupgrade: '%s'ztoremove: '%s'T)r�confirmChangesr5r6�	toInstallrp�	toUpgrade�toRemove)r�summary�changes�	demotions�downloadSize�actions�removal_bold�ps        r!r�z,DistUpgradeViewNonInteractive.confirmChanges(s����&�&�t�W�g�y�'3�W�	>��
�
�'�4�>�>�*J�a�1�6�6�*J�J�K��
�
�'�4�>�>�*J�a�1�6�6�*J�J�K��
�
�&�$�-�-�)H�Q�!�&�&�)H�H�I���+K��*J��)Hs�C

�3C
�-C
c��y)z0 ask a Yes/No question and return True on 'Yes' Tr&�rr�r��defaults    r!�askYesNoQuestionz.DistUpgradeViewNonInteractive.askYesNoQuestion0s��r"c��y�NTr&r�s    r!�askCancelContinueQuestionz7DistUpgradeViewNonInteractive.askCancelContinueQuestion7s��r"c�f�tjd�|jjddd�S)z2 generic ask about the restart, can be overridden zconfirmRestart() calledr1�
RealRebootF)r5r6r9r<r�s r!r�z,DistUpgradeViewNonInteractive.confirmRestart9s)���
�
�/�0��{�{�)�)�*:�<��O�Or"c�@�tj|�d|�d|�d��y)z display a error r�rMrZN�r5r\)rr�r��extended_msgs    r!r\z#DistUpgradeViewNonInteractive.error>s���
�
�g�s�L�A�Br"c�.�tjd�y)Nzview.abort calledr�r�s r!�abortz#DistUpgradeViewNonInteractive.abortAs���
�
�)�*r")NN)Nr�)�No)�Cancel)r#r$r%r�r4r�r�r�r�r�r�r�r�r�r�r\r��
__classcell__)r�s@r!r�r��sN���3�-�� �%�%�
�
	
�37����P�
C�+r"r��__main__zxserver-xorgzpre-installation script failedrN))r�rr5r�r{rr7r�r�rjr]�apt.progress�configparserrrrrrr	r
�	telemetryrr��DistUpgradeConfigParserrrr(r�r#�view�ap�ipr\�Cacher��argvrl�mark_install�commitr|�exitr&r"r!�<module>rs��,���
��
�	�
�
����6�"�N�N�+�6�#�O�#�E�O�E�PD+�O�D+�N�z��	&�	(�$�$�&�"�$�&�"��(�(�>�:�;�
�#�)�)�+�%�
�X�X�a�b�\��c�
�#�J����	�
�,�,�r�2���$�*�*�Q�-�
�#�(�(�1�+�#r"

Zerion Mini Shell 1.0