%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/UpdateManager/Core/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/UpdateManager/Core/__pycache__/MyCache.cpython-312.pyc

�

QKf�I��>�ddlZejdde�ddlZddlZddlZddlZddlmZddl	m
Z
ddlmZddl
mZddlZddlZddlZddlZddlmZ	dd	lmZd
ZdZedzZGd
�de�ZGd�dej<j>�Zy#e$rdZY�=wxYw)�N�ignorezapt API not stable yet)�	HTTPError)�urlopen)�urlsplit)�
BadStatusLine)�gettext)�	Launchpadz/var/lib/synaptic/preferencesz.https://changelogs.ubuntu.com/changelogs/pool/z%s/%s/%s/%s_%s/%sc��eZdZdZy)�HttpsChangelogsUnsupportedErrorz�https changelogs with credentials are unsupported because of the
    lack of certitifcation validation in urllib2 which allows MITM
    attacks to steal the credentials
    N)�__name__�
__module__�__qualname__�__doc__���</usr/lib/python3/dist-packages/UpdateManager/Core/MyCache.pyrr3s���
	rrc��eZdZdZdd�Zd�Zd�Zd�Zed��Z	ed��Z
d	�Zed
��Zd�Z
d�Zd
�Zd�Z	dd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�MyCache�UbuntuNc��tjj|||�||_t	|j
�dk(sJ�|j
�rJ�|j�i|_i|_	i|_
|jjdkDr|j�|jjdk(r|jjdk(sJ�d|_t j"j%d�}|r�t'j(ddj+|D�cgc]}d|z��	c}�zdz�|_t/j0ddgd	�
�j3�}t'j(ddj+|D�cgc]#}|j5d�sd|zdz|zn||z��%c}�zdz�|_yd|_d|_ycc}wcc}w)NrzAPT::VersionedKernelPackages�(�|�^�)�unamez-rT)�universal_newlinesz.*)�apt�Cache�__init__�rootdir�len�req_reinstall_pkgs�_dpkgJournalDirty�
_initDepCache�all_changes�all_news�pro_versions�	_depcache�broken_count�saveDistUpgrade�	del_count�	launchpad�apt_pkg�config�
value_list�re�compile�join�versioned_kernel_pkgs_regexp�
subprocess�check_output�rstrip�
startswith�running_kernel_pkgs_regexp)�self�progressr �apt_versioned_kernel_pkgs�p�running_kernel_versions      rrzMyCache.__init__@s����	�	���4��7�3�����4�*�*�+�q�0�0�0��)�)�+�+�+����������
�����>�>�&�&��*�� � �"��N�N�'�'�1�,����1I�1I�Q�1N�	
�N����$+�N�N�$=�$=�*�%
�!�%�02�
�
���(�(�-F�G��C�!�G�G�H�I���1�D�-�
&0�%<�%<��$��D�&��f�h�
#�/1�j�j���(�(�
";�	�� !�|�|�D�1��q��4��*@�@�4�q�8�:�����	�/�D�+�15�D�-�.2�D�+��)H��s�G�(Gc���tjjtjjd��dz}tj|�D]}tjd|�s�yy)z`
        test if the dpkg journal is dirty
        (similar to debSystem::CheckUpdates)
        zDir::State::statusz/updatesz[0-9]+TF)	�os�path�dirnamer-r.�	find_file�listdirr0�match)r9�d�fs   rr#zMyCache._dpkgJournalDirtyts`��
�G�G�O�O�G�N�N�4�4�5I�J�K��
�	
����A��	�A��x�x��!�$��	�rc���|jj�tjj	t
�r|jjt
�|jj
�y�N)r(�read_pinfiler?r@�exists�SYNAPTIC_PINFILE�init�r9s rr$zMyCache._initDepCache�sH��	
���#�#�%�
�7�7�>�>�*�+��N�N�'�'�(8�9������rc�$�|j�yrH)r$rMs r�clearz
MyCache.clear�s�����rc���tj|j�}tj�}|j	||j
|j�|jS)z:get the size of the packages that are required to download)r-�PackageManagerr(�Acquire�get_archives�_list�_records�fetch_needed)r9�pm�fetchers   r�required_downloadzMyCache.required_download�sH���
#�
#�D�N�N�
3���/�/�#��
�������T�]�]�;��#�#�#rc�.�|jjSrH)r(�
inst_countrMs r�
install_countzMyCache.install_count�s���~�~�(�(�(rc�.�|jjSrH)r(�
keep_countrMs rr^zMyCache.keep_count�s���~�~�(�(�(rc�.�|jjSrH)r(r+rMs rr+zMyCache.del_count�s���~�~�'�'�'rc���|D]m}|s�d}|D]]}|j|jjk7s6tj|j
|j|j
�r�\d}�_|s�myy)z<Return True if any of the dependencies in deps match target.TF)�name�package�	shortnamer-�	check_dep�version�relation)r9�target�deps�dep_orrD�base_deps      r�_check_dependencieszMyCache._check_dependencies�s|���
	�F����E�"�
"���M�M�V�^�^�%=�%=�=�"�,�,�����(9�(9�8�;K�;K��"�E�
"���
	�rc�J�|j}|sy|D]�}|j}|��|j||jd��s�4|j||jd��s�Vt	j
|jj�d|j�d��yy)NF�	Conflicts�Replacesz Conflicts/Replaces z; allowing removalT)�	installed�	candidaterk�get_dependencies�logging�inforbrc)r9�pkgrg�cpkgrps     r�find_removal_justificationz"MyCache.find_removal_justification�s����������	 �D����I��$��+�+��I�6�6�{�C���.�.��I�6�6�z�B���L�L�$�,�,�6�6��
�
�G�� �	 �rc��|jjd�|jj}|dkDrJ|D�cgc]}|js�|��}}|t	|�k(sJ�|D]}|j|�s�|dz}�|dkDrD|j
�|jjdk(r|jjdk(sJ�|jjdk(sJ�|jj�|Scc}w)z>this functions mimics a upgrade but will never remove anythingTr�)r(�upgrader+�
marked_deleter!rvrOr))r9�wouldDeletert�deleted_pkgss    rr*zMyCache.saveDistUpgrade�s���	
�����t�$��n�n�.�.����?�+/�E�C�3�3D�3D�C�E�L�E��#�l�"3�3�3�3�#�
%���2�2�3�7��1�$�K�
%���?��J�J�L����+�+�q�0��N�N�,�,��1�
�2��>�>�.�.�!�3�3�3������ ����Fs�D�
Dc�l�|jd�}t|�dkDrdj|dd�}|S)zstrip of the epoch�:rx�N)�splitr!r2)r9�verstr�
vers_no_epochs   r�_strip_epochzMyCache._strip_epoch�s7�����S�)�
��}���!��W�W�]�1�2�.�/�F��
rc��||}|jj}d}|jjj	|j
�j}|jj}	|j|	�}
|jd�}t|�dkDr|d}|d}|jd�rd|dz}|r|}
nt|||||
|fz}
t|
�}|jdk(r|jrt!d��t#|
�}d	}d
t%j&|�z}	|j)�j+dd�}|d	k(r	|St%j,||�}|r�t/|j0d
d�}|rd|vr|jdd�d}|j3d�}|rd|vr|jdd�d}|r|r:t5j6||�dkr!	|S|rt5j6||�dk(r	|S||z}��)z(helper that fetches the file in question�main�/rxr�lib��httpszKhttps locations with username/password are notsupported to fetch changelogsrz^%s \((.*)\)(.*)$zUTF-8�replacereNr~)rp�source_name�_pcacher(�get_candidate_ver�_pkg�section�source_versionr�r�r!r7�CHANGELOGS_URIr�scheme�usernamerrr0�escape�readline�decoderD�getattrro�groupr-�version_compare)r9ra�fname�strict_versioning�changelogs_urirt�srcpkg�src_sectionr��srcver_epoch�srcver�
split_section�prefix�uri�res�	changelog�alllines�regexp�linerDro�changelogvers                      r�_get_changelog_or_newszMyCache._get_changelog_or_news�s@��
�4�j�����*�*�����+�+�'�'�9�9�#�(�(�C�K�K���}�}�3�3���"�"�<�0���
�
�c�*�
��}���!�'��*�K��������U�#��V�A�Y�&�F�
� �C� �������
$��C��s�m���:�:�� �S�\�\�1�0��
��C�L�	���&�"�)�)�F�*;�<����%�%�'�.�.�w�	�B�D��r�z��B��A�H�H�V�T�*�E��$�C�M�M�9�d�C�	���	�!1� )����Q� 7�� :�I�$�{�{�1�~���C�<�$7�#/�#5�#5�c�1�#=�a�#@�L�%�!�#�3�3�L�)�L������
"�#�3�3�L�)�L������ �$��H�Grc���tstjd�y||j}|jD]W}t|�jdk7r�tjd|�}|��5|jd�|jd�}}ntjd�y|j�tjdd	d
��|_|jjjd|�d
|����}|�tjd�y|j|j d|j"��}|stjd�y|dj%�S)zbReturn the changelog URI from the Launchpad API

        Return None in case of an error.
        z9Launchpadlib not available, cannot retrieve PPA changelogNzppa.launchpad.netzhttp.*/(.*)/(.*)/ubuntu/.*rx�z)Unable to find a valid PPA candidate URL.zupdate-manager�
production�devel)re�~z/ubuntu/)�	referencez6Unable to retrieve the archive from the Launchpad API.T)r��exact_matchrez;No published sources were retrieved from the Launchpad API.r)r	rr�warningrp�urisr�hostnamer0�searchr��errorr,�login_anonymously�archives�getByReference�getPublishedSourcesr�r��changelogUrl)	r9ra�cdtr�rD�user�ppa�archive�spphss	         r�_extract_ppa_changelog_uriz"MyCache._extract_ppa_changelog_uriHsW��
��O�O�K�
���4�j�"�"���8�8�		�C���}�%�%�)<�<���I�I�:�C�@�E�� �!�K�K��N�E�K�K��N�c���
		�
�M�M�E�F���>�>�!�&�8�8� �,���D�N��.�.�)�)�8�8�)-�s�3�9�
���?��M�M�H�
�
��+�+������&�&�,�
��
��M�M�!�
�
��Q�x�$�$�&�&rc��||}|jj}|�y|jjjd�}|sy|j	d�dj�}d|vr$|j	d�dj
d�}n|jj}|jd�d}|d|�d|�d�zS)	N�Sourcerrrxrr��_z
.changelog)	rpr��record�getr��stripr6r��
rpartition)r9rart�deb_uri�srcrecr�r��base_uris        r�+_guess_third_party_changelogs_uri_by_sourcez3MyCache._guess_third_party_changelogs_uri_by_source|s����4�j���-�-�#�#���?�����%�%�)�)�(�3�������c�"�1�%�+�+�-���&�=��\�\�#�&�q�)�0�0��5�F��]�]�1�1�F��%�%�c�*�1�-�����?�?�?rc�n�||}|jj}|rd|jdd�dzSy)z[guess changelogs uri based on ArchiveURI by replacing .deb
        with .changelog
        z%s.changelog�.rxrN)rpr��rsplit)r9rartr�s    r�+_guess_third_party_changelogs_uri_by_binaryz3MyCache._guess_third_party_changelogs_uri_by_binary�s=���4�j���-�-�#�#���!�G�N�N�3��$:�1�$=�=�=�rc��|j|�|j|�	|j�y#t$rYywxYwrH)�get_news�
get_changelog�release�	Exception)r9ra�locks   r�get_news_and_changelogzMyCache.get_news_and_changelog�s<���
�
�d�����4� �	��L�L�N���	��	�s�5�	A�Ac�n�	|j|dd�}|r||j|<yy#t$rYywxYw)z5get the NEWS.Debian file from the changelogs locationzNEWS.DebianTN)r�r�r&)r9ra�newss   rr�zMyCache.get_news�sG��	��.�.�t�]�D�I�D��"&�D�M�M�$�����	��	�s�(�	4�4c�b�d}|D]1}|jjd�s�	|j|�}n|j
|�}|j|�}d}|||fD]1}|s�	|j|dd|�}	|j|xx|	z
cc<�3|j|xx|z
cc<y#t$rt	j
d�Y��wxYw#ttf$rtd�}Y��tttj f$r#t	j
d�td�}Y��wxYw)	NzLP-PPA-z'Unable to connect to the Launchpad API.rr�FzAThis update does not come from a source that supports changelogs.zerror on changelog fetching�OFailed to download the list of changes. 
Please check your Internet connection.)�originr7r�r�rr�	exceptionr�r�r�r%rrr��IOErrorr�socketr�)
r9ra�origins�changelogs_uri_ppar��changelogs_uri_binary�changelogs_uri_source�
error_messager�r�s
          r�(_fetch_changelog_for_third_party_packagez0MyCache._fetch_changelog_for_third_party_package�s\��!���	�F��}�}�'�'�	�2��)-�)H�)H��)N�&��		�
�<�<�T�B�	�
�<�<�T�B�	��
��!�!�
�	�N�
�� $� ;� ;��k�5�.�!�I��$�$�T�*�i�7�*�	�0	
�����-�/���I!���%�%�A����."�#B�C��$%�;�%�M� �����=���%�%�&C�D�$%�A�%�M��s)�B.�)+C�.C�C�D.�.=D.�-D.c�:�|D]\}}}}||j|<�yrH)r')r9�pro_pkgsrare�_as     r�create_pro_cachezMyCache.create_pro_cache�s*��'/�	.�#�T�7�B��&-�D���d�#�	.rc�P�||jj}|jj|||jj�}td�|t
||jdd�|fz|j|<|j|D�cgc]}|j��c}vr|j||�y||jj}||jjjdd�}	|j|d�}t!|�dk(rtd�||fz}|j|xx|z
cc<ycc}w#t"$rtd	�||fz}Y�8t$t&t(j*f$r!}t-d
|�td�}Yd}~�qd}~wwxYw)z2get the changelog file from the changelog locationzFChanges for %s versions:
Installed version: %s
Available version: %s

reNr~z%3Ar�rz�The changelog does not contain any relevant changes.

Please use http://launchpad.net/ubuntu/+source/%s/%s/+changelog
until the changes become available or try again later.z�The list of changes is not available yet.

Please use http://launchpad.net/ubuntu/+source/%s/%s/+changelog
until the changes become available or try again later.zcaught exception: r�)rpr�r'r�rer�r�ror%�CHANGELOG_ORIGINr�r�r�r�r�r�r!rr�rr�r��print)	r9rar�re�or�r�r��es	         rr�zMyCache.get_changelog�s����t�*�&�&�.�.���#�#�'�'��d�4�j�.B�.B�.J�.J�K��!"�
(�"
�

��D��J�(�(�)�T�:��
�	"
������� � �7�(C�a����(C�C��9�9�$��H���d��%�%�1�1���D�z�+�+�:�:�B�B�3��N��	��3�3�D�+�F�I��9�~��"��M��
�\�*�+�	�&	
�����)�+���9)D���	'��I��
��&�'�I������5�	��&��*��9��I��	�s$�E�?0E�F%�'F%�F � F%rH)FN)rr
rr�rr#r$rO�propertyrYr\r^r+rkrvr*r�r�r�r�r�r�r�r�r�r�rrrrr<s�����23�h����$��$��)��)�)��(��(��&�&�.�DH�a�F2'�h@�"
��'�,0�d.�),rr) �warnings�filterwarnings�
FutureWarningrr-rrr?�urllib.errorr�urllib.requestr�urllib.parser�http.clientrr�r4r0�DistUpgrade.DistUpgradeCache�DistUpgraderr��launchpadlib.launchpadr	�ImportErrorrK�CHANGELOGS_POOLr�r�r�DistUpgradeCacherrrr�<module>r�s���.������":�M�J�
���	�"�"�!�%�
��	�#� ��0�3��B�� �#6�6��	�i�	�M,�k�*�*�2�2�M,��#���I��s�B�B�B

Zerion Mini Shell 1.0