%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__/pkworker.cpython-312.pyc

�

��kd����
�dZdZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlmZddlmZ	ddlZddlmZmZmZmZdd	lmZdd
lmZddlmZddlm Z ejBd
�Z"	ddl#m$Z$dZ%ejLjOdd�Z(e(dzZ)e(dzZ*dZ+	ddl,Z,ejZe)ej\�re"j_d�dZ+	dZ0dZ1dZ2dZ3dZ4dZ5dZ6idejnjp�dejnjr�dejnjt�d ejnjv�d!ejnjx�d"ejnjr�d#ejnjt�d$ejnjt�d%ejnjz�d&ejnj|�d'ejnj~�d(ejnj��d)ejnjr�d*ejnj��d+ejnj��d,ejnj��d-ejnjt�id.ejnj��d/ejnj��d0ejnjv�d1ejnjt�d2ejnjx�d3ejnjt�d4ejnjt�d5ejnjt�d6ejnj��d7ejnjr�d8ejnjt�d9ejnjr�d:ejnjt�d;ejnj��d<ejnj��d=ejnj��d>ejnj���id?ejnj��d@ejnj��dAejnjt�dBejnj��dCejnjr�dDejnjt�dEejnjt�dFejnjt�dGejnjt�dHejnj��dIejnjp�dJejnj��dKejnj|�dLejnj|�dMejnj��dNejnjt�dOejnj���ejnj�ejnj�ejnj�ejnj�ejnjtejnj�ejnj�ejnj�ejnj�ejnj�dP�
�ZQGdQ�dRe j��ZSe%rGdS�dTeje$�ZTdU�ZdV�ZdW�ZdX�Zy#e$rdZY��_wxYw#e$rdZ%Y��.wxYw#e$rY���wxYw)Ya�
Provides a compatibility layer to PackageKit

Copyright (C) 2007 Ali Sabil <ali.sabil@gmail.com>
Copyright (C) 2007 Tom Parker <palfrey@tevp.net>
Copyright (C) 2008-2011 Sebastian Heinlein <glatzor@ubuntu.com>

Licensed under the GNU General Public License Version 2

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
z%Sebastian Heinlein <devel@glatzor.de>�N)�GObject)�PackageKitGlib�)�bitfield_add�bitfield_remove�bitfield_summarize�bitfield_contains�)�enums)�TransactionFailed)�DaemonAcquireProgress)�	aptworkerzAptDaemon.PackageKitWorker)�MetaReleaseCoreTF�AXI_DB_PATHz/var/lib/apt-xapian-indexz/indexz/valueszUse XAPIAN for the searchz5closes:\s*(?:bug)?\#?\s?\d+(?:,\s*(?:bug)?\#?\s?\d+)*z\#?\s?(\d+)z3http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=%szlp:\s+\#\d+(?:,\s*\#\d+)*z"https://bugs.launchpad.net/bugs/%szCVE-\d{4}-\d{4}z2http://web.nvd.nist.gov/view/vuln/detail?vulnId=%s�admin�basezcli-mono�comm�databasezdebian-installer�debug�devel�doc�editors�	education�electronics�embedded�fonts�games�gnomezgnu-r�gnustep�graphics�hamradio�haskell�httpd�interpreters�
introspection�java�kde�kernel�libdevel�libs�lisp�localization�mail�math�misc�net�news�ocaml�oldlibs�	otherosfs�perl�php�python�ruby�science�shells�sound�tex�text�utils�vcs�video)
�virtual�web�xfce�x11�zope�unknown�alien�translations�metapackages�tasksc� �eZdZdZ	d,d�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd-d�Zd.d�Zd�Zd.d�Zd.d�Zd.d�Zd�Z d�Z!d �Z"d!�Z#d"�Z$d#�Z%d$�Z&d%�Z'd&�Z(d'�Z)d(�Z*d)�Z+d*�Z,		d/d+�Z-y)0�AptPackageKitWorkerNc��tjj|||�ttj
jtj
jtj
jtj
jtj
jtj
jtj
jtj
jtj
jtj
jtj
j tj
j"tj
j$tj
j&tj
j(tj
j*tj
j,tj
j.tj
j0�|_t4r3t7|j2tj
j8�|_ttj:j<tj:j>tj:j@tj:jBtj:jDtj:jFtj:jHtj:jJtj:jLtj:jNtj:jPtj:jRtj:jT�
|_+ttXj[��|_.tj^j`|_1dg|_2y)Nzapplication/x-deb)3r�	AptWorker�__init__r�pk�RoleEnum�
REFRESH_CACHE�UPDATE_PACKAGES�INSTALL_PACKAGES�
INSTALL_FILES�REMOVE_PACKAGES�GET_UPDATES�GET_UPDATE_DETAIL�GET_PACKAGES�GET_DETAILS�SEARCH_NAME�SEARCH_DETAILS�SEARCH_GROUP�SEARCH_FILE�
WHAT_PROVIDES�REPO_ENABLE�INSTALL_SIGNATURE�
REPAIR_SYSTEM�CANCEL�DOWNLOAD_PACKAGES�roles�META_RELEASE_SUPPORTr�GET_DISTRO_UPGRADES�
FilterEnum�	INSTALLED�
NOT_INSTALLED�FREE�NOT_FREE�GUI�NOT_GUI�COLLECTIONS�NOT_COLLECTIONS�	SUPPORTED�
NOT_SUPPORTED�ARCH�NOT_ARCH�NEWEST�filters�SECTION_GROUP_MAP�values�groups�ProvidesEnum�ANY�provides�
mime_types)�self�chroot�load_pluginss   �;/usr/lib/python3/dist-packages/aptdaemon/worker/pkworker.pyrOzAptPackageKitWorker.__init__�s*�����$�$�T�6�<�@�'����(A�(A�(*���(C�(C�(*���(D�(D�(*���(A�(A�(*���(C�(C�(*���(?�(?�(*���(E�(E�(*���(@�(@�(*���(?�(?�(*���(?�(?�(*���(B�(B�(*���(@�(@�(*���(?�(?�(*���(A�(A�(*���(?�(?�(*���(E�(E�(*���(A�(A�(*���(:�(:�(*���(E�(E�%G��
�& �%�d�j�j�&(�k�k�&E�&E�G�D�J�)�"�-�-�*A�*A�*,�-�-�*E�*E�*,�-�-�*<�*<�*,�-�-�*@�*@�*,�-�-�*;�*;�*,�-�-�*?�*?�*,�-�-�*C�*C�*,�-�-�*G�*G�*,�-�-�*A�*A�*,�-�-�*E�*E�*,�-�-�*<�*<�*,�-�-�*@�*@�*,�-�-�*>�*>�@���)�*;�*B�*B�*D�E������,�,��
�.�/���c���t|d�rJt|jjtj
j�r|j|�ytjj||�S)N�pktransF)�hasattrr	r��flagsrP�TransactionFlagEnum�SIMULATE�_simulate_and_emit_packagesrrN�_run_transaction�r~�transs  r�r�z$AptPackageKitWorker._run_transaction�sY���E�9�%��e�m�m�1�1� �4�4�=�=�
?��,�,�U�3���&�&�7�7��e�D�Dr�c��tj|_|j|�|jtj
k(�rv|jtjD]L}|j||j|j|�dtjj��N|jtjD]L}|j||j|j|�dtjj��N|jtj D]L}|j||j|j|�dtjj"��N|jtj$D]L}|j||j|j|�dtjj"��N|jtj&D]N}|j||j|j|�dtjj(d���P|jtj*D]N}|j||j|j|�dtjj,d���P|jtj.D]N}|j||j|j|�dtjj0d���P|j2D]<}|j||j|tjj4d���>tj6|_d|_tj:|_|j<dd}d|_d|_ |jC|�tDjGd|�y)NrT��force_candidate�dzFinished transaction %s)$�
aptd_enums�STATUS_RUNNING�status�_simulate_transaction_idle�exit�EXIT_UNFINISHED�depends�PKGS_INSTALL�
_emit_package�_cache�_split_package_idrP�InfoEnum�
INSTALLING�PKGS_REINSTALL�REINSTALLING�PKGS_REMOVE�REMOVING�
PKGS_PURGE�PKGS_UPGRADE�UPDATING�PKGS_DOWNGRADE�DOWNGRADING�	PKGS_KEEP�BLOCKED�unauthenticated�	UNTRUSTED�STATUS_FINISHED�progress�EXIT_SUCCESS�tidr��
marked_tid�_emit_transaction_done�pklog�info)r~r��pkgr�s    r�r�z/AptPackageKitWorker._simulate_and_emit_packages�s`��!�0�0����'�'��.��:�:��3�3�3��}�}�Z�%<�%<�=�
;���"�"�5�#'�;�;�t�/E�/E�c�/J�1�/M�#N�#%�;�;�#9�#9�;�
;��}�}�Z�%>�%>�?�
=���"�"�5�#'�;�;�t�/E�/E�c�/J�1�/M�#N�#%�;�;�#;�#;�=�
=��}�}�Z�%;�%;�<�
9���"�"�5�#'�;�;�t�/E�/E�c�/J�1�/M�#N�#%�;�;�#7�#7�9�
9��}�}�Z�%:�%:�;�
9���"�"�5�#'�;�;�t�/E�/E�c�/J�1�/M�#N�#%�;�;�#7�#7�9�
9��}�}�Z�%<�%<�=�
O���"�"�5�#'�;�;�t�/E�/E�c�/J�1�/M�#N�#%�;�;�#7�#7��#�O�
O��}�}�Z�%>�%>�?�
9���"�"�5�#'�;�;�t�/E�/E�c�/J�1�/M�#N�#%�;�;�#:�#:�37�#�9�
9�
�}�}�Z�%9�%9�:�
N���"�"�5�#'�;�;�t�/E�/E�c�/J�1�/M�#N�#%�;�;�#6�#6��#�N�
N��,�,�
P���"�"�5�$�+�+�c�*:�#%�;�;�#8�#8�$�#�P�
P�&�5�5�E�L� �E�N�#�0�0�E�J��i�i��l����
�����#�#�E�*�
�
�
�,�c�2r�c�r	�|jtjk7rttjd��|j
jtjjk(r|j|fi|j��y|j
jtjjk(r|j|fi|j��y|j
jtjjk(r|j|fi|j��y|j
jtjjk(r|j |fi|j��y|j
jtjj"k(r|j$|fi|j��y|j
jtjj&k(r|j(|fi|j��y|j
jtjj*k(r|j,|fi|j��y|j
jtjj.k(r|j0|fi|j��y|j
jtjj2k(r|j4|fi|j��y|j
jtjj6k(r|j8|fi|j��y|j
jtjj:k(r|j<|fi|j��y|j
jtjj>k(r|j@|fi|j��y|j
jtjjBk(r|jD|fi|j��y|j
jtjjFk(r|jH|fi|j��yttjd|j
j��)zRun the workerz*The transaction doesn't seem to be a queryzRole %s isn't supportedN)%�roler��
ROLE_PK_QUERYr�
ERROR_UNKNOWNr�rPrQ�RESOLVE�resolve�kwargsrW�get_updatesrX�get_update_detailrY�get_packages�	GET_FILES�	get_filesr[�search_namesr]�
search_groupsr\�search_detailsr^�search_filesrZ�get_detailsrd�download_packagesr_�
what_providesr`�repo_enablera�install_signaturer�s  r��queryzAptPackageKitWorker.query
s7���:�:��1�1�1�#�J�$<�$<�%.�/�
/��=�=������!4�!4�4��D�L�L��/�%�,�,�/�
�]�]�
�
�2�;�;�#:�#:�
:��D���U�3�e�l�l�3�
�]�]�
�
�2�;�;�#@�#@�
@�"�D�"�"�5�9�E�L�L�9�
�]�]�
�
�2�;�;�#;�#;�
;��D���e�4�u�|�|�4�
�]�]�
�
�2�;�;�#8�#8�
8��D�N�N�5�1�E�L�L�1�
�]�]�
�
�2�;�;�#:�#:�
:��D���e�4�u�|�|�4�
�]�]�
�
�2�;�;�#;�#;�
;��D���u�5����5�
�]�]�
�
�2�;�;�#=�#=�
=��D����6����6�
�]�]�
�
�2�;�;�#:�#:�
:��D���e�4�u�|�|�4�
�]�]�
�
�2�;�;�#:�#:�
:��D���U�3�e�l�l�3�
�]�]�
�
�2�;�;�#@�#@�
@�"�D�"�"�5�9�E�L�L�9�
�]�]�
�
�2�;�;�#<�#<�
<��D���u�5����5�
�]�]�
�
�2�;�;�#:�#:�
:��D���U�3�e�l�l�3�
�]�]�
�
�2�;�;�#@�#@�
@�"�D�"�"�5�9�E�L�L�9�#�J�$<�$<�$=�$)�M�M�$6�$6�8�
8r�c��d|_t�}tjj	d��rZt|tjj��s5tjd�g}|D]B}|jd�rd|ddjdd�z}nd	|z}|j|��Ddd
ddd
dj|�g}tjd|z�tj |tj"tj"��}	|	j%�\}
}|	j&dk(r3|j)|
j+��|j-|||�nt/t0j2|
�d|����g}|D]?}|jd�rd|jdd�z}nd|z}|j|��At5j6dj|��}|j9�D]M}
|
j:|vr�|j=|
�D](}|j?|�s�|jA|||
��M�Oy)z�Implement org.freedesktop.PackageKit.Transaction.SearchFiles()

        Works only for installed file if apt-file isn't installed.
        �ez/usr/bin/apt-filezUsing apt-file�/z^%s$r
Nz\/z\/%s$z--regexpz--non-interactivez--package-only�find�|zCalling: %s)�stdout�stderrr� z.*\/%s$)!r��set�os�path�existsr	rPrhrir�r�
startswith�replace�append�join�
subprocess�Popen�PIPE�communicate�
returncode�update�split�_emit_visible_packages_by_namerr��ERROR_INTERNAL_ERROR�re�compile�_iterate_packages�name�_get_installed_files�match�_emit_visible_package)r~r�rvrx�result_names�filenames_regex�filename�pattern�cmd�apt_filer�r��
files_patternr��installed_files               r�r�z AptPackageKitWorker.search_files1s/��
����u��
�G�G�N�N�.�/�%�g�r�}�}�/F�/F�G�
�K�K�(�)� �O�"�
0���&�&�s�+�$�x���|�';�';�C��'F�F�G�%��0�G��&�&�w�/�
0�'�
�4G�#�V�S�X�X�o�-F�H�C��K�K�
��+�,�!�'�'��J�O�O�/9���@�H�%�1�1�3�N�F�F��"�"�a�'�
�#�#�F�L�L�N�3��3�3�E�7�4@�B�(�
�(G�(G�39�6�(B�D�D����	,�H��"�"�3�'� �8�#3�#3�C��#>�>��#�h�.���"�"�7�+�	,��
�
�3�8�8�O�#<�=�
��)�)�+�	�C��x�x�<�'��"&�";�";�C�"@�
�� �&�&�~�6��.�.�u�g�s�C��
�	r�c��d|_|j�D]>}tj|j	|��}||vs�,|j|||��@y)z?Implement org.freedesktop.PackageKit.Transaction.SearchGroups()r�N)r�r�rP�group_enum_to_string�_get_package_groupr�)r~r�rvrxr��	group_strs      r�r�z!AptPackageKitWorker.search_groupsksZ������)�)�+�	@�C��/�/��0G�0G��0L�M�I��F�"��*�*�5�'�3�?�	@r�c��d�}d|_t|jj��D],}|||�s�
|j	|||j|��.y)z>Implement org.freedesktop.PackageKit.Transaction.SearchNames()c��|D]}||vs�yy�NFT���searchesr=�searchs   r��matchesz1AptPackageKitWorker.search_names.<locals>.matchesws!��"�
!����%� �
!�r�r�N)r��listr��keys�_emit_all_visible_pkg_versions)r~r�rvrxr��pkg_names      r�r�z AptPackageKitWorker.search_namesus\��	�
����T�[�[�-�-�/�0�	K�H��v�x�(��3�3�E�7�48�K�K��4I�K�	Kr�c���d|_tdu�r}tjjtjj
ztjjztjjz}tjd�tjt�}tj�}|jtjj�|jdj!|�|�}tj"|�}|j%|�|j'dd�}	d�|j'dd�D�D]1}
|
|j(vs�|j+|||j(|
��3y
d�}	tjd	�|D�cgc]}|j-���}}|j/�D]�}|j0}
	|
|j2j4j-�z
}
|
|j2j6j8j-�z
}
|	||
�s�r|j+|||���y
cc}w#t:$rY�0wxYw)z@Implement org.freedesktop.PackageKit.Transaction.SearchDetails()r�Tz!Performing xapian db based searchr�ri�c3�PK�|]}|jj���� y�w�N)�document�get_data)�.0r�s  r��	<genexpr>z5AptPackageKitWorker.search_details.<locals>.<genexpr>�s'����E�!&�#�^�^�4�4�6�E�s�$&c��|D]}||vs�yyr�r�r�s   r�r�z3AptPackageKitWorker.search_details.<locals>.matches�s!��&�%�F��T�)�$�%�r�z!Performing apt cache based searchN)r��XAPIAN_SUPPORT�xapian�QueryParser�FLAG_BOOLEAN�FLAG_PHRASE�
FLAG_LOVEHATE�FLAG_BOOLEAN_ANY_CASEr�r�Database�	XAPIAN_DB�set_default_op�Query�OP_AND�parse_queryr��Enquire�	set_query�get_msetr�r��lowerr�r��	candidate�raw_description�_translated_records�	long_desc�AttributeError)r~r�rvrx�search_flags�db�parserr��enquirer�r�valr��txts              r�r�z"AptPackageKitWorker.search_details�s������T�!�"�.�.�;�;�"�.�.�:�:�;�"�.�.�<�<�=�#�.�.�D�D�E�L�
�K�K�;�<�����+�B��'�'�)�F��!�!�&�,�,�"5�"5�6��&�&�s�x�x��'7��F�E��n�n�R�(�G����e�$��&�&�q�$�/�G�E�*1�*:�*:�1�d�*C�E�
F���t�{�{�*��.�.�u�g�/3�{�{�8�/D�F�
F�
�

�K�K�;�<�-3�4�c�c�i�i�k�4�F�4��-�-�/�
D���h�h����3�=�=�8�8�>�>�@�@�C��3�=�=�<�<�F�F�L�L�N�N�C��6�3�'��.�.�u�g�s�C�
D��5��&����s�*I�#AI � 	I,�+I,c�j�d�}d|_d|_	|jjd��|j�D�]�}|js�|jjs�(|js.|j||tjjd���btjj}|jjd}|j}|j }|j"}	|j$}
|dvr�|	dur�|j'd	�s|
d
k(rtjj(}n�||�r=t*j-d|j.z�tjj(}nW|j'd�rtjj0}n+|j'd
�rtjj2}|dvr|	durtjj0}|j|||d�����|j5|�y#t$rY��wxYw)z�Only report updates which can be installed safely: Which can depend
        on the installation of additional packages but which don't require
        the removal of already installed packages or block any other update.
        c���|jD]�}|jrotj|j|jj�dkr8tj|j|j
j�dkDr�~|jD]K}|jdvs�|jjd�s|jdk(s�=|js�Jy��y)a
            Return True if an update succeeds a previous security update

            An example would be a package with version 1.1 in the security
            archive and 1.1.1 in the archive of proposed updates or the
            same version in both archives.
            r��Debian�Ubuntu�	-security�Debian-SecurityTF)�versions�	installed�apt_pkg�version_compare�versionr�origins�origin�archive�endswith�label�trusted)r�r1r3s   r��succeeds_security_updatezAAptPackageKitWorker.get_updates.<locals>.succeeds_security_update�s����<�<�

$���M�M��+�+�G�O�O�,/�M�M�,A�,A�C�FG�H��+�+�G�O�O�,/�M�M�,A�,A�C�EF�G��%�o�o�$�F��
�
�)=�=�#�^�^�4�4�[�A�#�\�\�->�>�"�N�N�#�$�

$�r�Fr�T)�dist_upgrader�rr(r+r,z>Update of %s succeeds a security update. Raising its priority.z
-backportsz-updates)zBackports.org archiveN)�cancellabler�r��upgrade�SystemErrorr��
is_upgradablerr2�marked_upgrader�rPr�r��NORMALr4r3r7r6r5�SECURITYr�rr��ENHANCEMENT�BUGFIX�_emit_require_restart)r~r�rvr8r�r��candidate_originr4r3r7r6s           r�r�zAptPackageKitWorker.get_updates�s���
	�0!�����
�	��K�K���T��2��)�)�+�!	G�C��$�$���=�=�(�(���%�%��"�"�5�#�r�{�{�/B�/B�37�#�9���;�;�%�%�D�"�}�}�4�4�Q�7��&�.�.�G�%�,�,�F�&�.�.�G�$�*�*�E��-�-�'�T�/��#�#�K�0�E�=N�4N��;�;�/�/�D�-�c�2��K�K�!8�:=�(�(�!C�D��;�;�/�/�D��%�%�l�3��;�;�2�2�D��%�%�j�1��;�;�-�-�D��2�2�w�$���{�{�.�.�����u�c�4���F�C!	G�D	
�"�"�5�)��I�	��	�s�H%�%	H2�1H2c��|j�r5|jjtjj
d�yy)z Emit RequireRestart if required.�N)�is_reboot_requiredr��RequireRestartrP�RestartEnum�SYSTEMr�s  r�rCz)AptPackageKitWorker._emit_require_restart�s3���"�"�$��M�M�(�(����)>�)>��C�%r�c�,�d�}d�}d|_d|_tjj|j
_t|�}d}tjtj�}tjtjd�|D�]}|j�|dz|z|_|dz
}|j|�}	|	jjrE|	jjdj }
t#|
t$�r|
j'd�}
nd	}
|	j(�d
|	jj*�d
|	jj,�d
|
��g}t/�}|	j0r�|	j0j3d�D]�}
|
D]�}	|j4|j(}|js�*|j8rpt;j<|j0j*|j*�}|dk(r|j8dvr�~|dkr|j8d
vr��|dkDr|j8dvr��|j?|j�}|jA|�����g}tjBjD}d	}tjFjH}|	j0r�|	j0jdjJr�|	j0jdj dk(r�|	j0jdjL}|dk(rtjFjN}n?|dk(rtjFjP}n|dk(rtjFjR}d	}d	}|	j(jUd�s|	j(dvr|tjBjVk(t:jXj[d�}|dk(r=t\j^jat:jXj[d�d�}t\j^ja||	j(�d|	j0j*�d��}d	}t\j^jc|�r[tdjgd�tijj|d�}	|jm�j'd�}|jo�|�s<tdjgd�|	jq�}t#|tr�s|j'd�}t\j^jc|�st]jt|�t\j^ja|d|	j(z�}twjv|�D]5}t]jxt\j^ja||���7tijj|d� �}	|j{|j}d��|jo�d	}|jd!�D�]%} | d	k(r|d"z
}n|d#| zz
}| jU|	j0j��rLt�j�d$| �}!||!j�d%��d!d&t|!j�d%��z�d'�z
}��| jUd(�r	|d)| zz
}��| jUd*�s��|d+z
}t�j�d,| �}!|!s��	t�j�j�|!j�d-�d.�}"|"j��}|r��|"j��}��(||k(rd	}||�}#||�}$|j�|||||#|$||||||���
tjtj|�y/#t6$rY��2wxYw#Y���xYw#|jo�wxYw#|jo�wxYw#t�$rY���wxYw)0zJ
        Implement the {backend}-get-update-details functionality
        c��g}tjt|tjtjz�D]@}|jtjt|�D�cgc]}t|z��
c}��Btjt|tjtjz�D]@}|jtjt|�D�cgc]}t|z��
c}��B|Scc}wcc}w)zX
            Create a list of urls pointing to closed bugs in the changelog
            )
r��findall�MATCH_BUG_CLOSES_DEBIAN�
IGNORECASE�	MULTILINE�extend�MATCH_BUG_NUMBERS�HREF_BUG_DEBIAN�MATCH_BUG_CLOSES_UBUNTU�HREF_BUG_UBUNTU)�	changelog�urls�r�bugs    r��get_bug_urlsz;AptPackageKitWorker.get_update_detail.<locals>.get_bug_urls�s����D��Z�Z� 7�� "�
�
���� <�>�
@������Z�Z�(9�1�=�?�s�_�s�2�?�@�
@��Z�Z� 7�� "�
�
���� <�>�
@������Z�Z�(9�1�=�?�s�_�s�2�?�@�
@��K��
?��?s�'C?
�$D
c��tjt|tj�D�cgc]}t|z��
c}Scc}w)zZ
            Create a list of urls pointing to cves referred in the changelog
            )r�rM�	MATCH_CVErP�HREF_CVE)rV�cs  r��get_cve_urlsz;AptPackageKitWorker.get_update_detail.<locals>.get_cve_urlss=��+-�*�*�Y�	�57�\�\�+C�D�Q�H�q�L�D�
D��Ds�?rFr
�Cr��UTF-8rF�;�Replaces)�>�<)re)rdr)�stable�testing�unstablezlinux-image-)�libc6�dbuszDir::Cache::Changelogsr�z
Dir::Cache�
Changelogs�_z.gzzReading changelog from cache�rbzDownloading changelogz%s_*�wb)�mode�
z 
z	    %s  
zH(?P<source>.+) \((?P<version>.*)\) (?P<dist>.+); urgency=(?P<urgency>.+)r1�=z

z  z%s

z --z  
zM^ -- (?P<maintainer>.+) (?P<mail><.+>)  (?P<date>.+) (?P<offset>[-\+][0-9]+)$�datez%a, %d %b %Y %H:%M:%SN)Ir�r:rP�
StatusEnum�DOWNLOAD_CHANGELOGr�r��len�locale�	getlocale�LC_TIME�	setlocale�_iterate_mainloop�_get_package_by_idr.r2r6�
isinstance�bytes�decoder�r1�architecturer�r�get_dependenciesr��KeyError�relationr/r0�_get_id_from_version�addrI�NONE�UpdateStateEnum�UNKNOWNr7r4�STABLE�TESTING�UNSTABLEr�rJ�config�find_dirr�r�r�r�r�r�gzip�open�read�close�
get_changelog�str�makedirs�glob�remove�write�encoder��source_namer�r��group�datetime�strptime�
ValueError�	isoformat�emit_update_detail)%r~r��package_idsrZr_�total�count�
old_locale�pkg_idr��installed_origin�updates�	obsoletes�	dep_group�dep�obs�cmp�obs_id�vendor_urls�restart�update_text�stater4�issued�updated�
changelog_dirr��
changelog_raw�changelog_filer��
old_changelogrV�liner�rr�
bugzilla_urls�cve_urlss%                                     r�r�z%AptPackageKitWorker.get_update_detail�s���
	�	D����!���!�}�}�?�?��
�
���K� �����%�%�f�n�n�5�
��������-�!�O	=�F��"�"�$�"�S�[�5�0�E�N��Q�J�E��)�)�&�1�C��}�}�$�$�#&�=�=�#8�#8��#;�#A�#A� ��.��6�'7�'>�'>�w�'G�$�#%� �(+���#�-�-�2G�2G�(+�
�
�(B�(B�(8�:�;�G���I��}�}�!$���!?�!?�
�!K�.�I�(�.��%�"&�+�+�c�h�h�"7�C� #�}�}�$��<�<�")�"9�"9� #�
�
� 5� 5� #���#-�C� #�a�x�C�L�L�J�,F� (�!$�q��S�\�\�U�-B� (�!$�q��S�\�\�U�-B� (�!%�!:�!:�3�=�=�!I��!�
�
�f�-�+.�.�.�K��n�n�)�)�G��K��&�&�.�.�E��
�
�#�-�-�"7�"7��":�"B�"B��M�M�)�)�!�,�2�2�h�>��-�-�/�/��2�:�:���h�&��.�.�5�5�E��	�)��.�.�6�6�E��
�*��.�.�7�7�E��F��G����#�#�N�3��H�H� 1�1��2�>�>�0�0�0�#�N�N�3�3�4L�M�M���#� "�����W�^�^�-D�-D�FM�.N�-9�!;�
��w�w�|�|�M�25�(�(�25�-�-�2G�2G�%I�J�H��M��w�w�~�~�h�'����:�;�!%���8�T�!:��+�$2�$7�$7�$9�$@�$@��$I�M�#�(�(�*� ����3�4� #� 1� 1� 3�
�"�-��5�$1�$8�$8��$A�M��w�w�~�~�m�4��K�K�
�.��'�'�,�,�}�f�s�x�x�6G�H��%)�Y�Y�w�%7�J�M��I�I�b�g�g�l�l�=�-�H�I�J�!%���8�$�!?��+�"�(�(��)=�)=�g�)F�G�"�(�(�*��I�%�+�+�D�1�!
3���2�:���&�I����!4�4�I��?�?�3�=�=�#<�#<�=��H�H�&M�%)�+�E� �5�;�;�y�3I�36�36�u�{�{�9�7M�3N�4O�$P�P�K��_�_�T�*� �8�d�?�2�K��_�_�U�+��6�)�K��H�H�&M�%)�+�E�!� �!�'�0�0�9�9�%�+�+�f�:M�;E� F��
"�^�^�-�F�"�"&�.�.�"2��C!
3�D�� ���(��3�M�#�I�.�H��$�$�V�W�i��%2�H�g�%0�)�%*�F�G�
=�YO	=�`	�������4��s (�%�$�%��l���"�(�(�*��&#�(�(�*��@&�!� �!�sH�"_�?_�= _1�/`�	_	�_	�_�_�_.�1`�	`�`c	�J�d|_|D]�}|j|�}|j}|r%|djdvr|djdvrd}nd}|j|j�}|j||||j|j|j���y)z=Implement org.freedesktop.PackageKit.Transaction.GetDetails()r�r��main�universer(�freerFN)r��_get_version_by_idr2�	componentr3r��package�emit_details�description�homepage�size)r~r�r�r�r1r2�licenser�s        r�r�zAptPackageKitWorker.get_details�s������!�	?�F��-�-�f�5�G��o�o�G���A�J�(�(�,@�@��A�J�%�%�)=�=� ��#���+�+�G�O�O�<�E����v�w��w�7J�7J�&�/�/����
?�	?r�c��d|_|j�D]'}|j||�s�|j||��)y)z>Implement org.freedesktop.PackageKit.Transaction.GetPackages()r�N)r�r��_is_package_visibler�)r~r�rvr�s    r�r�z AptPackageKitWorker.get_packages�sA����
��)�)�+�	/�C��'�'��W�5��"�"�5�#�.�	/r�c�z�tj|_d|_d|_|D]8}	|j|�}|j
||�r|j||��:y#t$rYnwxYw	|j|}|j|||��o#t$rttjd|��wxYw)z:Implement org.freedesktop.PackageKit.Transaction.Resolve()r�Fz&Package name %s could not be resolved.N)r��STATUS_QUERYr�r�r:r��_is_version_visible�_emit_pkg_versionr�r�rr�r�ERROR_NO_PACKAGE)r~r�rv�packagesr�r1r�s       r�r�zAptPackageKitWorker.resolve�s���!�.�.������ ����	I�D�
��1�1�$�7���+�+�G�W�=��*�*�5�'�:��	I���
��
��
I��k�k�$�'���3�3�E�7�C�H���
;�'�
�(C�(C�)4�59�;�;�
;�s�A"�"	A.�-A.�2B�%B:c������dtjjf��fd�	�����fd�}tj�_d�_d�_ddg}tjdr|jd	�|D]�}�j|�}|j|�D]�}	|	jD]�}
�jj|
j �r4�jj#|
j �D]}|||
��
�\|
j �jvr!|�j|
j |
�����|
��
�������y)zrEmit all dependencies of the given package ids.

        Doesn't support recursive dependency resolution.
        Nc���tjj|vry|rM|jj}t|tjj�}�j||�syd}|jr|j�|j��}n|j}�j|j�d|�d�tjj|�y)z`Send a blocked package signal for the given
            apt.package.BaseDependency.
            NrFrbz;;)rPrhrir�summaryrrjr�r�r1�emit_packager�r�r�)�base_dependencyr�rvr�r1r~r�s     ��r��emit_blocked_dependencyz@AptPackageKitWorker.get_depends.<locals>.emit_blocked_dependency�s����
�}�}�&�&�'�1����-�-�/�/��)�'�2�=�=�3N�3N�O���/�/��W�=�����'�'�$3�$<�$<�$3�$;�$;�=��*�1�1�����O�,@�,@�'�J�!�{�{�2�2�G�
=r�c�b���j|��sy|jr�d}t|j�}|jr7|j|j�|j
d|j�|jr7|j|j�|j
d|j�|D]M}tj|j|j|j�s�9�j�|�d}n|s�||��yy�j�|�y)z�Check if the given apt.package.Package can satisfy the
            BaseDepenendcy and emit the corresponding package signals.
            NFrT)
r�r1r�r-r.r��insertrr/�	check_depr�r�r�)	r��base_dep�	satisfied�ver_list�dep_verr�rvr~r�s	     ����r��check_dependencyz9AptPackageKitWorker.get_depends.<locals>.check_dependency�s�����+�+�C��9�����!�	� ����-���=�=��O�O�C�M�M�2��O�O�A�s�}�}�5��=�=��O�O�C�M�M�2��O�O�A�s�}�}�5�'��G��(�(����)1�):�):�)1�)9�)9�;��.�.�u�g�>�$(�	��
�!�+�H�c�7�C�!��"�"�5�#�.r�r�T�
PreDepends�DependszAPT::Install-Recommends�
Recommends)rv)rPrhr�r��STATUS_RESOLVING_DEPr�r�r:r/r�r�r�r��or_dependenciesr��is_virtual_packager��get_providing_packages)
r~r�rvr��	recursiver��dependency_types�idr1�
dependencyr��providerr�s
```         @r��get_dependszAptPackageKitWorker.get_depends�s<���
:>�,.�M�M�,>�,>�	=�,	/�<!�5�5���������(�)�4���>�>�3�4��#�#�L�1��	A�B��-�-�b�1�G�6�g�6�6�8H�I�

A�
� *� :� :�A�H��{�{�5�5�h�m�m�D�(,���(J�(J� (�
�
�)/�A�H�,�X�x�@�A�"���$�+�+�5�(����X�]�]�)C�X�N�0��x�8?�A�A�

A�	Ar�c��tj|_d|_d|_|D]�}|j|�}|j
�D]�}|j||�s�|jr
|j}n|jr|j}jD]j}	d}
|	jD]A}|jj|jk(s|j|jvs�?d}
n|
s�X|j!||�������y)zhEmit all packages which depend on the given ids.

        Recursive searching is not supported.
        r�TFN)r�r�r�r�r:r�r�r��is_installedr.r�dependenciesr�r�r�r|r�)r~r�rvr�r�r�r1r��pkg_verr�r�r�s            r��get_requiresz AptPackageKitWorker.get_requires1s��
!�5�5�����
�����	�B��-�-�b�1�G��-�-�/�
���/�/��W�=���#�#�!�m�m�G��]�]�!�m�m�G�")�"6�"6�	�J� %�I�$.�$>�$>�"��#�O�O�0�0�H�M�M�A� (�
�
��1A�1A� A�(,�I�!�	"�
!��*�*�5�#�6��	�
�	r�c����fd�}tj|_d|_d|_|r t
jjd�}ntjd��}tjj|�r$tj|tj�sttj d|z��||�D]�\}}}}	t#|||	�}
�j%||t&j(j*�	|j-||
�tjj/|tjj1|j2��}|j5||g��j%||t&j(j6���y#t8$r(}ttj:t=|���d}~wwxYw)	zjImplement the DownloadPackages functionality.

        The store_in_cache parameter gets ignored.
        c3�\�K�d}d}g}|D]^}�	j|�}|jsttjd|z��||j
z
}|j
||f��`|D]9\}}|dz|z}||j
dz|zz}||||f��||j
z
}�;y�w)zZCalculate the start and end point of a package download
            progress.
            rzpackage %s isn't downloadabler�N)r��downloadablerr��ERROR_PACKAGE_DOWNLOAD_FAILEDr�r�)
�idsr��
downloadedr-r�r��ver�start�endr~s
         �r��get_download_detailszCAptPackageKitWorker.download_packages.<locals>.get_download_detailsRs�������E��J��H��
/���1�1�"�5���+�+�+�"�@�@�7�"�<�>�>�����%������W�
�.�
/�$�
'���C�"�S�(�5�0���c�h�h��n�u�4�4���#�u�c�)�)��c�h�h�&�
�	
'�s�B)B,T�
zDir::Cache::archiveszaptdaemon-download)�prefixz"The directory '%s' is not writableN)r��STATUS_DOWNLOADINGr�r:r�r/r�r��tempfile�mkdtempr�r��isdir�access�W_OKrr�r
r�rPr��DOWNLOADING�fetch_binaryr��basenamer��
emit_files�FINISHED�	Exceptionr�r�)
r~r��store_in_cacher�r��destr�r�r�r�r�r��errors
`            r�r�z%AptPackageKitWorker.download_packagesMsz���
	'�*"�4�4��� ��������>�>�*�*�+A�B�D��#�#�+?�@�D��w�w�}�}�T�"�"�)�)�D�"�'�'�*B�#�J�$C�$C�$H�$(�%)�*�
*�$8��#D�	I��B��U�C�,�U�E�3�?�H��"�"�5�#�r�{�{�/F�/F�G�
I�� � ��x�0�
�w�w�|�|�D�"�'�'�*:�*:�3�<�<�*H�I��� � ��d�V�,��&�&�u�c�2�;�;�3G�3G�H�	I��
�
J�'��<�<�c�%�j�J�J��
J�s�F%�%	G�.#G�Gc�v�|D]4}|j|�}|j||j|���6y)z�Emit the Files signal which includes the files included in a package
        Apt only supports this for installed packages
        N)r{rr�)r~r�r�r�r�s     r�r�zAptPackageKitWorker.get_files�s@���	A�B��)�)�"�-�C����R��!:�!:�3�!?�@�	Ar�c��|j�d}tj|�}|jj	dg�D]a}t
j
dt|�t|��|D]1}	||j||�D]}	|j|||	��d}�3�c|sN|tjjk7r0ttjdtj|�z��yy#t$rY��wxYw)z@Emit all packages which provide the given type and search value.Fr�z"calling what_provides plugin %s %sTz Query type '%s' is not supportedN)�
_init_pluginsrP�provides_enum_to_string�_plugins�getr�rr�r�r��NotImplementedErrorrzr{rr��ERROR_NOT_SUPPORTED)
r~r�rv�
provides_typerx�supported_type�provides_type_str�plugin�search_itemr�s
          r�r�z!AptPackageKitWorker.what_provides�s���������6�6�}�E���m�m�'�'���<�	�F��K�K�<��F��S��\�
3�%�
���#)�$�+�+�7H�*5�$7�L���2�2�5�'�7�K�L�&*�N�
�	��-�2�?�?�3F�3F�"F�#�J�$B�$B�$F�$&�$>�$>�}�$M�%N�O�
O�#G�~��	+����s�6.C9�9	D�Dc	��|sttjd��|j�}t	|�dks|ddvrttjd|z��|j||d|d|d|ddd	d�y)
zEnable or disable a repository.z)Disabling repositories is not implemented�r)�debzdeb-srcz Unknown repository ID format: %sr
rNrF)rr�rr�ru�add_repository)r~r��repo_id�enabled�fieldss     r�r�zAptPackageKitWorker.repo_enable�s����#�J�$B�$B�%2�3�
3�������v�;��?�f�Q�i�/A�A�#��.�.�2�W�<�>�
>�	
���E�6�!�9�f�Q�i����"�1�2�J��D�	2r�c�"�|tjjk7rttj
d|z��	tjd}|j|||�y#t$r"tj�ddk(rd}nd}Y�>wxYw)zInstall an archive key.zType %s is not supported�APTDAEMON_KEYSERVERrr*zhkp://keyserver.ubuntu.com:80zhkp://keys.gnupg.netN)rP�SigTypeEnum�GPGrr�rr��environr��platform�dist�add_vendor_key_from_keyserver)r~r��sig_type�key_id�
package_id�	keyservers      r�r�z%AptPackageKitWorker.install_signature�s����r�~�~�)�)�)�#�J�$B�$B�$>��$I�K�
K�	3��
�
�#8�9�I�	
�*�*�5�&�)�D���	3��}�}��q�!�X�-�;�	�2�	��		3�s�A#�#(B�
Bc��|jr;|jdj}t|t�r|j	d�}nd}|j
|jdfvr|jj}n(|jjjd�d}|�d|j�d|j
�d|��}|S)z9Return the package id of an apt.package.Version instance.rrarF�all�:rb)r2r6r|r}r~r�NATIVE_ARCHr�r�r�r1)r~r1r3r�r�s     r�r�z(AptPackageKitWorker._get_id_from_version�s����?�?��_�_�Q�'�-�-�F��&�%�(����w�/���F����D�$4�$4�e�#<�<��?�?�'�'�D��?�?�'�'�-�-�c�2�1�5�D�"�G�O�O�%�2�2�F�<���	r�c��|jr|r*|jr|j||j|�y|jr|j||j|�ytjd|jz�y)zA
        Send the Package signal for a given apt package
        z"Package %s hasn't got any version.N)r�rr�r.r�rr�)r~r�r�r�r�s     r�r�z!AptPackageKitWorker._emit_package�s`��� � �O�����"�"�5�#�-�-��>�
�
�
��"�"�5�#�-�-��>��K�K�<�s�x�x�G�Hr�c��|j|�}|jjd�d}|s�||jjk(r;|dk(rt
jj}nUt
jj}n:|dk(rt
jj}nt
jj}|j|||j�y)z9Emit the Package signal of the given apt.package.Version.r����rIN)
r��sectionr�r�r.rPr��COLLECTION_INSTALLEDri�COLLECTION_AVAILABLE�	AVAILABLEr�r�)r~r�r1r�r�r0s      r�r�z%AptPackageKitWorker._emit_pkg_version�s���
�
&�
&�w�
/���/�/�'�'��,�R�0����'�/�/�3�3�3��n�,��;�;�;�;�D��;�;�0�0�D��n�,��;�;�;�;�D��;�;�0�0�D�
���4��W�_�_�5r�c�p�|jD]'}|j||�s�|j||��)y)z)Emit all available versions of a package.N)r-r�r�)r~r�rvr�r1s     r�rz2AptPackageKitWorker._emit_all_visible_pkg_versions�s5���|�|�	7�G��'�'���9��&�&�u�g�6�	7r�c�P�|j||�r|j|||�yy)z+
        Filter and emit a package
        N�r�r�)r~r�rvr�r�s     r�r�z)AptPackageKitWorker._emit_visible_package�s+���#�#�C��1����u�c�4�0�2r�c�^�|D](}|j||�s�|j|||��*y)z*
        Filter and emit packages
        Nr6)r~r�rv�pkgsr�r�s      r��_emit_visible_packagesz*AptPackageKitWorker._emit_visible_packages�s5���	5�C��'�'��W�5��"�"�5�#�t�4�	5r�c��|D]Q}||jvs�|j|j||�s�2|j||j||��Sy)zb
        Find the packages with the given namens. Afterwards filter and emit
        them
        N)r�r�r�)r~r�rvr8r�r�s      r�r�z2AptPackageKitWorker._emit_visible_packages_by_namesU��
�	C�D�����#��,�,�T�[�[��->��H��"�"�5�$�+�+�d�*;�T�B�	Cr�c��|tjjk(ryt|tjj�r|j
j|k7ryt|tjj�r|j
j|k7ryt|tjj�r|j
j|k(ryt|tjj�r|j|j
�syt|tjj�r|j|j
�ryt|tjj�r|j|�syt|tjj�r|j|�ryt|tjj �r|j#|j
�syt|tjj$�r|j#|j
�ryt|tjj&�r|j)|j
�syt|tjj*�r|j)|j
�ryt|tjj,�r|j/|j
�syt|tjj0�r|j/|j
�ryt|tjj2�r|j4|j6dfvryt|tjj8�r|j4|j6dfvryy)zTReturn True if the package version is matched by the given
        filters.
        TFr*)rPrhr�r	rur�rrir.rjrq�_is_package_supportedrrrk�_is_version_freerlrm�_has_package_guirnro�_is_package_collectionrp�DEVELOPMENT�_is_package_devel�NOT_DEVELOPMENTrsrr,rt)r~r1rvs   r�r�z'AptPackageKitWorker._is_version_visibles����b�m�m�(�(�(���g�r�}�}�';�';�<����)�)�W�4���g�r�}�}�'>�'>�?����)�)�W�4���g�r�}�}�'B�'B�C����)�)�W�4���g�r�}�}�'>�'>�?��.�.�w���?���g�r�}�}�'B�'B�C��*�*�7�?�?�;���g�r�}�}�'9�'9�:��)�)�'�2���g�r�}�}�'=�'=�>��%�%�g�.���g�r�}�}�'8�'8�9��)�)�'�/�/�:���g�r�}�}�'<�'<�=��%�%�g�o�o�6���g�r�}�}�'@�'@�A��/�/����@���g�r�}�}�'D�'D�E��+�+�G�O�O�<���g�r�}�}�'@�'@�A��*�*�7�?�?�;���g�r�}�}�'D�'D�E��&�&�w���7���g�r�}�}�'9�'9�:��$�$�T�-=�-=�u�,E�E���g�r�}�}�'=�'=�>��$�$��)9�)9�5�(A�A��r�c��|tjjk(ryt|tjj�r
|j
syt|tjj�r
|j
ryt|tjj�r|j|�syt|tjj�r|j|�ryt|tjj�r|j|�syt|tjj�r|j|�ryt|tjj�r|j|�syt|tjj�r|j|�ryt|tjj �r|j#|�syt|tjj$�r|j#|�ryt|tjj&�r|j)|�syt|tjj*�r|j)|�ryt|tjj,�rd|j.vryt|tjj0�rd|j.vryy)z;Return True if the package is matched by the given filters.TFr+)rPrhr�r	rir�rjrqr<rrrk�_is_package_freerlrmr>rnror?rpr@rArBrsr�rt)r~r�rvs   r�r�z'AptPackageKitWorker._is_package_visibleEs���b�m�m�(�(�(���g�r�}�}�'>�'>�?��$�$���g�r�}�}�'B�'B�C�� � ���g�r�}�}�'>�'>�?��.�.�s�3���g�r�}�}�'B�'B�C��*�*�3�/���g�r�}�}�'9�'9�:��)�)�#�.���g�r�}�}�'=�'=�>��%�%�c�*���g�r�}�}�'8�'8�9��)�)�#�.���g�r�}�}�'<�'<�=��%�%�c�*���g�r�}�}�'@�'@�A��/�/��4���g�r�}�}�'D�'D�E��+�+�C�0���g�r�}�}�'@�'@�A��*�*�3�/���g�r�}�}�'D�'D�E��&�&�s�+���g�r�}�}�'9�'9�:��s�x�x����g�r�}�}�'=�'=�>��3�8�8�#��r�c�R�|jsy|j|j�S)zWReturn True if we can be sure that the package's license is a
        free one
        F)rr=�r~r�s  r�rDz$AptPackageKitWorker._is_package_freeus#���}�}���$�$�S�]�]�3�3r�c���|j}|xr^|djdk(xr|djdvxs&|djdk(xr|djdk(xr|djS)z_Return True if we can be sure that the package version has got
        a free license.
        rr*r�r)r�)r2r3r�r7)r~r1r2s   r�r=z$AptPackageKitWorker._is_version_free}s����/�/���#��!�*�#�#�x�/�?��!�*�&�&�*>�>�2��!�*�#�#�x�/�1��!�*�&�&�&�0�	#�
��
�"�"�	$r�c�H�|jjd�d}|dk(S)z3Return True if the package is a metapackge
        r�r/rI)r0r��r~r�r0s   r�r?z*AptPackageKitWorker._is_package_collection�s(���+�+�#�#�C�(��,���.�(�(r�c�^�|jjd�dj�dvS)Nr�r/)rDrr')r0r�rrFs  r�r>z$AptPackageKitWorker._has_package_gui�s-���{�{� � ��%�b�)�/�/�1�5L�L�Lr�c���|jjd�xsK|jjd�xs.|jjd�dj	�dvS)Nz-devz-dbgr�r/)rr))r�r5r0r�rrFs  r�rAz%AptPackageKitWorker._is_package_devel�s]�����!�!�&�)�L�S�X�X�->�->�v�-F�L����!�!�#�&�r�*�0�0�2�6K�K�	Mr�c��|jsy|jj}|xr^|djdk(xr|djdvxs&|djdk(xr|djdk(xr|djS)NFrr*)r��
restrictedr)r�)rr2r3r�r7)r~r�r2s   r�r<z)AptPackageKitWorker._is_package_supported�s����}�}���-�-�'�'���#��!�*�#�#�x�/�A��!�*�&�&�*@�@�2��!�*�#�#�x�/�1��!�*�&�&�&�0�	#�
��
�"�"�	$r�c�<�|j|�}|jS)z�Return the apt.package.Package corresponding to the given
        package id.

        If the package isn't available error out.
        )r�r�)r~r�r1s   r�r{z&AptPackageKitWorker._get_package_by_id�s���)�)�"�-�����r�c��|jdd�\}}}}|r||jdfvr|d|zz
}	|j|}	|j|}|j|k7r1t	t
jd|j|j|��|S#t$rt	t
jd|��wxYw#t	t
jd|��xYw)z�Return the apt.package.Version corresponding to the given
        package id.

        If the version isn't available error out.
        rb�r*z:%sz There isn't any package named %szVerion %s doesn't existz4Version %s of %s isn't available for architecture %s)r�r,r�r�rr�r�r-rr�r1)r~r�r��version_string�arch�datar�r1s        r�r�z&AptPackageKitWorker._get_version_by_id�s���,.�8�8�C��+;�(��n�d�D��D��!1�!1�5� 9�9��E�D�L� �D�	*��+�+�d�#�C�
	4��l�l�>�2�G�
���4�'�#�J�$?�$?�%:�$'�H�H�g�o�o�t�E�
E�����	*�#�J�$?�$?�$F�$(�*�
*�	*��	4�#�J�$?�$?�$=�$2�4�
4�s�B�B<�%B9�<Cc�F�tjjtjdd|j
z�}	t
|d�5}|j�jd�jd�}ddd�|S#1swYSxYw#t$rgcYSwxYw)a
        Return the list of unicode names of the files which have
        been installed by the package

        This method should be obsolete by the
        apt.package.Package.installedFiles attribute as soon as the
        consolidate branch of python-apt gets merged
        �Dirzvar/lib/dpkg/info/%s.listrmrarpN)r�r�r�r/r�r�r�r�r~r��IOError)r~r�r��f�filess     r�r�z(AptPackageKitWorker._get_installed_files�s����w�w�|�|�G�N�N�5�1�7�#�(�(�B�D��	��d�D�!�
=�Q��������0�6�6�t�<��
=���	
=�����	��I�	�s0�B�/B�;B�B�
B�B�B �B c���|jjd�d}|tvr	t|Stj	d|j�d|j
���tjjS)zT
        Return the packagekit group corresponding to the package's section
        r�r/zUnkown package section z of )	r0r�rwr��warningr�rP�	GroupEnumr�rIs   r�r�z&AptPackageKitWorker._get_package_group�sa���+�+�#�#�C�(��,���'�'�$�W�-�-��M�M�s�{�{�?B�x�x�I�
J��<�<�'�'�'r�c
��|j�ytsyi|_tjjtj��\}}|D]!}tjj|��#dD]�}tjd|�D]l}	|j�}tjd|�dt|j����|jj|g�j|��n��y#t$rD}tjd|�dt|j��dt|����Yd}~��d}~wwxYw)zjInitialize PackageKit apt backend plugins.
        Do nothing if plugins are already initialized.
        N)r�zpackagekit.apt.pluginszFailed to load z
 from plugin z: zLoaded )r
�
pkg_resources�working_set�find_plugins�Environmentr��iter_entry_points�loadrr�rZr�r#r�
setdefaultr�)r~�dists�errorsr#�plugin_name�entry_pointr�es        r�rz!AptPackageKitWorker._init_plugins�s.���=�=�$������
�&�1�1�>�>��%�%�'�)�
��v��	0�D��%�%�)�)�$�/�	0�,�	I�K�,�>�>�,�k� ;�

I���(�-�-�/�F�
�����[�%5�%5�!6�8�9��
�
�(�(��b�9�@�@��H�

I�	I��
!���M�M�#�S��)9�)9�%:�C��F�#D�E����s�D�	E�:E�Ec�n�t|d�r�|jj�D]t}|js|jr|j|j�}n|j|j�}||jj|j<�vtjj||||�t|d�rj|jtj k(s:|j"tj$s|j&tj$r|j)|�yyy)z2Apply changes and emit RequireRestart accordingly.r�N)r�r��get_changes�
marked_delete�marked_reinstallr�r.rr��pkg_id_cacher�rrN�_apply_changesr�r��ROLE_UPGRADE_SYSTEMr�r�r�rC)r~r��fetch_range�
install_ranger�r�s      r�rnz"AptPackageKitWorker._apply_changess����5�)�$��{�{�.�.�0�
>���$�$��(<�(<�!�6�6�s�}�}�E�F�!�6�6�s�}�}�E�F�7=��
�
�*�*�3�8�8�4�
>�	���*�*�4���+8�	:�
�E�9�%�
�Z�Z�:�9�9�
9�
�^�^�J�3�3�
4�
�]�]�:�2�2�
3��&�&�u�-�4�
&r�)NT�NFr))��2)rt�Z).�__name__�
__module__�__qualname__r
rOr�r�r�r�r�r�r�r�rCr�r�r�r�r�r�r�r�r�r�r�r�r�r�rr�r9r�r�r�rDr=r?r>rAr<r{r�r�r�rrnr�r�r�rLrL�s���H�0�)0�VE�13�f%8�N8�t@�K�&D�PF*�PD�q5�f?�$/�I�4OA�b�82I�hA�O�62� E� �"	I�6�"7�1�5�C�3�j.�`4�
$�)�M�
M�	$���8�$
(�I�<19�%-�.r�rLc�N�eZdZdejj
ddfiZd�Zd�Zy)�GMetaRelease�
download-doneNr�c�p�tjj|�tj|dd�yrr)rrOr�r~s r�rOzGMetaRelease.__init__#s&���O�O�$�$�T�*��$�$�T�5�%�8r�c�P�tj|�|jd�y)Nr{)r�download�emitr}s r�rzGMetaRelease.download's���$�$�T�*��I�I�o�&r�)	rvrwrxr�SignalFlags�	RUN_FIRST�__gsignals__rOrr�r�r�rzrzs/��'�'�*=�*=�*G�*G�*.�*,�*.�/��	9�	'r�rzc�:�d}|D]}|dt|�zz}�|S)z4Return the bitfield with the given PackageKit enums.rr��int)r�field�enums   r�rr,s-��
�E�� ��
��c�$�i���� ��Lr�c�(�|dt|�zz}|S)z&Add a PackageKit enum to a given fieldrr��r�r�s  r�rr4s��	�Q�#�d�)�^��E��Lr�c�(�|dt|�zz}|S)z)Remove a PackageKit enum to a given fieldrr�r�s  r�rr:s���A��T��N�"�E��Lr�c�$�|dt|�zzS)z<Return True if a bitfield contains the given PackageKit enumrr�r�s  r�r	r	@s���1��D�	�>�!�!r�)U�__doc__�
__author__r�r�r�rv�loggingr�r"r�r�r��timer/�
gi.repositoryrrrPr]�ImportError�pkutilsrrrr	rFrr�rerr�r
r�	getLoggerr��UpdateManager.Core.MetaReleaserrfr!r�XAPIAN_DB_PATHr�XAPIAN_DB_VALUESr
rr��R_OKrrNrRrSrTrUr\r]r[�ADMIN_TOOLSrJ�PROGRAMMING�
COMMUNICATION�SERVERS�
DOCUMENTATION�
PUBLISHING�	EDUCATION�ELECTRONICS�FONTS�GAMES�
DESKTOP_GNOME�
DESKTOP_OTHER�GRAPHICS�DESKTOP_KDE�LOCALIZATION�INTERNET�SCIENCE�OTHER�NETWORK�LEGACY�
MULTIMEDIA�ACCESSORIESror�rwrNrLrzr�r�r��<module>r�s���
�5�
����
��	��	�����!�.���*�*�!�&�,��	����6�7�� �>� �������
�/J�K���X�%�	�!�I�-�������r�y�y��B�G�G�$�
���/�0���=��"��G��6��6��
�	�?��='��R�\�\�
%�
%�='�
�B�L�L���='�����(�(�='��B�L�L�&�&�	='�
����$�$�='�����+�+�
='��R�\�\�
%�
%�='��R�\�\�
%�
%�='�
�2�<�<�%�%�='��r�|�|�&�&�='�����'�'�='��2�<�<�+�+�='�����#�#�='��R�\�\�
�
�='��R�\�\�
�
�='� �R�\�\�
'�
'�!='�"�R�\�\�
%�
%�#='�$�r�|�|�)�)�%='�&����%�%�'='�(����*�*�)='�*�r�|�|�'�'�+='�,�R�\�\�
!�
!�-='�.�B�L�L�,�,�/='�0�R�\�\�-�-�1='�2�B�L�L�$�$�3='�4
�2�<�<�#�#�5='�6
�b�l�l�!�!�7='�8����(�(�9='�:�B�L�L���;='�<�B�L�L�$�$�=='�>�B�L�L�-�-�?='�@�B�L�L�!�!�A='�B�B�L�L� � �C='�D�B�L�L���E='�F
�2�<�<���G='�H�B�L�L�!�!�I='�J�R�\�\�
%�
%�K='�L�r�|�|�"�"�M='�N����$�$�O='�P�B�L�L�$�$�Q='�R
�2�<�<�#�#�S='�T
�b�l�l�&�&�U='�V�B�L�L�$�$�W='�X�r�|�|�#�#�Y='�Z
�b�l�l�&�&�[='�\�R�\�\�
$�
$�]='�^
�2�<�<�"�"�_='�`�B�L�L�#�#�a='�b�R�\�\�
%�
%�c='�d
�2�<�<�#�#�e='�f�R�\�\�
$�
$�g='�h�|�|�'�'�
�<�<� � ��L�L�&�&�
�<�<�%�%��L�L�$�$��|�|�#�#�
�\�\�
!�
!��L�L�-�-��L�L�,�,�
�\�\�
%�
%�{='��@{.�)�-�-�{.�|#�'�w����'����"��q(���M���"�!� ��!���	��	�s6�Z�=Z)�.Z7�Z&�%Z&�)Z4�3Z4�7[�?[

Zerion Mini Shell 1.0