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

�

9m�e����ddlmZddlZddlmZddlZddlZddlZddlZddl	Z	ddl
Z
	ddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlmZmZde
j0vr8ej2j5dd�ej2j5dd�Gd	�d
e�ZGd�de�Zy#e$rdZY��wxYw)
�)�print_functionN)�FetchFailedException)�BytesIO�open�APT_CLONE_DEBUG_RESOLVERzDebug::pkgProblemResolver�1zDebug::pkgDepCache::AutoInstallc�:�eZdZdZdZd�Zd�Zd
d�Zd�Zd�Z	d	�Z
y)�LowLevelCommandszN calls to the lowlevel operations to install debs
        or repack a deb
    z/usr/bin/dpkg-repackc��|syddg}|dk7r$|jdd�|jd|�tj||z�}|dk(S)NT�dpkgz-i�/r�chroot�)�insert�
subprocess�call)�self�debfiles�	targetdir�install_cmd�rets     �7/usr/lib/python3/dist-packages/DistUpgrade/apt_clone.py�install_debszLowLevelCommands.install_debs6sV�����t�n��������q�(�+����q�)�,��o�o�k�H�4�5���q���c�Z�tjj|j�st	d|jz��|jg}tj
�dk(s'tjjd�syddg|z}t
j||gz|��}|dk(S)z$ dpkg-repack pkgname into targetdir z
no '%s' foundrz/usr/bin/fakerootN�fakerootz-u)�cwd)�os�path�exists�dpkg_repack�IOError�getuidrr)r�pkgnamer�
repack_cmdrs     r�
repack_debzLowLevelCommands.repack_deb@s����w�w�~�~�d�.�.�/��/�D�,<�,<�<�=�=��&�&�'�
��y�y�{�a���7�7�>�>�"5�6��$�d�+�j�8�J��o�o�j�G�9�4�)�D���q��rNc��|�trtj�d}|�tjd�}tjd||g�}|dk(S)N�CODENAMEzlsb_release --codename --short�debootstrapr)�lsb_release�get_distro_informationr�	getoutputr)rr�distrors    rr)zLowLevelCommands.debootstrapLsQ���>�k� �7�7�9�*�E�F��>��)�)�*J�K�F��o�o�}�f�i�@�A���q��rc�@�tjdd|d|g�}|dk(S)Nzapt-keyz	--keyring�addr�rr)r�fromkeyfile�intokeyfilers    r�
merge_keyszLowLevelCommands.merge_keysTs*���o�o�y�+�{�$�k�3�4���q��rc�>�tjdd||g�}|dk(S)N�mountz--bindrr0)r�olddir�newdirrs    r�
bind_mountzLowLevelCommands.bind_mountYs#���o�o�w��&�&�A�B���q��rc�:�tjd|g�}|dk(S)N�umountrr0)r�binddirrs   r�bind_umountzLowLevelCommands.bind_umount]s���o�o�x��1�2���q��r�N)�__name__�
__module__�__qualname__�__doc__r!rr&r)r3r8r<�rrr
r
0s,���)�K��
���
�rr
c�"�eZdZdZdej
�dzZdZ		d&d�Z		d'd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd(d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd)d�Z		d*d�Zd+d�Zd+d�Zd�Zd,d�Z d�Z!d �Z"d!�Z#d"�Z$d-d#�Z%d)d$�Z&d%�Z'y).�AptClonez� clone the package selection/installation of a existing system
        using the information that apt provides

        If dpkg-repack is installed, it will be used to generate debs
        for the obsolete ones.
    zapt-clone-state-%s.tar.gzr�./Nc�x�t�|_t�|_t�|_|r||_n-tjjj�|_|r||_
n-tjjj�|_
|r||_
ytj|_
yr=)�set�not_downloadable�version_mismatchr
�commands�fetch_progress�apt�progress�text�AcquireProgress�install_progress�base�InstallProgress�
_cache_cls�Cache)rrKrP�	cache_clss    r�__init__zAptClone.__init__ms��� #���� #����(�*��
��"0�D��#&�<�<�#4�#4�#D�#D�#F�D���$4�D�!�$'�L�L�$5�$5�$E�$E�$G�D�!��'�D�O�!�i�i�D�Orc�r�tjj|�r+tjj||j�}n|jd�s|dz
}|dk7r�t
j�tjjd|�tjjdtjj|d��t
j�tj|d��5}|j|�|j||�|j|�|j!||�|j#|�|j%|�|j'||�|r|j)|�|r|j+|�d	d	d	�y	#1swYy	xYw)
z� save the current system state (installed pacakges, enabled
            repositories ...) into the apt-state.tar.gz file in targetdir
        z.tar.gzz.apt-clone.tar.gzr
�Dir�Dir::State::statuszvar/lib/dpkg/statuszw:gz)�name�modeN)rr�isdir�join�CLONE_FILENAME�endswith�apt_pkg�init_config�configrG�init_system�tarfiler�_write_uname�_write_state_installed_pkgs�_write_state_auto_installed�_write_state_sources_list�_write_state_apt_preferences�_write_state_apt_keyring�_write_state_extra_files�_write_state_dpkg_status�_dpkg_repack)r�	sourcedir�target�with_dpkg_repack�with_dpkg_status�
scrub_sources�extra_files�tars        r�
save_statezAptClone.save_state�sQ���7�7�=�=�� ��W�W�\�\�&�$�*=�*=�>�F��?�?�9�-��-�-��������!��N�N���u�i�0��N�N���3�!�w�w�|�|�I�7L�M�
O����!�
�\�\�v�F�
3�	'�s����c�"��,�,�Y��<��,�,�S�1��*�*�3�
�>��-�-�c�2��)�)�#�.��)�)�+�s�;���-�-�c�2���!�!�#�&�	'�	'�	'�s
�B!F-�-F6c���tj�dtj�dtj�dtjj	d�d�}|S)Nr��zAPT::Architecture)�hostname�kernel�
uname_arch�arch)r�unamer`rb�find)r�	host_infos  r�_get_host_info_dictzAptClone._get_host_info_dict�sK��%'�X�X�Z��]�&(�h�h�j��m�&(�h�h�j��m�&-�n�n�&9�&9�:M�&N��	�
�rc	�L�|j�}tjd��}dj|j	�D��cgc]\}}|�d|����c}}�}|j|dz�|j
�|j|jd��ycc}}w)N�w�r[�
z: z./var/lib/apt-clone/uname��arcname)	r��tempfile�NamedTemporaryFiler]�items�write�flushr/rZ)rrtr�f�key�value�infos       rrezAptClone._write_uname�s����,�,�.�	��'�'�S�1���y�y�.7�o�o�.?�A�*�s�E�'*�5�1�A�B��	����T�	��	���	������� ;��<��	As�B 
c�x�|�y|D]2}tj|�D]}|j|d|z����4y)Nz
./extra-filesr�)�globr/)rrsrt�pr�s     rrkz!AptClone._write_state_extra_files�sF������	6�A��Y�Y�q�\�
6������?�1�#4��5�
6�	6rc	�>�|j|��}d}d}trtj�d}ntjd�}|D�]z}|j
s�||j�d|jj�dt|j��d�z
}|jr|jjs&|jj|j�nQ|jjr|jjs%|jj|j�|jj D]y}|j"dk(r|j$dk(r�"|j$|k7rG||j�d|jj�d|j$dk7r|j$nd�d�z
}��z��}t'j(d	�}	|j+d
�}t-|�|	_t1j0�|	_|j5|	t7|��t'j(d�}	|j+d
�}t-|�|	_t1j0�|	_|j5|	t7|��y)N��rootdir��IDzlsb_release --id --short� r��now�unknownz"./var/lib/apt-clone/installed.pkgs�utf-8z ./var/lib/apt-clone/foreign.pkgs)rSr*r+rr,�is_installedrZ�	installed�version�int�is_auto_installed�	candidate�downloadablerHr/rI�origins�archive�originrd�TarInfo�encode�len�size�time�mtime�addfiler)
rrnrt�cache�s�foreign�	distro_id�pkg�o�tarinfos
          rrfz$AptClone._write_state_installed_pkgs�s������	��2�������#�:�:�<�T�B�I�"�,�,�-G�H�I��	�C������H�H�c�m�m�3�3�S��9N�9N�5O�Q�Q���}�}�C�M�M�,F�,F��)�)�-�-�c�h�h�7��-�-�4�4��-�-�4�4��)�)�-�-�c�h�h�7����.�.��A��y�y�E�)�a�h�h�"�n� ��x�x�9�,���H�H�c�m�m�&;�&;�()���B��A�H�H�I�E�$G�G����	�&�/�/�"F�G��
�H�H�W����1�v����	�	���
����G�W�Q�Z�(��/�/�"D�E���.�.��)���7�|����	�	���
����G�W�W�-�.rc�h�tjjd�}|j|d��y)N�dir::state::statusz./var/lib/apt-clone/dpkg-statusr�)r`rb�	find_filer/)rrt�dpkg_statuss   rrlz!AptClone._write_state_dpkg_status�s*���n�n�.�.�/C�D������%F��Grc��tjjd�}tjj|�r|j
|d�yy)NzDir::State::extended_statesz#./var/lib/apt-clone/extended_states)r`rbr�rrr r/)rrt�extended_statess   rrgz$AptClone._write_state_auto_installed�s=��!�.�.�2�2�)�+��
�7�7�>�>�/�*��G�G�O�%J�K�+rc�L�tjjd�}tjj|�r|j
|d��tjjdd�}tjj|�r|j
|d��yy)NzDir::Etc::preferencesz./etc/apt/preferencesr�zDir::Etc::preferencespartsz/etc/apt/preferences.dz./etc/apt/preferences.d�r`rbr�rrr r/�find_dir�rrtr�r�s    rriz%AptClone._write_state_apt_preferences�sx���N�N�$�$�%<�=��
�7�7�>�>�!���G�G�A�6�G�7��N�N�#�#�$@�$<�
>��
�7�7�>�>�!���G�G�A�8�G�9�rc�L�tjjd�}tjj|�r|j
|d��tjjdd�}tjj|�r|j
|d��yy)NzDir::Etc::trustedz./etc/apt/trusted.gpgr�zDir::Etc::trustedpartsz/etc/apt/trusted.gpg.dz./etc/apt/trusted.gpg.dr�r�s    rrjz!AptClone._write_state_apt_keyring�sx���N�N�$�$�%8�9��
�7�7�>�>�!���G�G�A�6�G�7��N�N�#�#�$<�$<�
>��
�7�7�>�>�!���G�G�A�8�G�9�rc�*�tjjd�}|j|||d�tjj	d�}t
jj|�r�|j|dd��tj|�D]u}|jd�r�|jd�s|jd	�s�8|�d
|��}t
jj|�r�_|j|||d|z��wyy)N�Dir::Etc::sourcelistz./etc/apt/sources.list�Dir::Etc::sourcepartsz./etc/apt/sources.list.dF)r��	recursive�.z.listz.sourcesr
z./etc/apt/sources.list.d/)
r`rbr��$_add_file_to_tar_with_password_checkr�rrr r/�listdir�
startswithr_r\)rrt�scrub�sources_list�source_parts�source�sources_file_names       rrhz"AptClone._write_state_sources_lists����~�~�/�/�0F�G���1�1�#�|�U�$�	&��~�~�.�.�/F�G��
�7�7�>�>�,�'��G�G�L�*D�#�
�
%��*�*�\�2�

8���$�$�S�)������0�F�O�O�J�4O��/;�V�$D�!��7�7�=�=�!2�3���9�9�#�%�u�/��6�8�

8�(rc�*�|r�tjd��5}t|d�5}|j�D]�}t	|�t
ur|j
d�}tjd|�rtjdd|�}|j|jd��|j���|j|j|��ddd�ddd�y|j||��y#1swY�&xYw#1swYyxYw)	N�wbr��rbzUTF-8z/[^/@:]*:[^/@:]*@z/USERNAME:PASSWORD@r�r�)r�r�r�	readlines�type�bytes�decode�re�search�subr�r�r�r/rZ)rrt�sourcesr�r��source_copyr��lines        rr�z-AptClone._add_file_to_tar_with_password_checks�����,�,�$�7�
;�;��W�VZ�H[�
;�_`��K�K�M�(�D��D�z�U�*�#�{�{�7�3���y�y�!4�d�;�!�v�v�&9�1�4� 9�� �%�%�d�k�k�'�&:�;��%�%�'�(�����(�(�'��:�
;�
;�
;� 
�G�G�G�W�G�-�!
;�
;��
;�
;�s#�
D	�B2C=�D	�=D	�D	�	Dc��yr=rB�rrts  r�_write_modified_files_from_etcz'AptClone._write_modified_files_from_etc-s��rc���tj�}|jD]}|jj	||�� |j|d��t
j|�y)N�./var/lib/apt-clone/debsr�)r��mkdtemprHrJr&r/�shutil�rmtree)rrt�tdirr$s    rrmzAptClone._dpkg_repack1sV�����!���,�,�	4�G��M�M�$�$�W�d�3�	4�����8��9��
�
�d�rc�f�|j�djd�rd|_yd|_y)N���rEr�)�getnamesr��	TARPREFIXr�s  r�_detect_tarprefixzAptClone._detect_tarprefix:s)���<�<�>�"��(�(��.�!�D�N��D�Nrc���tj|�5}|j|�|j|jdz�}|j�D]{}|j
d�}|jd�s|j�dk(r�9|j�}t|�dkDs�X|djd�r�m|dccddd�S	ddd�y#1swYyxYw)Nzetc/apt/sources.listr��#r�rwr
)rdrr��extractfiler�r�r�r��strip�splitr�r_)r�	statefilertr�r��ls      r�_get_info_distrozAptClone._get_info_distroBs���
�\�\�)�
$�
	 ���"�"�3�'�������/E� E�F�A����
�
 ���{�{�7�+���?�?�3�'�4�:�:�<�2�+=���J�J�L���q�6�A�:�a��d�m�m�C�&8��Q�4�K�
	 �
	 �
 �	
	 ��
	 ��s�BC�.C�C�C�C'c	��|j|�xsd}tj|�5}|j|jdz�}dx}}g}|j�D]m}|j
d�}|j�j�\}	}
}|dz
}t|�r|dz
}|	jd�s�]|j|	��o|j|jdz�}|j}
d}d}|jdz|j�vre|j|jdz�j�}t!j"|�}|j%dd�}|j%d	d�}||d
j'|�||t)j*|
�|d�cddd�S#1swYyxYw)Nr�� var/lib/apt-clone/installed.pkgsrr�rz-desktopzvar/lib/apt-clone/unameryr|z, )ryr-�metar��
autoinstalled�dater|)r�rdrr�r�r�r�r�r�r�r_�append�	getmemberr�r��readr`�
TagSection�getr]r��ctime)rr�r-rtr�r�r�r�r�rZr��auto�mr�ryr|r��sections                  r�_get_clone_info_dictzAptClone._get_clone_info_dictPs����&�&�y�1�>�Y��
�\�\�)�
$�#	��������!C�C�E�A�()�)�I�
��D����
�	
&���{�{�7�+��(,�
�
��(:�(:�(<�%��w���Q��	��t�9�!�Q�&�M��=�=��,��K�K��%�	
&��
�
����!C�C�E�A��7�7�D� �H��D��~�~�7�7�3�<�<�>�I�����N�N�%>�>�@�@D����!�,�,�T�2��"�;�;�z�9�=���{�{�6�9�5��"*� &�"�i�i��o�#,�'4�"�j�j��.�"�
�9#	�#	�#	�s�BF7�=C0F7�7Gc�*�d|j|�zS)Nz�Hostname: %(hostname)s
Arch: %(arch)s
Distro: %(distro)s
Meta: %(meta)s
Installed: %(installed)s pkgs (%(autoinstalled)s automatic)
Date: %(date)s
)r�)rr�s  rr�z
AptClone.infoxs#��"�
%)�$=�$=�i�$H�I�	Irc�H�tj|�5}|j|�|j|j|ddz�}g}|j�D]"}|j
|jd���$	ddd�||z}tjj|�r%t|�5}|j�}	ddd�ng}	tj	d|z|��}
g}|
D]}|j
|��|S#1swY��xYw#1swY�MxYw)Nrr�zcurrent-system%s)�fromfile�tofile)
rdrr�r�r�r�r�r�rrr �difflib�unified_diff)rr��system_filerrt�
clone_file�clone_file_linesr��fp�system_file_lines�gen�diffs            r�_get_file_diff_against_clonez%AptClone._get_file_diff_against_clone�s#��
�\�\�)�
$�	>���"�"�3�'��������A�B��)G�H�J�!��#�,�,�.�
>�� �'�'����G�(<�=�
>�
	>� ��+��
�7�7�>�>�+�&��k�"�
3�b�$&�L�L�N�!�
3�
3�!#���"�"��/�'�+�5�k�K�����	�D��K�K���	���)	>�	>��
3�
3�s�A*D�8D�D�D!c���|dk7r tjjd|�td�|j	�}|j|�}|D]]}|j
|d�|j
|d�k7s�)td|�d|j
|d��d|j
|d��d���_td�d	}|j|||�}|rtdj|��|j|�
�}tj|�5}	|	j|jdz�}
i}|
j�D]S}|j�j!d�}|j#d
�s|dk(r�9|j%�\}
}}||f||
<�U	ddd�i}|D]G}|j&s�|j&j(t+|j,�f||j.<�It|j1��tj1��z
}|r9td�tdjt3|���td�t|j1��t|j1��z
}|r9td�tdjt3|���td�t�}t3|�D]1}||vr�||\}}||\}}||k7s�|j5|||f��3|r7td�td�|D]\}}}td|�d|�d|�d���yy#1swY���xYw)Nr
�DPkg::Chroot-DirectoryzClone info differences: z 'z
': clone='z
' system='�'r�z/etc/apt/sources.listr�r�r�r�z2Installed on the system but not in the clone-file:r�r�z2Installed in the clone-file but not in the system:zVersion differences: z-Pkgname <clone-file-version> <system-version>z  <z>   <�>)r`rbrG�printr�r�r�rr]rSrdrr�r�r�r�r�r�r�r�r��strr�rZ�keys�sortedr/)rr�rr�
clone_infor��sources_list_systemr
r�rtr��installed_in_cloner�rZr�r��installed_on_systemr��only_on_system�
only_in_clone�pkgversion_differencesr$�clone_file_pkgversion�
clone_is_auto�system_pkgversion�sys_is_auto�	clone_ver�
system_vers                            r�	show_diffzAptClone.show_diff�s>������N�N���7��C�	�(�)��,�,�.�	��.�.�y�9�
��	3�C��}�}�S�$�'�:�>�>�#�t�+D�D���Z�^�^�C��6�!�
�
�c�4�0�2�3�	3�
	�b�	�6���0�0��*�I�7����"�'�'�$�-� ����	��2��
�\�\�)�
$�
	;��������!C�C�E�A�"$�����
�
;���z�z�|�*�*�7�3���?�?�3�'�4�2�:��(,�
�
��%��w��,3�T�?�"�4�(�
;�
	;�!���	C�C��=�=���
�
�%�%�s�3�+@�+@�'A�-C�����)�	C��0�5�5�7�8�3�?Q�?V�?V�?X�;Y�Y����F�G��#�(�(�6�.�1�2�3��$�K��/�4�4�6�7�#�>Q�>V�>V�>X�:Y�Y�
���F�G��#�(�(�6�-�0�1�2��$�K�"%����0�1�	I�G��1�1��3E�g�3N�0�!�=�-@��-I�*��{�$�(9�9�&�*�*��3�5F�G�I�
	I�"��)�*��A�B�2H�
M�.���J��G�Y�
�K�L�
M�"�Q
	;�
	;�s
�BM�Mc�6�|dk7r�tjjd|�|jj	dt
jj|d��|jj	dt
jj|d��tj|�5}|j|�ddd�t
jj|�s;td|z�|j|�}|jj||�|j|||�	�|j!||�|r|j#||�|j%||||�|j'||�|j)||�|dk7rs|jj+t
jj|d��|jj+t
jj|d��yy#1swY��OxYw)
z� take a statefile produced via (like apt-state.tar.gz)
            save_state() and restore the packages/repositories
            into targetdir (that is usually "/")
        r
r
z/proc�procz/sys�sysNz0Dir '%s' does not exist, need to bootstrap first)�mirror)r`rbrGrJr8rrr]rdrr�r rr�r)�_restore_sources_list�_restore_apt_keyring�_rewrite_sources_list�_restore_package_selection�_restore_not_downloadable_debs�_restore_extra_filesr<)	rr�r�exclude_pkgs�
new_distro�protect_installedr%rtr-s	         r�
restore_statezAptClone.restore_state�s�������N�N���7��C��M�M�$�$�W�b�g�g�l�l�9�f�.M�N��M�M�$�$�V�R�W�W�\�\�)�U�-K�L��\�\�)�
$�	(���"�"�3�'�	(��w�w�~�~�i�(��D�y�P�Q��*�*�9�5�F��M�M�%�%�i��8��"�"�9�i��"�G��!�!�)�Y�7���&�&�y�*�=��'�'�	�9�>O�Q]�^�	
�+�+�I�y�A��!�!�)�Y�7�����M�M�%�%�b�g�g�l�l�9�f�&E�F��M�M�%�%�b�g�g�l�l�9�e�&D�E��)	(�	(�s�/H�Hc��tj�}tjj	d�}t
jj|t
jj|�z�s5tj|t
jj|�z�tj|||z�|j||�|r|j||�|j|��}	|jt j"j$j'��|j+�|j-|||��}tj.|�|S#t($rY�FwxYw)Nr�r�)r,)r�r�r`rbr�rrr �dirname�makedirsr��copyr&r(rS�updaterLrMrQrOrr�#_restore_package_selection_in_cacher�)rr�r,r-ror�r��missings        r�simulate_restore_statezAptClone.simulate_restore_state	s���!�!�#���n�n�.�.�/C�D���w�w�~�~�f�R�W�W�_�_�[�%A�A�B��K�K��r�w�w���{�;�;�<����K���!3�4��"�"�9�f�5���&�&�v�z�:������/��	��L�L����*�*�:�:�<�=�
	�
�
���:�:�9�e�Zf�:�g���
�
�f�����$�	�
�	�s�:7E,�,	E8�7E8c�X�tj|�5}tjj	|ddd�}tjj|�rt
j|d|z�|j|�tjj	|ddd�}tj|tjtjztjztjz�|r�ddlm}m}t$j&j)d|�|d�	�}	|	j*ddD]G}
|
j,s|
j.r�t1|
|�r	|g|
_�1|
j4|k7s�A||
_�I|	j7�ddd�y#1swYyxYw)
N�etcrL�sources.list�%s.apt-cloner)�SourcesList�Deb822SourceEntryr�T��deb822)rdrrrr]r r�r3�
extractall�chmod�stat�S_IRUSR�S_IWUSR�S_IRGRP�S_IROTH�aptsources.sourceslistr<r=r`rbrG�list�invalid�disabled�
isinstance�uris�uri�save)rr�rr%rt�existing�
td_sourcesr<r=r��entrys           rr&zAptClone._restore_sources_list"s4��
�\�\�)�
$�	���w�w�|�|�I�u�e�^�L�H��w�w�~�~�h�'����H�n�x�&?�@��N�N�9�%������i���~�N�J��H�H�Z�������!<�t�|�|�!K��\�\�""�
#��Q����"�"�#9�:�F�%�T�2��$�\�\�!�_�.�E��}�}���� �!�%�):�;�&,�X��
� �9�9��.�'-�5�9�.�����+	�	�	�s�E'F �>F � F)c�l�tjj|ddd�}d|z}tjj|�rt	j
||�t
j|�5}	|j|jdz|�	|j|jdz|�tjj|�r1|jj||�tj|�ddd�y#t$rY��wxYw#t$rY�swxYw#1swYyxYw)Nr9rLztrusted.gpgr;zetc/apt/trusted.gpgzetc/apt/trusted.gpg.d)rrr]r r�r3rdr�extractr��KeyErrorrJr3�remove)rr�rrO�backuprts      rr'zAptClone._restore_apt_keyring:s����7�7�<�<�	�5�%��G���(�*��
�7�7�>�>�(�#��K�K��&�)�
�\�\�)�
$�	"��
����D�N�N�+@�@�)�L�
����D�N�N�+B�B�I�N��w�w�~�~�f�%��
�
�(�(���:��	�	�&�!�	"�	"���
��
���
��
��	"�	"�sO�2D*�4D�D�3AD*�	D�D*�D�D*�	D'�$D*�&D'�'D*�*D3c�D�|�g}t|�}t�}t�}tj|j�}|r/|D]*}|js�|j|j��,tj|�5}	|	j|jdz�}
|j�5|
j�D]�}|j�jd�}|jd�s|dk(r�9|j!�\}}
}d�}|||�r�Z|j#|�t%|�}|}||vs�~	|rR||j'|d��|j(dkDrB|j+�||j,s#t/d	|z��||j'|�
�||j5|���	ddd�ddd�|j(dkDr|j+�|D]I}||vr|j#|��||jr�)||j,r�9|j#|��K|S#t.$r7}t1j2d|�d|�d
��|j#|�Yd}~��d}~wwxYw#1swY��xYw#1swY��xYw)Nr�r�r�r�c�B�|D]}tj||�s�yy)NT)�fnmatch)rZr,�excls   r�is_excludedzAAptClone._restore_package_selection_in_cache.<locals>.is_excludedfs"��$0�,�D�&���t�T�:�'+�,rF)�	from_user�auto_fixrzpkg %s not marked upgrade)r\z
can't add � (�))rGr`�ProblemResolver�	_depcacher��protect�_pkgrdrr�r��actiongroupr�r�r�r�r�r/r��mark_install�broken_count�resolve�marked_install�SystemError�logging�warning�	mark_auto)rr�r�r.r,r6�pkgs�resolverr�rtr�r�rZr�r�r[�auto_installedr\�es                   rr5z,AptClone._restore_package_selection_in_cacheLsw�����L��<�(���%���u���*�*�5�?�?�;����
/���#�#��$�$�S�X�X�.�
/��\�\�)�
$�$	>��������!C�C�E�A��"�"�$� 
>��K�K�M�>�D��:�:�<�.�.�w�7�D����s�+�t�r�z� �,0�J�J�L�)�T�7�D�,�#�4��6� ��H�H�T�N�%(��Y�N�$2� 2�I��u�}�
.�0� %�d�� 8� 8�9�W\� 8� ]�#(�#5�#5��#9�$,�$4�$4�$6�+0��;�+E�+E�.9�:U�X\�:\�.]�(]�!&�d�� 8� 8�9� 8� M�
�d��-�-�n�=�?>� 
>�	$	>�L����!������	!�C��%�<����C� ���#�J�+�+�u�S�z�/H�/H����C� �	!���� +�.�#�O�O�4��,K�L�#�K�K��-�-��.��9 
>� 
>��	$	>�$	>�sP�	/J�8BJ
�A)I�1J
�J�	J	�-J	�=J
�J	�J
�
J	�J�Jc��|j|��}tjjj	dd�tjjj	dd�	|j|j�|j�|j||||�|j|j|j�y#t$rY�VwxYw)Nr�zDir::Binr
zDir::Bin::dpkgz
/usr/bin/dpkg)rSrLr`rbrGr4rKrrr5�commitrP)rr�rr.r,r�s      rr)z#AptClone._restore_package_selection�s������	��2���������z�3�/��������/��A�	��L�L��,�,�-�
	�
�
���0�0��E�CT�Vb�c�
���T�(�(�$�*?�*?�@��$�	�
�	�s�(C�	C�Cc�8�tj|�5}|j�D]\}|jdz}|jj|�s�.|jt
|�d|_|j||��^	ddd�y#1swYyxYw)Nzextra-files/)rdr�
getmembersr�rZr�r�rS)rr�rrtr��prefixs      rr+zAptClone._restore_extra_files�s��
�\�\�)�
$�	.���^�^�%�
.������6���6�6�$�$�V�,��V�V�C��K�L�1�A�F��K�K��9�-�
.�	.�	.�	.�s�>B�1B�Bc��tj|�5}	|j�D�cgc]-}|jj	|j
dz�s�,|��/}}|j
||�	ddd�g}tjj|d�}tjtjj|d��D]3}tjj||�}	|j|	��5|jj||�ycc}w#t$rYddd�ywxYw#1swY��xYw)Nzvar/lib/apt-clone/debs/r�z*.deb)rdrrtrZr�r�r@rTrrr]r�r�rJr)
rr�rrtr��debsdir�debsr�deb�debpaths
          rr*z'AptClone._restore_not_downloadable_debs�s ��
�\�\�)�
$�	��
�36�>�>�3C�J��w�|�|�G^�G^�_c�_m�_m�oH�`H�HI�G�J��J����y��1�	����w�w�|�|�I�'A�B���9�9�R�W�W�\�\�$��8�9�	!�C��g�g�l�l�4��-�G��K�K�� �	!�	
�
�
�"�"�4��3��J���
��	�	�
��		�	�s?�D=�D&�-D!�D!�D&�!D&�&	D:�/D=�9D:�:D=�=Ec�b�ddlm}m}m}tj
j
dtjjtjj|ddd���tj
j
dtjjtjj|ddd���|d	�
�}|jddD]�}|js|jr�t||�rC|jD�cgc]'}dj |g|j#d�d
d�����)c}|_�kd}	dD])}
|j$j'd|
z�s�"|�d|
��}	n|	r|	|_��||_��tjj|ddd�}tj
j)d�}tjj+|�rst-|d�5}
|
D]C}|||�}|js|js||vs�)|jj/|��E	ddd�tj0|�|jD]�}t||�r5|j2D�cgc]}|j5d�s�|��c}s�<d	|_
�D|j6j5d�s�`|jj1|�|jj9d|�d	|_
��|j;�ycc}w#1swY��xYwcc}w)Nr)r<�SourceEntryr=r�r9rLr:r�zsources.list.dTr>z{}{}{}�-rr�)�updates�security�	backportsz-%szsources.list.apt-clone�rzcdrom:)rGr<r|r=r`rbrGrr�abspathr]rHrIrJrK�suites�format�	partition�distr_r�r rr�rUrLr�rMrrN)rrr-r<r|r=r�rQr��replacement�pocketrO�
sourcelistrr��src�us                 rr(zAptClone._rewrite_sources_list�s���V�V������"��G�G�O�O�B�G�G�L�L��E�5�.�Q�R�	T�	�����#��G�G�O�O�B�G�G�L�L��E�5�BR�S�T�	V��T�*���\�\�!�_�	,�E��}�}������%�!2�3�#�\�\� ��$�H�O�O�J�F����S�1A�!�"�1E�F� ���
!��B��F��z�z�*�*�5�6�>�:�1;�V�&D�����!,�E�J�!+�E�J�%	,�(�7�7�<�<�	�5�%� 8�:���^�^�-�-�.D�E�
�
�7�7�>�>�(�#��h��$�
1���1�D�%�d�J�7�C����s�|�|��7�8J����+�+�C�0�1�
1�

�I�I�h���\�\�	*�E��%�!2�3� %�z�z�D�!�Q�\�\�(�-C�A�D�%)�E�N��9�9�'�'��1��L�L�'�'��.��L�L�'�'��5�1�%)�E�N�	*�	�����O �&
1�
1��Es$�,L�7+L �#L �L,�L,� L)c���|r!tjj|d�}nd}t�}tjj	t
jjd��}tjtjj|dd��D]Q}t|d��5}|D]3}|jd�s�|j|j���5	ddd��St�}tj|�D]O\}	}
}|D]D}tjj|	t|�d|�}
|
|vs�4|j|
��F�Q|S#1swY��xYw)	Nr9z/etcrYr�z*.listr�)�encodingz/etc/)rrr]rGr1r`rbr�r�rr�r/r��walkr�)rrn�etcdir�owned�dpkg_basedirr�rr��unowned�dirpath�dirnames�	filenamesrZ�fullnames              r�_find_unowned_in_etczAptClone._find_unowned_in_etc�s3����W�W�\�\�)�U�3�F��F�����w�w���w�~�~�'9�'9�:N�'O�P�����2�7�7�<�<��f�h�G�H�	0�A��a�'�*�
0�b��0�D����w�/��	�	�$�*�*�,�/�0�
0�
0�	0��%��,.�G�G�F�O�	*�(�G�X�y�!�
*���7�7�<�<���I���(@�$�G���5�(��K�K��)�
*�	*�
��
0�
0�s�0E'�!E'�'E0	c��|tjjd�z}t�}t	|�5}tj
|�}|D�]h}d|vs�	|dj
d�D�]H}d}t|j
��dk(r|j
�\}	}
}n|j
�\}	}
||	z}|
j�}
|dk(r�etjj|�s*tjd|z�|j|���tj �}t	|d�5}|j#|j%��ddd�|j'�|
k7s��tjd|�d	|j'��d
|
�d��|j|���K��k	ddd�|S#1swY�mxYw#1swY|SxYw)NrY�	conffilesr���obsoletezconffile %s removedr�z	conffile r^z != r_)r`rbr~rGr�TagFiler�r�r�rrr rj�debugr/�hashlib�md5r4r��	hexdigest)
rrnr��modifiedr�tagrQr�r�rZ�md5sumrr�s
             r�_find_modified_conffilesz!AptClone._find_modified_conffiless������� 3� 3�4H� I�I���5��
�+�
�	/�"��/�/�"�%�C��
/���%�'� %�k� 2� 8� 8�� >�/��#'���t�z�z�|�,��1�59�Z�Z�\�2�D�&�(�+/�:�:�<�L�D�&�(��~��!'�����#�z�1�$�!�w�w�~�~�d�3�#�M�M�*?�$�*F�G�$�L�L��.�$�%�k�k�m��!�$��-�2���J�J�r�w�w�y�1�2��=�=�?�f�4�#�M�M�$(�#�-�-�/�6�+C�D�$�L�L��.�1/�
/�	/�:��
2�2��/	/�:��s1� G�C"G�; G	�G�8AG�G
�G�Gc��td�y)Nznot implemented yet)r)rrns  r�_dump_debconf_databasezAptClone._dump_debconf_database%s��
�#�$r)NNN)FFFN)F)r
)r
NNFNr=)FN)r�)(r>r?r@rArr}r^r�rVrur�rerkrfrlrgrirjrhr�r�rmr�r�r�r�rr!r/r7r&r'r5r)r+r*r(r�r�r�rBrrrDrDbs����1�8�2�8�8�:�a�=�@�N��I�=A��(�2=B�48�'�@�=�6�%/�NH�L�:�:�8�(.�(
�� ��&�PI��.GM�VDH�GK�#F�L�2�0"�$>�@A�".�4�6�p�,!�F%rrD)�
__future__rrL�	apt.cacherr`rrYr�r�rjr*�ImportErrorrr�r�rBrrdr�r��iorr�environrbrG�objectr
rDrBrr�<module>r�s���&&�
�*���������
�	�
�����������+��N�N���2�C�8��N�N���8�#�>�/�v�/�dD%�v�D%��G���K��s�B3�3B=�<B=

Zerion Mini Shell 1.0