%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/aptdaemon/worker/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/aptdaemon/worker/__pycache__/__init__.cpython-312.pyc

�

�x�Q2����dZdZdZddlZddlZddlZddlZddlZddlm	Z	m
Z
ddlmZddlm
Z
ejd	�Zd
�ZGd�de	j�ZGd
�de�Zy)z0Provides AptWorker which processes transactions.z%Sebastian Heinlein <devel@glatzor.de>)�
BaseWorker�DummyWorker�N)�GObject�GLib�)�enums)�errorszAptDaemon.Workerc��|S)N�)�ss �;/usr/lib/python3/dist-packages/aptdaemon/worker/__init__.py�<lambda>r's��a��c��eZdZdZej
jdejffej
jdejffd�ZdZ	dd�Z
ed��Zd�Z
d�Zd�Zd	�Zd
�Zd�Zdd�Zd
�Zd�Zd�Zd�Zd�Zd�Zy)rz3Worker which processes transactions from the queue.N)�transaction-done�transaction-simulatedc��tjj|�d|_tj�|_||_d|_i|_y)z$Initialize a new AptWorker instance.N)r�__init__�trans�time�last_action_timestamp�chroot�
marked_tid�plugins)�selfr�load_pluginss   r
rzBaseWorker.__init__6s@����� � ��&���
�%)�Y�Y�[��"���������rc��d|vr|jdd�\}}d}n"d|vr|jdd�\}}d}n|}dx}}|||fS)zUReturn the name, the version number and the release of the
        specified package.�=�N�/)�split)�package�name�version�releases    r
�_split_package_idzBaseWorker._split_package_idAs`���'�>�#�M�M�#�q�1�M�D�'��G�
�G�^�#�M�M�#�q�1�M�D�'��G��D� $�$�G�g��W�g�%�%rc��tjd|j�|jrt	d��||_tj|j|�y)��Process the given transaction in the background.

        Keyword argument:
        transaction -- core.Transcation instance to run
        �Processing transaction %s�&There is already a running transactionN)�log�info�tidr�	Exceptionr�idle_add�_run_transaction_idle�r�transactions  r
�runzBaseWorker.runPsE��	���,�k�o�o�>��:�:��D�E�E� ��
��
�
�d�0�0�+�>rc��tjd|jz�tj|_t
j|j|�y)a5Return the dependencies which will be installed by the transaction,
        the content of the dpkg status file after the transaction would have
        been applied, the download size and the required disk space.

        Keyword arguments:
        trans -- the transaction which should be simulated
        zSimulating trans: %sN)	r+r,r-r�STATUS_RESOLVING_DEP�statusrr/�_simulate_transaction_idle�rrs  r
�simulatezBaseWorker.simulate\s;��	���'�%�)�)�3�4��1�1����
�
�d�5�5�u�=rc�h�tjd|j�|jd|�y)zuEmit the transaction-simulated signal.

        Keyword argument:
        trans -- the simulated transaction
        z"Emitting transaction-simulated: %srN�r+�debugr-�emitr8s  r
�_emit_transaction_simulatedz&BaseWorker._emit_transaction_simulatedhs&��	�	�	�6��	�	�B��	�	�)�5�1rc�h�tjd|j�|jd|�y)zoEmit the transaction-done signal.

        Keyword argument:
        trans -- the finished transaction
        zEmitting transaction-done: %srNr;r8s  r
�_emit_transaction_donez!BaseWorker._emit_transaction_doneqs&��	�	�	�1�5�9�9�=��	�	�$�e�,rc��tj�|_tj|_d|_	|j
|�tj|_d|_tj�|_|j6dd}d|_d|_|j=|�t>jAd|�y#tj$rtj|_Y��tj$r&}||_
tj|_Yd}~��d}~wtt f$rtj|_Y��t"$r�}t%j&�}tjtj(|�|_
tj|_	ddlm}|j/t1|��dt3|���||�n#t4$rYnwxYwYd}~���d}~wwxYw#d|_tj�|_|j6dd}d|_d|_|j=|�t>jAd|�wxYw)	zRun the transaction�Nr��crash�: �d�Finished transaction %sF)!rrr�STATUS_RUNNINGr6�progress�_run_transaction�EXIT_SUCCESS�exitr	�TransactionCancelled�EXIT_CANCELLED�TransactionFailed�error�EXIT_FAILED�KeyboardInterrupt�
SystemExitr.�	traceback�
format_exc�
ERROR_UNKNOWN�rD�
create_report�type�str�ImportErrorr-rrr@r+r,)rr�excep�tbkrDr-s      r
r0z BaseWorker._run_transaction_idlezs���%)�Y�Y�[��"��+�+������	5��!�!�%�(�(�+�+�E�J� �E�N�)-����D�&��)�)�A�,�C��D�J�"�D�O��'�'��.��H�H�.��4���9�*�*�	.��-�-�E�J��'�'�	+��E�K��*�*�E�J�J��!�:�.�	.��-�-�E�J��
	0��&�&�(�C� �2�2�5�3F�3F��L�E�K��*�*�E�J�
0�#��#�#��U��S��Z�$H�$'��0���
��
���
	0��!�E�N�)-����D�&��)�)�A�,�C��D�J�"�D�O��'�'��.��H�H�.��4�s�C�G1�(G.�*G1�,G.�>D�G1�'G.�G1�G.�AG)�#G�)+G)�	G �G)�G � G)�#G1�)G.�.G1�1A&Ic�X�	|j|�\|_|_|_|_|_tj|_tj�|_
|j|_|j9|�tj�|_y#tj$r&}||_tj |_Yd}~�_d}~wt$$r�}t'j(�}tjtj*|�|_	ddlm}|j1t3|��dt5|���||�n#t6$rYnwxYwtj |_Yd}~��d}~wwxYw#|j9|�tj�|_wxYw)NrrCrEF)�_simulate_transaction�depends�download�space�unauthenticated�high_trust_packagesr�STATUS_SETTING_UPr6r�	simulatedr-rr	rOrPrQrLr.rTrUrVrWrDrXrYrZr[r>r)rrr\r]rDs     r
r7z%BaseWorker._simulate_transaction_idle�sI��	5�.2�-G�-G��-N�
+�U�]�E�N�E�K��%��)� !�2�2�E�L�"�i�i�k�E�O�#�i�i�D�O��,�,�U�3�)-����D�&���+�'�'�	+��E�K��*�*�E�J�J���
	+��&�&�(�C� �2�2�5�3F�3F��L�E�K�
0�#��#�#��U��S��Z�$H�$'��0���
��
��
�*�*�E�J�J��
	+�� 
�,�,�U�3�)-����D�&�sd�0B�?E=�E:�/C�E=�E:�=E5�E� +E5�	E�E5�E�E5�/E=�5E:�:E=�=,F)c	��tjjtjjt�d�g}tj|�}t
jj|�\}}|D]!}t
jj|��#|D]x}tj||�D]]}		|jj|g�j|	j��tj!d||	j"��_�zy#tj%d|�d|	j"���Y��xYw)z/Load the plugins from setuptools' entry points.rzLoaded %s plugin: %szFailed to load z	 plugin: N)�os�path�join�dirname�__file__�
pkg_resources�Environment�working_set�find_plugins�add�iter_entry_pointsr�
setdefault�append�loadr+r<�dist�critical)
rr�entry_point�plugin_dirs�env�distsr	rvr#�epts
          r
�
_load_pluginszBaseWorker._load_plugins�s���w�w�|�|�B�G�G�O�O�H�$=�y�I�J���'�'��4��%�1�1�>�>�s�C�
��v��	0�D��%�%�)�)�$�/�	0��		F�D�$�6�6�{�7;�=�
F��F��L�L�+�+�D�"�5�<�<�S�X�X�Z�H�
�I�I�4�d�C�H�H�E�
F�		F��
:��L�L�)-�s�x�x�"9�:�s�?9D�'Ec�N�gggggggg}g}g}g}d}gx}x}x}	x}
x}x}}
|ddggfS)�4This method needs to be implemented by the backends.rr)rrr`rcrd�	skip_pkgs�size�installs�
reinstalls�removals�purges�upgrades�upgradables�
downgradess              r
r_z BaseWorker._simulate_transaction�sl���r�2�r�2�r�2�.���� ���	����	��	�:�	��	�6�	�H�	�{����1�b�"�$�$rc�H�tjtj���r)r	rOr�ERROR_NOT_SUPPORTEDr8s  r
rJzBaseWorker._run_transaction�s���&�&�u�'@�'@�A�Arc��t�)zYSet a configuration option.

        This method needs to be implemented by the backends.��NotImplementedError)r�option�value�filenames    r
�
set_configzBaseWorker.set_config��
��"�!rc��t�)zYGet a configuration option.

        This method needs to be implemented by the backends.r�)rr�s  r
�
get_configzBaseWorker.get_config�r�rc��gSr�r�rs r
�get_trusted_vendor_keysz"BaseWorker.get_trusted_vendor_keys�s���	rc��y)rFrr�s r
�is_reboot_requiredzBaseWorker.is_reboot_required�s��r)NT)zaptdaemon.plugins)�__name__�
__module__�__qualname__�__doc__r�SignalFlags�	RUN_FIRST�
TYPE_PYOBJECT�__gsignals__�NATIVE_ARCHr�staticmethodr&r3r9r>r@r0r7r}r_rJr�r�r�r�rrr
rr*s���=�)0�)<�)<�)F�)F�)-�*1�*?�*?�)A�)C�/6�.A�.A�.K�.K�.2�/6�/D�/D�.F�.H�I�L��K�	��&��&�
?�
>�2�-�#�J�8F�$
%�B�"�"��rrc�"�eZdZdZd�Zd�Zd�Zy)rzCAllows to test the daemon without making any changes to the system.c�v�tjd|j�|jrt	d��||_tj
�|_tj|j_	d|j_
d|j_tjd|j|�y)r(r)r*rT��N)r+r,r-rr.rrrrHr6rI�cancellabler�timeout_addr0r1s  r
r3zDummyWorker.run�s���	���,�k�o�o�>��:�:��D�E�E� ��
�%)�Y�Y�[��"�!�0�0��
�
����
�
��!%��
�
������d�8�8�+�Frc�j�|jrtj|_�n�|jdk(rtj
|_�ni|jtjk(rtj|_�n5|jtjk(rtj
|_�n|jtjk(rtj|_�n�|jtjk(�r�|jdk(rtj|_
�ns|jdk(rtj|_
�nM|jdk(rtj|_
d|_�n |jdk(r�d|_tj$|_
d|_|j"r/t)j*�j-�|j"r�/d	|_d	|_tj|_
�n�|jd
k(rud|_d|_tj2|_
|j"r/t)j*�j-�|j"r�/tj|_
�n
|jdk(rd
|_n�|jdk(r�d|_tj6|_
n�|jtj8k(r�|jdk(rtj|_
n�|jdk(rtj|_
d|_nY|jdk(rd|_nB|jdk(rd
|_n+|jdk(rd|_tj6|_
|xjdz
c_ytj:|_
t=j<�|_|j@jBd	d	}|j@}d	|_ |jE|�tFjId|�y)zRun the workerrFr��2zHeyas!�7T)z
/etc/fstabz	/etc/mtabN�<)zDebian Lenny 5.0 CD 1z
USB CD-ROM�FzServus!�ZrWzHola!rGF)%�	cancelledrrNrLrIrK�role�ROLE_UPDATE_CACHErQ�ROLE_UPGRADE_PACKAGES�ROLE_UPGRADE_SYSTEM�ROLE_INSTALL_PACKAGESr5r6�STATUS_DOWNLOADING�STATUS_COMMITTING�status_details�paused�!STATUS_WAITING_CONFIG_FILE_PROMPT�config_file_conflictr�main_context_default�	iteration�config_file_conflict_resolution�required_medium�STATUS_WAITING_MEDIUM�status_deatils�STATUS_CLEANING_UP�ROLE_REMOVE_PACKAGES�STATUS_FINISHEDrrrr-r@r+r,)rrr-s   r
r0z!DummyWorker._run_transaction_idles����?�?��-�-�E�J�
�^�^�s�
"��+�+�E�J�
�Z�Z�5�2�2�
2��*�*�E�J�
�Z�Z�5�6�6�
6��+�+�E�J�
�Z�Z�5�4�4�
4��-�-�E�J��z�z�U�8�8�8��>�>�Q�&�#(�#=�#=�E�L��^�^�q�(�#(�#;�#;�E�L��^�^�r�)�#(�#:�#:�E�L�+3�E�(��^�^�r�)�#'�E�L�#(�#J�#J�E�L�1J�E�.��,�,��1�1�3�=�=�?� �,�,�<@�E�9�15�E�.�#(�#:�#:�E�L��^�^�r�)�-;�E�)�#'�E�L�#(�#>�#>�E�L��,�,��1�1�3�=�=�?� �,�,�#(�#;�#;�E�L��^�^�r�)�+4�E�(��^�^�r�)�+-�E�(�#(�#;�#;�E�L����u�9�9�9��>�>�Q�&�#(�#=�#=�E�L��^�^�q�(�#(�#:�#:�E�L�+3�E�(��^�^�r�)�+2�E�(��^�^�r�)�+4�E�(��^�^�r�)�+-�E�(�#(�#;�#;�E�L��N�N�a��N���,�,���%)�Y�Y�[��"��j�j�n�n�Q����
�
����
��#�#�E�*����*�C�0�rc�"�gggggggg}|ddggfS)Nrr)rrr`s   r
r9zDummyWorker.simulateIs'���r�2�r�2�r�2�.����1�b�"�$�$rN)r�r�r�r�r3r0r9rrr
rr�s��M�G� A�F%rr)r��
__author__�__all__�loggingrhrmrrT�
gi.repositoryrrrWrr	�	getLoggerr+�_rrrrr
�<module>r�si��7�"5�
�
'���	����'����g���*�+����E����E�PY%�*�Y%r

Zerion Mini Shell 1.0