Current File : //proc/self/root/lib/python3/dist-packages/DistUpgrade/__pycache__/DistUpgradeCache.cpython-312.pyc
�

>�gA�����ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZm
Z
ddlmZddlmZddlmZGd�de�ZGd	�d
e�ZGd�de�ZGd
�de�Zd�Ze�\ZZGd�de�ZGd�de�ZGd�dej>�Z e!dk(r�ddl"Z"ddl#m$Z$ddl%m%Z%e&d�e e$d�e%�d�Z'e&e'jQ��e"jR�e'jU�e'jW�e'jXe'j[dg�e&e'j]��e'j_�yy)�N)�Popen�PIPE�)�gettext)�ngettext)�
inside_chrootc��eZdZy)�CacheExceptionN��__name__�
__module__�__qualname__���>/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeCache.pyr
r
(���rr
c��eZdZy)�CacheExceptionLockingFailedNrrrrrr,rrrc��eZdZy)�CacheExceptionDpkgInterruptedNrrrrrr0rrrc���eZdZ�fd�Z�xZS)�PackageRemovalDeniedExceptionc����||_td�|z}tjd�j	|j�r|td|j�d��z
}t
�|�|�y)NzJThe package '%s' is marked for removal but it is in the removal deny list.z^postgresql-[0-9]*$z�

To prevent data loss, postgresql packages are not removed automatically during the upgrade. If you are certain you no longer need z7, you can manually remove it and try the upgrade again.)�package�_�re�compile�match�super�__init__)�selfr�msg�	__class__s   �rr z&PackageRemovalDeniedException.__init__5sq�������\�]�`g�g��
�:�:�,�-�3�3�D�L�L�A��1�"�"&�,�,��0-�-��
�C�	����r)rr
rr �
__classcell__)r#s@rrr4s
����rrc�0�d}d}tj�d}tjd|z�D]�}|d|zk(r#|tjj	|�z
}�.|jd�dk\s(|jd�dk\s|jd�dk\r�k|tjj	|�z
}��|dk(rt
jd�d	}|dk(rt
jd
�d}|dz
}d}|d
z|kDr|d
z}||z
}||fS)zjestimate the amount of space used by the kernel and initramfs in /boot,
    including a safety margin
    r�z
/boot/*%s*z/boot/initrd.img-%sz
initrd.imgz.bakz.dpkg-z>estimate_kernel_initrd_size_in_boot() returned '0' for kernel?iz>estimate_kernel_initrd_size_in_boot() returned '0' for initrd?i�
ig�������?)�os�uname�glob�path�getsize�find�logging�warning)�kernel�initrd�kver�f�
initrd_buffers     r�#estimate_kernel_initrd_size_in_bootr4Gs���F�
�F�
�8�8�:�a�=�D�
�Y�Y�|�d�*�
+�	)���%��,�,��b�g�g�o�o�a�(�(�F��f�f�\�"�a�'�1�6�6�&�>�Q�+>�����!�Q�&���b�g�g�o�o�a�(�(�F�	)���{����L�	N���
��{����L�	N���
�k��F��M�
��}�}�$���
�
�
�m��F��&�=�rc��eZdZdZd�Zd�Zy)�FreeSpaceRequiredz� FreeSpaceRequired object:

    This exposes:
    - the total size required (size_total)
    - the dir that requires the space (dir)
    - the additional space that is needed (size_needed)
    c�.�||_||_||_y�N)�
size_total�dir�size_needed)r!r9r:r;s    rr zFreeSpaceRequired.__init__ss��$������&��rc�T�d|j�d|j�d|j��S)NzFreeSpaceRequired Object: Dir: z
 size_total: z size_needed: )r:r9r;�r!s r�__str__zFreeSpaceRequired.__str__ws1��UY�U]�U]�_c�_n�_n�pt�qA�qA�B�	BrN)rr
r�__doc__r r>rrrr6r6ks���'�Brr6c��eZdZdZd�Zy)�NotEnoughFreeSpaceErrorzI
    Exception if there is not enough free space for this operation

    c��||_yr8)�free_space_required_list)r!rCs  rr z NotEnoughFreeSpaceError.__init__�s
��(@��%rN�rr
rr?r rrrrArA{s
���ArrAc���eZdZdZdZd;d�Zd�Zed��Zd�Z	d�Z
d	�Zd
�Zd�Z
ed��Zed
��Zed��Zed��Zd�Zd�Zd<d�Zd�Zd=d�Zd=d�Zd=d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd>d�Z d>d�Z!d>d �Z"d>d!�Z#d"�Z$d#�Z%d$�Z&d%�Z'd&�Z(d'�Z)d(�Z*d)�Z+d*�Z,e
d+��Z-d,�Z.d-�Z/ed.��Z0d/�Z1d0�Z2d1�Z3d2�Z4d3�Z5e
d4��Z6d5�Z7d6�Z8d7�Z9d8�Z:d9�Z;d?d:�Z<y)@�MyCacher�Nc��g|_g|_||_||_d|_d|_||_|jjdd�|_d|_	|r,	tj�|j�d|_t"j$j'||�|j)dd�|_|jj-|d�|_t1dd	gt2d�
�j5�dj7�|_|j;�|j=dd
�dk(r2dt>j@vr tjjCdd�tjjCdd�y#t$r(}dt|�vrt|��t!|��d}~wwxYw)NF�Distro�MetaPkgs���Tzdpkg --configure -a�RemovalDenylistFiler(z-r)�stdout�universal_newlinesr�Sources�From�hardy�RELEASE_UPGRADE_NO_RECOMMENDSzAPT::Install-Recommends�truez"APT::AutoRemove::SuggestsImportant�false)"�
to_install�	to_remove�view�quirks�lock�partialUpgrade�config�getlist�metapkgs�
_listsLock�apt_pkg�pkgsystem_lock�lock_lists_dir�SystemError�strrr�apt�Cacher �getListFromFile�removal_denylist�_get_linux_metapackage�linux_metapackagerr�communicate�stripr(�_initAptLog�getr'�environ�set)r!r[rWrX�progressrY�es       rr zMyCache.__init__�s|����������	������	�#���������+�+�H�j�A��
�����
5��&�&�(��#�#�%� ��	�	�	�	���4��*� &� 6� 6�x�AV� W���!%���!C�!C�D�%�!P����G�T�?�4�.2�4�4?�K�M�!�E�EJ�U�W�	
�
�����
�J�J�y�&�)�W�4�/�2�:�:�=��N�N���8�&�A�	�����?��I��+�
5�(�C��F�2�7��:�:�1�!�4�4��	
5�s�+F�	G�#F<�<Gc��|D]J}|jr�|jjtjk(s�8|jdd���Ly)z! honor the dselect install state F)�	auto_inst�auto_fixN)�is_installed�_pkg�selected_stater_�SELSTATE_INSTALL�mark_install�r!�pkgs  r�_apply_dselect_upgradezMyCache._apply_dselect_upgrade�sJ���	B�C������x�x�&�&�'�*B�*B�B�� � �5�5� �A�	Brc�2�t�}|D]�}|jr|jjr�&|jj|j
k(s$|jj|jk(s�m|j|j���|S)zB return the packages not downloadable packages in reqreinst state )	ro�	candidate�downloadablerv�
inst_state�	ReInstReq�
HoldReInstReq�add�name)r!�	reqreinstr{s   r�req_reinstall_pkgszMyCache.req_reinstall_pkgs�ss���E�	��	(�C��]�]�#�-�-�*D�*D����$�$����6����$�$��(:�(:�:��
�
�c�h�h�'�	(��rc�x�|j}t|�dkDr�tddt|��}tddt|��dj|�z}|j	||�rP|j�gd�t
|�z}|j�j|�|j�yy	)
z/ check for reqreinst state and offer to fix it rzRemove package in bad statezRemove packages in bad statez�The package '%s' is in an inconsistent state and needs to be reinstalled, but no archive can be found for it. Do you want to remove this package now to continue?z�The packages '%s' are in an inconsistent state and need to be reinstalled, but no archives can be found for them. Do you want to remove these packages now to continue?�, )z
/usr/bin/dpkgz--removez--force-remove-reinstreqTF)
r��lenr�join�askYesNoQuestion�release_lock�list�getTerminal�call�get_lock)r!rWr��header�summary�cmds      r�fix_req_reinstzMyCache.fix_req_reinst�s����+�+�	��y�>�A���;�<�!�)�n�.�F�� 2�
 +�
 #�9�~�
/�26���9�1E�
F�G��$�$�V�W�5��!�!�#�O�RV�W`�Ra�a��� � �"�'�'��,��
�
���rc�^�|jjddd�}tjj	|�stj
|�tjjd|�tjjdd�tjtjj|d�tjtjztjzd�|_
tjj�}d	|z}tj |j|j#d
��tjjdd�tjjd
d�tjjdd�y)z init logging, create log file�Files�LogDirz/var/log/dist-upgradezDir::LogzDir::Log::Terminalzapt-term.logzapt.logi�z
Log time: %s
zutf-8zDebug::pkgProblemResolverrSzDebug::pkgDepCache::MarkerzDebug::pkgDepCache::AutoInstallN)r[�getWithDefaultr'r*�exists�makedirsr_ro�openr��O_RDWR�O_CREAT�O_APPEND�logfd�datetime�now�write�encode)r!�logdirr�r�s    rrlzMyCache._initAptLog�s�����+�+�G�X�,C�E���w�w�~�~�f�%��K�K��������:�v�.������/��@��W�W�R�W�W�\�\�&�)�<��Y�Y����3�b�k�k�A�5�J��
����#�#�%��!�C�'��
������V�]�]�7�3�4�	�����6��?������7��@������<�f�Erc��t|d�r>tj|j�tj|j�tj
d�|_tj
d�|_tj|jd�tj|jd�y)N�
old_stdoutrr&)�hasattrr'�closer��
old_stderr�dup�dup2r�r=s r�_startAptResolverLogzMyCache._startAptResolverLog�sn���4��&��H�H�T�_�_�%��H�H�T�_�_�%��&�&��)����&�&��)���
����
�
�A��
����
�
�A�rc���tjd�tjd�tj|jd�tj|jd�y)Nrr&)r'�fsyncr�r�r�r=s r�_stopAptResolverLogzMyCache._stopAptResolverLog�s<��
�����
�����
�������#�
�������#rc����fd�}|S)z3 decorator to ensure that the apt output is logged c�d��|dj��|i|��}|dj�|S�Nr)r�r�)�args�kwargs�resr2s   �r�wrapperz(MyCache.withResolverLog.<locals>.wrappers7�����G�(�(�*��T�$�V�$�C���G�'�'�)��Jrr)r2r�s` r�withResolverLogzMyCache.withResolverLogs���	�
�rc���tj|j�}tj�}|j	||j
|j�|jS)z< get the size of the packages that are required to download )r_�PackageManager�	_depcache�Acquire�get_archives�_list�_records�fetch_needed)r!�pm�fetchers   r�required_downloadzMyCache.required_downloadsH���
#�
#�D�N�N�
3���/�/�#��
�������T�]�]�;��#�#�#rc�.�|jjS)z9 get the size of the additional required space on the fs )r��usr_sizer=s r�additional_required_spacez!MyCache.additional_required_spaces���~�~�&�&�&rc�N�	|jjS#t$rYywxYw)z< get the extra size needed to install the snap replacements r)rX�extra_snap_space�AttributeErrorr=s r�#additional_required_space_for_snapsz+MyCache.additional_required_space_for_snapss+��
	��;�;�/�/�/���	��	�s��	$�$c�4�|jjdkDS)z is the cache broken r)r��broken_countr=s r�	is_brokenzMyCache.is_broken%s���~�~�*�*�Q�.�.rc��tjjd�dz}tj|�|_|jdkrd|z}t|��y)NzDir::State::ListsrYrzCan not lock '%s' )r_r[�find_dirr�r^r)r!r�rqs   rrazMyCache.lock_lists_dir+sT���~�~�&�&�':�;�f�D��!�*�*�4�0����?�?�Q��$�t�+�A�-�a�0�0�rc�p�|jdkDr'tj|j�d|_yy)NrrK)r^r'r�r=s r�unlock_lists_dirzMyCache.unlock_lists_dir1s*���?�?�Q���H�H�T�_�_�%� �D�O�rc���|j�tjj||�}|j	�|r |j
rt
td���|dk(rt
d��y)zf
        our own update implementation is required because we keep the lists
        dir lock
        zThe server may be overloadedFzAapt.cache.update() returned False, but did not raise exception?!?N)r�rdre�updatera�release_file_download_error�IOErrorr)r!�	fprogressr�s   rr�zMyCache.update5sh��
	
�����i�i���t�Y�/��������>�>��!�:�;�<�<��%�<��]�^�^�rc��tjd�|jr|j�tj
j
|||�y)Nzcache.commit())r-�inforYr�rdre�commit)r!r��	iprogresss   rr�zMyCache.commitDs8�����%�&��9�9������	�	����y�)�4rc��|jr	tj�d|_yy#t$r"}t	j
d|z�Yd}~yd}~wwxYw)NFzfailed to SystemUnLock() (%s) )rYr_�pkgsystem_unlockrbr-�debug�r!�
pkgSystemOnlyrqs   rr�zMyCache.release_lockJsP���9�9�
D��(�(�*�!��	����
D��
�
�>��B�C�C��
D���+�	A�A�Ac��|js	tj�d|_yy#t$r"}t	j
d|z�Yd}~yd}~wwxYw)NTzfailed to SystemLock() (%s) )rYr_r`rbr-r�r�s   rr�zMyCache.get_lockRsP���y�y�
B��&�&�(� ��	����
B��
�
�<�q�@�A�A��
B�r�c���|r&|jj|j�}n|jj}|dk(r't	j
d|j�d|�d��y|jS)z* check if the given pkg can be downloaded Nzno version information for 'z' (useCandidate=�)F)r��get_candidate_verrv�current_verr-r.r�r)r!r{�useCandidate�vers    rrzMyCache.downloadableZs[����.�.�2�2�3�8�8�<�C��(�(�&�&�C��$�;��O�O�SV�S[�S[�]i�j�k�����rc�h�|jxr%|jj|j�S)z$ check if the pkg is auto-removable )rur��
is_garbagervrzs  r�pkg_auto_removablezMyCache.pkg_auto_removablees+��� � �4����)�)�#�(�(�3�	5rc�6�|jj�S)z^ try to fix broken dependencies on the system, may throw
            SystemError when it can't)r��
fix_brokenr=s rr�zMyCache.fix_brokenjs���~�~�(�(�*�*rc�(�g|_g|_|j�D]q}|js|jr%|jj|j�|js�M|jj|j��sy)z* create a snapshot of the current changes N)rUrV�get_changes�marked_install�marked_upgrade�appendr��
marked_deleterzs  r�create_snapshotzMyCache.create_snapshotosn���������#�#�%�	0�C��!�!�S�%7�%7����&�&�s�x�x�0�� � ����%�%�c�h�h�/�		0rc�8�|jj�yr8)r��initr=s r�clearz
MyCache.clearys�������rc��tj|j�}||j�|jD]}||}|j��|jD]}||}|jdd���y)z restore a snapshot F)rtrsN)r_�ActionGroupr�r�rV�mark_deleterUry)r!�actiongroupr�r{s    r�restore_snapshotzMyCache.restore_snapshot|s{���)�)�$�.�.�9��	��
�
���N�N�	�D��t�*�C��O�O��	��O�O�	>�D��t�*�C����e�u��=�	>rc�|�|jjdd�}|D]�}||vr)||jrtjd|z�yd}|jj|d�D]}|||vxr||jz}�|s�ntjd|z�ytjd�y)	ac
        This checks if we run on a desktop or a server install.

        A server install has more freedoms, for a desktop install
        we force a desktop meta package to be install on the upgrade.

        We look for a installed desktop meta pkg and for key
        dependencies, if none of those are installed we assume
        server mode
        rIrJz@need_server_mode(): run in 'desktop' mode, (because of pkg '%s')FT�KeyDependencieszIneed_server_mode(): run in 'desktop' mode, (because of key deps for '%s')z[need_server_mode(): can not find a desktop meta package or key deps, running in server mode)r[r\rur-r�)r!r]�key�
deps_foundr{s     r�need_server_modezMyCache.need_server_mode�s����;�;�&�&�x��<���	�C��d�{�t�C�y�5�5��
�
�`�cf�f�g���J��{�{�*�*�3�0A�B�
E���c�T�k�D�d�3�i�.D�.D�D�
�
E���
�
�i�lo�o�p��	�	�
�
�s�t�rc���|jr'	tjd�|j�yy#t$r'|jt
d�t
d��YywxYw)zY check if the cache is ok and if the required metapkgs
            are installed
        z$Have broken pkgs, trying to fix themzBroken packagesz�Your system contains broken packages that couldn't be fixed with this software. Please fix them first using synaptic or apt-get before proceeding.FT)r�r-r�r�rb�errorr)r!rWs  r�coherence_checkzMyCache.coherence_check�sf���>�>�

��
�
�D�E����!����
��
�
�1�.�/�!"�$@�"A�B��
�s�%5�-A%�$A%c���tjd|�d|�d��||vrL||jdi|��||js(||jstj
d|z�yy)NzInstalling '�' (r�z Installing/upgrading '%s' failedFTr)r-r�ryr�r�r�r!r{�reason�flagss    rryzMyCache.mark_install�sb���
�
��V�<�=��$�;�"�D��I�"�"�+�U�+���I�,�,��S�	�0H�0H��
�
�@�3�F�G��rc���tjd|�d|�d��||vrJ||jr;||j�||jstj
d|z�yy)NzUpgrading 'rr�zUpgrading '%s' failedFT)r-r�ru�mark_upgrader�r�r!r{rs   rr	zMyCache.mark_upgrade�s[���
�
�s�F�;�<��$�;�4��9�1�1���I�"�"�$���9�+�+��
�
�5��;�<��rc�p�tjd|�d|�d��||vr||jdi|��yy)Nz
Removing 'rr�r)r-r�r�rs    r�mark_removezMyCache.mark_remove�s6���
�
�c�6�:�;��$�;�!�D��I�!�!�*�E�*�rc��tjd|�d|�d��||vr*|jj||jd�yy)Nz	Purging 'rr�T)r-r�r�r�rvr
s   r�
mark_purgezMyCache.mark_purge�s;���
�
�S�&�9�:��$�;��N�N�&�&�t�C�y�~�~�t�<�rc�r�||vr3||jr#||jr|j||�yyyyr8)rur�ry)r!�pkgnamers   r�_keep_installedzMyCache._keep_installed�sB���t�O��W�
�*�*��W�
�+�+����g�v�.�,�+�
rc	�b�|jjdd�D]}|j|d��|jD]\}||vs�||js||j
s�'|jj|d�D]}|j|d|z���^|jj
dd�dk(�rqtjd�|jjdd	�D]s}|D]l}|js�|jjs�'|js�4|jj|k(s�N|j|jd
|z��n�u|jD]�}||vs�||js||j
s�'|jj|d	�D]u}|D]n}|js�|jjs�'|js�4|jj|k(s�N|j|j|�d|����p�w��yy)
z[ run after the dist-upgrade to ensure that certain
            packages are kept installed rI�KeepInstalledPkgszDistro KeepInstalledPkgs rulez%s KeepInstalledPkgs rule�Options�withNetwork�Truez"Running KeepInstalledSection rules�KeepInstalledSectionz$Distro KeepInstalledSection rule: %sz KeepInstalledSection rule: N)r[r\rr]rur�rmr-r�r~rr��sectionr�)r!rr�rr{s     r�keep_installed_rulezMyCache.keep_installed_rule�s���{�{�*�*�8�5H�I�	K�G�� � ��*I�J�	K��=�=�	U�C��d�{��S�	� 6� 6� $�S�	� 8� 8�#�{�{�2�2�3�8K�L�U�G��(�(��2M�PS�2S�T�U�	U��;�;�?�?�9�m�4��>��M�M�>�?��;�;�.�.�x�9O�P�
i���i�C��
�
�#�-�-�*D�*D��-�-��M�M�1�1�W�<��,�,�S�X�X�7]�`g�7g�h�	i�
i��}�}�
t���$�;�D��I�$:�$:�$(��I�$<�$<�#'�;�;�#6�#6�s�<R�#S�t��#'�t�C� #�
�
�#�-�-�2L�2L�$'�$5�$5� #�
�
� 5� 5�� @� $� 4� 4�S�X�X�eh�jq�?r� s�	t�t�
t�?rc�T�|js|jjd�yy)z. run before the upgrade was done in the cache �PreDistUpgradeCacheN)rZrX�runr=s r�pre_upgrade_rulezMyCache.pre_upgrade_rules#���"�"��K�K�O�O�1�2�#rc
��d|jfd|jfd|jfd|jffD]�\}}|jjdd|z�D]}||d|z��|jD]Y}||vs�||js||js�'|jj|d|z�D]}|||�d|�d	����[��|js|jjd
�yy)z- run after the upgrade was done in the cache �Install�Upgrade�Remove�PurgerIz
PostUpgrade%szDistro PostUpgrade%s rulez PostUpgradez rule�PostDistUpgradeCacheN)ryr	rrr[r\r]rur�rZrXr)r!�rule�actionr{r�s     r�post_upgrade_rulezMyCache.post_upgrade_rules�� )�4�+<�+<�=� )�4�+<�+<�=� (�$�*:�*:�;� '����9�;�	K�N�T�6�
�{�{�*�*�8�_�t�5K�L�
@���s�7�$�>�?�
@��}�}�
K���$�;�D��I�$:�$:�$(��I�$<�$<�#�{�{�2�2�3��$�8N�O�K���s�s�D�$I�J�K�
K�	K��"�"��K�K�O�O�2�3�#rc���tjd�	ddlm}	|d��}|jD]*}||vs�||js�|j|d	�ntjd
�y|j�}tjd|z�||vrtjd|z�y||js;||js,||j�tjd
|z�yy#tt
f$r"}tjd|z�Yd}~yd}~wwxYw#t $r"}tjd|z�Yd}~yd}~wwxYw)zR
        this checks for nvidia hardware and checks what driver is needed
        znvidiaUpdate()r)�NvidiaDetectionz%NvidiaDetector can not be imported %sNFz./ubuntu-drivers-obsolete.pkgs)�obsoletezold nvidia driverz1no old nvidia driver installed, installing no newznv.selectDriver() returned '%s'z
no '%s' foundz,installing %s as suggested by NvidiaDetectorTz$NvidiaDetection returned a error: %s)r-r��NvidiaDetector.nvidiadetectorr(�ImportError�SyntaxErrorr�oldPackagesrurr��selectDriverr.r�r�ry�	Exception)r!r(rq�nv�	oldDriver�drivers      r�checkForNvidiazMyCache.checkForNvidiasP��	�
�
�&�'�	�E�	F�!�*J�K�B� �^�^�
�	���$��i��)E�)E��$�$�Y�0C�D��
�
���P�Q���_�_�&�F��M�M�;�f�D�E��T�>�����&� 8�9����L�/�/�4��<�3N�3N��V��)�)�+����K�f�T�U����=�[�)�	�
�M�M�A�A�E�F���		��8�	F��M�M�@�1�D�E�E���	F�sG�D�D:�D:�*D:�6AD:�;A	D:�D7�D2�2D7�:	E%�E � E%c�f�|D],}|jjd�s�|js�,yy)Nzlinux-headers-TF)r��
startswithrurzs  r�_has_kernel_headers_installedz%MyCache._has_kernel_headers_installedBs5���	�C����#�#�$4�5�� � ��	�rc�\�tjd|jz�	|jjd�\}}}t
dgt��j�d}d	|vrtjd
�y#t$r"}tj
d|z�Yd}~yd}~wwxYw)zd check for the running kernel and try to ensure that we have
            an updated version
        zKernel uname: '%s' �-z/Can't parse kernel uname: '%s' (self compiled?)NF�dmesg)rMrsWARNING: NR_CPUS limitzUP kernel on SMP system!?!T)	r-r�r(�splitr/r.rrrj)r!�version�build�flavourrqr9s      r�checkForKernelzMyCache.checkForKernelIs���	�
�
�+�d�j�j�8�9�	�(,�
�
�(8�(8��(=�%�W�e�W�
�w�i��-�9�9�;�A�>��$��-��M�M�6�7����	��O�O�M�PQ�Q�R���	�s�B�	B+�	B&�&B+c�<�d}|jjdd�}|D]�}|jjj	|j
�}|r2|jdk(r#tjd|jz��f|js�s|jjs��|jr��|jr��|j|vs��d|jvs��|jj|vs��|j|jd|z���y)N)�requiredrI�RemoveEssentialOkrzPackage %s has no priority set�:z;priority in required set '%s' but not scheduled for install)r[r\�_pcacher�r�rv�priorityr-rr�r~rrur�ry)r!�need�removeEssentialOkr{r�s     r�
checkPriorityzMyCache.checkPriorityYs����� �K�K�/�/��:M�N���	r�C��+�+�'�'�9�9�#�(�(�C�C��s�|�|�q�(��
�
�>����I�J���
�
�#�-�-�"<�"<��%�%��);�);��H�H� 1�1��3�8�8�O��
�
�&�&�$�.��!�!�#�(�(�,i�lp�,p�q�	rrc��d}|j�rS|dzdk(r|j�|j�tjd�|dz
}|j�r�S|jd��|j�y)Nr�g{�G�z�?rT)�finished)�locked�
pulseProgress�
processEvents�time�sleep)r!rWrY�is    r�	updateGUIzMyCache.updateGUInsr��
���k�k�m��2�v��{��"�"�$���� ��J�J�t��
��F�A��k�k�m�	
���D��)����rc�2�tj�}|j�tj|j|j
|f��}|j
�	|j�|jd�|j�|j�t�rtjd�n|j�|j�|j!�|j#|�|s|j%|�|j'�|j(r-t+t-d�dj/d�|D��z��	|jA�|j/�g}	g}
|jC�D�]=}|jDr�|jFr�|
jI|jJ�|jLjND]�}tQjR|jT|jVjX�dks�;|jZD]V\}
}|j\j^ja|
�}|s�.|jbr�;|	jI|jJ�������|jdjf}d}|D]}||jhz}�|r��#|	jI|jJ���@	|j6jkdd�}|rtjd�y	tq|
�dkDr7|
js�tj<ddj/|
�z�tq|	�dkDr�|	js�tj<ddj/|	�z�|j;�|j=t-d�t-d�dj/|	��|j?�yy#t*t0f$�rZ}t-d�}t3|t0�r|t5|�dzz
}nz|j6j9d	d
�dk(r|t-d�z
}nL|j6j9d	d
�d
k(r-|j6j9d	d�dk(r|t-d�z
}|r|t-d�z
}n|t-d�z
}|t-d�z
}|j;�|j=t-d�|�t5|�}tj<d|�|j?�Yd}~|jA�|j/�yd}~wwxYw#|jA�|j/�wxYw#tljn$rY���wxYw) N)�targetr�Tz5skipping kernel checks because we run inside a chrootz!Broken packages after upgrade: %sr�c3�fK�|])}|js
|js�|j���+y�wr8)�is_inst_broken�
is_now_brokenr�)�.0�ps  r�	<genexpr>z&MyCache.distUpgrade.<locals>.<genexpr>�s>����UR�`a�mn�m}�m}�BC�BQ�BQ�UV�U[�U[�UR�s�1�1zBAn unresolvable problem occurred while calculating the upgrade.

 z

r�foreignPkgsrz�This was likely caused by:
 * Unofficial software packages not provided by Ubuntu
Please use the tool 'ppa-purge' from the ppa-purge 
package to remove software from a Launchpad PPA and 
try the upgrade again.

�False�
devReleasez�This was caused by:
 * Upgrading to a pre-release version of Ubuntu
This is most likely a transient problem, 
please try again later.
z@This is most likely a transient problem, please try again later.z�If none of this applies, then please report this bug using the command 'ubuntu-bug ubuntu-release-upgrader-core' in a terminal. z�If you want to investigate this yourself the log files in '/var/log/dist-upgrade' will contain details about the upgrade. Specifically, look at 'main.log' and 'apt.log'.zCould not calculate the upgradezDist-upgrade failed: '%s'FrrI�AllowUnauthenticatedzAllowUnauthenticated set!z!Packages to downgrade found: '%s'� z$Unauthenticated packages found: '%s'z"Error authenticating some packagesz�It was not possible to authenticate some packages. This may be a transient network problem. You may want to try again later. See below for a list of unauthenticated packages.�
):�	threading�Lock�acquire�ThreadrQrW�startr�upgraderGrrr-r.r>r3r&�_keepBaseMetaPkgsInstalled�_installMetaPkgs�_verifyChangesr�rbrr�r�
isinstancercr[rmr�rr��releaser�r��marked_downgrader�r�rv�version_listr_�version_compare�ver_str�	installedr;�	file_listrCr��
find_index�
is_trustedr~�origins�trusted�
getboolean�configparser�
NoOptionErrorr��sort)r!rW�
serverModerZrY�trq�details�	error_msg�	untrusted�	downgrader{r��verFileIter�index�	indexfilersrt�origin�bs                    r�distUpgradezMyCache.distUpgradeys����~�~����������D�N�N�$�)�)�T�9K�L��	���	�V	�

�!�!�#�
�L�L���
��� �
�$�$�&������ W�X��#�#�%�
���!�
�"�"�$�
�+�+�D�1���%�%�d�+�
���!��~�~�!�!�$G�"H�4�9�9�UR�ei�UR�LR�#R�S�S��^
�L�L�N�
�F�F�H��	��	��#�#�%�	+�C�� � ���#�#�� � ����*��8�8�0�0�&�C��.�.����S�]�]�%:�%:�<�>?�@�47�M�M�&�0�[�%�(+���(9�(9�(D�(D�[�(Q�I�(��1E�1E� )� 0� 0���� :� %�	&�	&���m�m�+�+�G��G�!�
*���6�>�>�)��
*��� � ����*�-	+�0	����&�&�x�1G�H�A����� ;�<���
�y�>�A���N�N���M�M�=��(�(�9�-�.�
/��y�>�A���N�N���M�M�@��(�(�9�-�.�
/�
�$�$�&��J�J�q�=�>��=�>��y�y��+�
-�
�%�%�'����K�:�;�)	��9�:�G��!�:�;��3�q�6�F�?�*��������M�:�f�D��1�"�#�#��������M�:�g�E������	�<�8�F�B��A�:�;�;����1�7�8�8���1�e�f�f���1�O�P�P��

�$�$�&��J�J�q�:�;�W�E��A��I��M�M�5�y�A�
�%�%�'��
�L�L�N�
�F�F�H��[)	��X
�L�L�N�
�F�F�H��D�)�)�	��	�s>�#C>O-�3U?�-U�=D0U�-U�U�U�"U<�?V�Vc��tjjd�}|jjdd�}|j	�D]�}|j
rP|j
|j�r5tjd|j�t|j��|j
s�l|jjdk(s��|jj|dfvs��|j|vs��tjd|j�tt!d�|jz��|jjdd	�}|D]}}|j#d
�\}}||vs�||j$s�,||j$j&|k(s�I||j(s||j*s�htt!d�|z��y)zy this function tests if the current changes don't violate
            our constraints (deny listed removals etc)
        zAPT::ArchitecturerIrAzHThe package '%s' is marked for removal but it's in the removal deny listT�allzDThe package '%s' is marked for removal but it's an ESSENTIAL packagez1The essential package '%s' is marked for removal.�BadVersionsrz*Trying to install deny listed version '%s')r_r[r,r\r�r��_inRemovalDenylistr�r-r�rrv�	essentialro�architecturerbrr:r~r;r�r�)r!�	main_archrFr{�badVersions�bvrr�s        rrhzMyCache._verifyChangess����N�N�'�'�(;�<�	� �K�K�/�/��:M�N���#�#�%�		e�C�� � �T�%<�%<�S�X�X�%F��
�
�h�jm�jr�jr�s�3�C�H�H�=�=�� � ��H�H�&�&�$�.��M�M�.�.�9�e�2D�D����$5�5��
�
�d�fi�fn�fn�o�!�!�$W�"X�[^�[c�[c�"c�d�d�		e��k�k�)�)�(�M�B���	X�B��X�X�c�]�N�W�c��4��D��M�$;�$;��W�
�'�'�/�/�3�6��g��-�-��g��-�-�!�!�$P�"Q�TV�"V�W�W�
	X�rc��|jjj|j�}|�t	d|j
�y|j�'t	d|jj�z�y|jjd�\}}|jjj||f�y)a
        helper to make sure that the pkg._records is pointing to the right
        location - needed because python-apt 0.7.9 dropped the python-apt
        version but we can not yet use the new version because on upgrade
        the old version is still installed
        zNo candidate ver: FzNo file_list for: %s rT)
rCr�r�rv�printr�rp�popr��lookup)r!r{r�r2r�s     r�_lookupPkgRecordzMyCache._lookupPkgRecord,s����k�k�#�#�5�5�c�h�h�?���;��&����1���=�=� ��)�D�I�I�N�N�,<�<�=���=�=�$�$�Q�'���5������#�#�Q��J�/�rc��i}t�}|D]�}|j|�s#tjd|jz��7|j
jjjd�D]u}|jd�s�|td�djd�D]A}|j�}||vr
t�||<||j|j��C�w��|D]W}d}|jjdd�}||vrd}||D]}||jr�d}n|s�G|j|��Y|S)	Nz&no PkgRecord found for '%s', skipping r_�Task:�,TrI�IgnoredTasksF)ror�r-r�r�rCr��recordr:r5r�rkr�r[r\ru)	r!�tasks�installed_tasksr{�line�taskro�
ignored_tasksrs	         r�installedTaskszMyCache.installedTasks>sM�����%���
	2�C��(�(��-��
�
�F����Q�R�����,�,�3�3�9�9�$�?�
2���?�?�7�+�!%�c�'�l�m�!4� ;� ;�C� @�2��#�z�z�|���u�,�*-�%�E�$�K��d�������1�	2�
2�	
	2��
	*�D��I� �K�K�/�/��.�I�M��}�$�!�	� ��;�
���G�}�1�1� %�I��
���#�#�D�)�
	*��rc�t�tjd�|D�]}|js|jr�|j	|�t|jjd�r |jjjs#tjd|jz���|jjjjd�D][}|jd�s�|td�djd�D]'}|j�}||vs�|j��)�]�� y)Nzrunning installTasksr�zcan not find Record for '%s'r_r�r�T)r-r�r�rur�r�rCr�r�r.r�r:r5r�rkry)r!r�r{r�r�s     r�installTaskszMyCache.installTasksZs����
�
�,�-��	/�C��!�!�S�%5�%5���!�!�#�&��C�K�K�0�0�(�;����@T�@T�@[�@[���� >���� I�J�����,�,�3�3�9�9�$�?�
/���?�?�7�+�!%�c�'�l�m�!4� ;� ;�C� @�/��#�z�z�|���5�=��,�,�.�/�
/�	/�rc�j�|jjdd�D]}|j|d��y)NrI�BaseMetaPkgsz%base meta package keep installed rule)r[r\r)r!rWr{s   rrfz"MyCache._keepBaseMetaPkgsInstalledks5���;�;�&�&�x��@�	O�C�� � ��&M�N�	Orc	������fd�}�jjdd���jjdd�D]}�|j���D]P}	|�vrI�|jr:�|jr+tjd|z��|j��R|�s�tjd	�z��D]�}d
}�jj|d�D]}||�vxr�|jz}�|s�Atjd|z�	�|j�tjd|�d�|j�d��n|�sAdj�dd�}|jtd�td�|�dfz�yy
#t$r'}tjd|�d|�d��Yd}~���d}~wwxYw#ttf$rN}tjd
|�d|�d��|jtd�|ztd��Yd}~yd}~wwxYw)Nc�����D]o}|�vs��|}|jr.|jr"tjd|jz�|jr|jr�|j
s�oyy)zy
            internal helper that checks if at least one meta-pkg is
            installed or marked install
            z(metapkg '%s' installed but marked_deleteTF)rur�r-r�r�r�)r�r{r]r!s  ��r�metaPkgInstalledz2MyCache._installMetaPkgs.<locals>.metaPkgInstalledqst���
 �
$���$�;��s�)�C��'�'�C�,=�,=��
�
�&P�SV�S[�S[�&[�\��)�)�#�2C�2C���9�3�3�#�
$�rrIrJr�zMarking '%s' for upgradezCan't mark 'z' for upgrade (r�z$none of the '%s' meta-pkgs installedTr�z!guessing '%s' as missing meta-pkgzfailed to mark 'z' for install (zCan't install '%s'z�It was impossible to install a required package. Please report this as a bug using 'ubuntu-bug ubuntu-release-upgrader-core' in a terminal.Fzmarked_install: 'z' -> '�'r�rrKzCan't guess meta-packagez�Your system does not contain a %s or %s package and it was not possible to detect which version of Ubuntu you are running.
 Please install one of the packages above first using synaptic or apt-get before proceeding.)r[r\ryru�
is_upgradabler-r�r	rbr.�KeyErrorrrr�r�)	r!rWr�r{r�rqr��	meta_pkgsr]s	`       @rrgzMyCache._installMetaPkgsosA���
	� �;�;�&�&�x��<���;�;�&�&�x��@�	%�C���I�"�"�$�	%�
�
	O�C�	
O��4�K���I�*�*���I�+�+��M�M�"<�s�"B�C���I�*�*�,��
	O� �!��M�M�@�8�K�L��
��!�
��;�;�.�.�s�4E�F�I�C��#��+�"H�$�s�)�2H�2H�H�J�I���M�M�"E��"K�L�%��S�	�.�.�0��M�M�C��c��Ia�Ia�"b�c��'
�* �!��	�	�(�1�R�.�1�I��J�J�q�3�4��6�7�#�H�R�L�1�2�
3����S�
O����c�1� M�N�N��
O�� (��2�	%��
�
�'*�A�'/�0��
�
�1�%9�#:�S�#@�#$�&3�$4�5� %��	%�s2�A
F1�)G$�1	G!�:G�G!�$I�3AH<�<Ic��|jD]D}tj|�j|�s�(t	j
d|�d|�d��yy)Nzdenylist expr 'z' matches 'r�TF)rgrrrr-r�)r!r�exprs   rr�zMyCache._inRemovalDenylist�sL���)�)�	�D��z�z�$��%�%�g�.��
�
�#�W�.�/��		�
rc�"�||vrtjd|z�y|j|j�rtjd|z�y||jk(rtjd|z�y|j|�rtjd|z�y|jjdd�D]M}||vs�||js�||jj|k(s�5tjd|z�yy	)
Nzskipping foreign pkg '%s'Fz skipping running kernel pkg '%s'z skipping kernel metapackage '%s'z"skipping '%s' (in removalDenylist)rIrz'skipping '%s' (in KeepInstalledSection)T)
r-r��endswithr(rir�r[r\ror)r!r�foreign_pkgsrs    r�isRemoveCandidatezMyCache.isRemoveCandidate�s����l�"��M�M�5��?�@�����D�J�J�'��M�M�<�w�F�G���d�,�,�,��M�M�<�w�F�G���"�"�7�+��M�M�>��H�I���{�{�*�*�8�5K�L�	�G��4��D��M�$;�$;���M�+�+�3�3�w�>��
�
�G�'�Q�R��		�rc
�~�||vry||vry	|jjdd�}|r|j	�	||j||��|jj�|r`||vry|j�D]H}|j|vs�tjd|�d|j�d��|j�yy#tj$rd}Y��wxYw#ttf$rD}tjd	|�d
t!|��d|�d��|r|j�Yd}~yd}~wwxYw)
NFTrI�PurgeObsoletes)�purgertz	package 'z ' produces an unwanted removal 'z', skippingz'_tryMarkObsoleteForRemoval failed for 'r�: r�)r[rurvrwr�r�rWrMr�r�r-r�r�rbr�r.�repr)r!r�remove_candidates�forced_obsoletesrtr�r{rqs        r�tryMarkObsoleteForRemovalz!MyCache.tryMarkObsoleteForRemoval�s5��
�+�+���$���	��K�K�*�*�8�5E�F�E��� � �"�	���M�%�%�E�H�%�E��I�I�#�#�%���.�.���+�+�-�%�C��x�x�'8�8��
�
�dk�mp�mu�mu�&v�w��-�-�/�$�	%���3�)�)�	��E�	��(�X�&�	��O�O�U\�^b�cd�^e�gh�i�j���%�%�'���		�s:�C�6C)�2!C)�7C)�C)�C&�%C&�)D<�8:D7�7D<c��t�}|D]<}|js�|j|�r�"|j|j��>|S�z1 get all package names that are not downloadable )roru�anyVersionDownloadabler�r�)r!�
obsolete_pkgsr{s   r�_getObsoletesPkgszMyCache._getObsoletesPkgssK����
��	0�C����
�2�2�3�7�!�%�%�c�h�h�/�	0��rc�V�|jjD]}|js�yy)zA helper that checks if any of the version of pkg is downloadable TF)rvrlr)r!r{r�s   rr�zMyCache.anyVersionDownloadables,���8�8�(�(�	�C�����	�rc���t�}|D]P}|js�|jj|j�s�6|j|j��R|Sr�)rorur�r�rvr�r�)r!�unused_dependenciesr{s   r�_getUnusedDependencieszMyCache._getUnusedDependenciessQ��!�e���	2�C����D�N�N�$=�$=�c�h�h�$G�#�'�'����1�	2�#�"rc�(�t�}|jjdd�}tjj|�rMt
|�5}|D]3}|jd�r�|j|j���5	ddd�t�}|D][}||vr�||}|jr1|jj|j�s|jr�K|j|��]t|�S#1swY�~xYw)z� return list of installed and demoted packages

            If a demoted package is a automatic install it will be skipped
        rI�	Demotions�#N)ror[rmr'r*r�r�r5r�rkrur��is_auto_installedrvr�r�)r!�	demotions�demotions_file�demotions_fr��installed_demotions�demoted_pkgnamer{s        r�get_installed_demoted_packagesz&MyCache.get_installed_demoted_packagess���
�E�	�������;�?��
�7�7�>�>�.�)��n�%�
4��'�4�D��?�?�3�/�!�
�
�d�j�j�l�3�4�
4�"�e��(�	)�O��d�*����'�C��$�$����0�0����:��!�!���#�#�C�(�	)��'�(�(�
4�
4�s�D�)!D�Dc�v�t�}|D]�}|js�|j|�s�"|js�/d}|jjD]B}||j
vr|j|k(rd}||j
vs�1|j|k(s�Ad}�D|s��|j|j���|S)zm get all packages that are installed from a foreign repo
            (and are actually downloadable)
        TF)	rorurr~rs�archiver�r�r�)r!�allowed_origin�fromDist�toDistr�r{�foreignr�s        r�_getForeignPkgszMyCache._getForeignPkgs6s����u���	/�C����D�$5�$5�c�$:��}�}����!�m�m�3�3�(�F��6�>�>�1�!�=�=�N�:�"'������/�!�=�=�N�:�"'��(�� �$�$�S�X�X�.�!	/�"�rc
�.� �Gd�dt�}� fd�}g� i}i}td�5}|D]0}	|j�\}}	}
}}}
|	� vs� � j
|	��2	ddd�� jtd	�
�tjjd�}d}t|d
�rm|jjddd�rP|jjdd�}tj j#|�stj$|�t	j
d|z�dddd||ddfD]�}tj j'|�}||�}tj j#|�r/tj(|�}|j*|j,z}nt	j.d|z�d}||vr*t	j
d|�d||���|||||<��t	j
d|�d|���|||<||�||<��~t	j
d|z�d}|D]j}t1j2d|j4�s�$|j6s
|j8s�=t	j
|j4�d t:�d!��|d"z
}�l|t:z|d"zt<zz}d#}t|d
�r�|jjddd�rjt	j
d$�|jjdd�}|D]4}|j8s
|j6s�||j>j@z
}�6d#}|r^|D]A}|jBs�|j8s
|jDs�)||jFj@z
}�Ct	j
d%|z�||jHfd|jJfd|jLfd&d|fd'd(||fd|ff	D]�\}}|dkr�tj j'|�}t	j
d)||||||jNfz�||xjN|zc_'||xjP|z
c_(��i}|D]�}||jNdks�tjRtUtW||jN�d"z��}tY|tZ�r#|j]t_j`��}tjR||jP�}tY|tZ�r#|j]t_j`��}tc|||�|�|||�<��t|�dkDrQt	jdd*|D�cgc]
}tg|���c}z�titk|jm����y	#t$r'}t	j
d|�d|�d��Yd}~���d}~wwxYw#1swY���xYwcc}w)+z�
        this checks if we have enough free space on /var, /boot and /usr
        with the given cache

        Note: this can not be fully accurate if there are multiple
              mountpoints for /usr, /var, /boot
        c��eZdZdZd�Zy)�)MyCache.checkFreeSpace.<locals>.FreeSpacez@ helper class that represents the free space on each mounted fs c� �||_d|_yr�)�freerE)r!�initialFrees  rr z2MyCache.checkFreeSpace.<locals>.FreeSpace.__init__Ys��'��	���	rNrDrrr�	FreeSpacer�Ws
��N�
rr�c�>���D]}|j|�s�|cSy)z� return 'id' of a directory so that directories on the
                same filesystem get the same id (simply the mount_point)
            �/)r5)�d�mount_point�mounteds  �r�
make_fs_idz*MyCache.checkFreeSpace.<locals>.make_fs_id]s+��� '�
'���<�<��,�&�&�
'�rz/proc/mountszline 'z"' in /proc/mounts not understood (r�NT)r��reversezDir::Cache::archivesz/tmp/r[�Aufs�EnabledF�RWDirzcache aufs_rw_dir: %sr��/usrz/varz/bootz/homezdirectory '%s' does not existsrzDir z mounted on zFree space on r�zfs_free contains: '%s'z%^linux-(image|image-debug)-[0-9.]*-.*z (new-install) added with z to boot spacergz*taking aufs overlay into space calculationz&additional space for the snapshots: %s)r�i )z/tmpiP)r�i�z dir '%s' needs '%s' of '%s' (%f)zNot enough free space: %s)7�objectr�r:�
ValueErrorr-r�r�rxr�r_r[r�r�r�rmr'r*r�r��realpath�statvfs�f_bavail�f_frsizer.rrr�r�r��KERNEL_SIZE�INITRD_SIZEr~�installed_sizerur�ror�r�r�r�rE�size_to_str�float�absri�bytes�decode�locale�getpreferredencodingr6rrcrAr��values)!r!�snapshots_in_user�r��mnt_map�fs_free�mountsr��what�where�fs�options�ar�rq�
archivedir�aufs_rw_dirr��fs_id�str��kernel_countr{�
space_in_boot�required_for_aufs�required_for_snapshotsr:�size�
required_list�
free_at_least�free_neededrPr�s!                                @r�checkFreeSpacezMyCache.checkFreeSpaceNs����	��	�	�������
�.�
!�	*�V��
*���7;�z�z�|�4�T�5�"�g�q�!���'��N�N�5�)�
*�	*�	����d��+��^�^�,�,�-C�D�
����D�(�#��K�K�&�&�v�y�%�@��+�+�/�/�&�'�:�K��7�7�>�>�+�.����K�(��
�
�-��;�<��v�v�w�
�K��RY�Z�	-�A���� � ��#�A��q�M�E��w�w�~�~�a� ��Z�Z��]���{�{�R�[�[�0����� @�1� D�E�������
�
� �'�%�.�2�3�$�W�U�^�4���
��
�
� �$�(�)�!"����&�t�_���
�#	-�$
��
�
�.��8�9�
���	&�C��x�x�?����J��%�%��);�);��M�M�TW�T\�T\�^i�"j�k� �A�%�L�	&�&��3�(�1�,��;�<�
� ���D�(�#��K�K�&�&�v�y�%�@��M�M�F�G��+�+�/�/�&�'�:�K��
F���%�%��);�);�%����)E�)E�E�%�
F�
"%����
K���$�$��'�'�3�+<�+<�*�c�m�m�.J�.J�J�*�
K�
�M�M�B�E[�[�\�(��)?�)?�@�#�T�%C�%C�D�#�T�%M�%M�N�2�$�m�4�1�/�(�*;�<�#�%;�<��	&�K�S�$��a�x���'�'�"�"�3�'�C��M�M�<��T�7�SV�<�Y`�ad�Ye�Yj�Yj�?k�k�l��C�L����%���C�L����%��'	&�,�
��	p�C��s�|� � �1�$� '� 3� 3�E�#�g�c�l�>O�>O�:P�QR�:R�4S� T�
��m�U�3�$1�$8�$8��3�3�5�%7�M�%�1�1�'�#�,�2C�2C�D���k�5�1�"-�"4�"4��3�3�5�#7�K�
2C�;�PZ�[^�P_�an�1o�
�j��o�.�	p� �}���!��M�M�5��8W�A��Q��8W�W�X�)�$�}�/C�/C�/E�*F�G�G���s"���M�M�UY�[\�"]�^�����		*�	*��v9Xs@�X�W�X�
X�X
�	X�W=�7X�=X�X�X)NTr8)T)�)F)=rr
rr�r�r r|�propertyr�r�rlr�r�r�r�r�r�r�rar�r�r�r�r�rr�r�r�r�r�r�rryr	rrrrrr&r3r6r>rGrQr�rhr�r�r�rfrgr�r�r�r�r�r�r�r�r	rrrrFrF�s����I��M�%J�NB��	��	��6F�$�$���$��$��'��'������/��/�
1�!�
_�5�D�B�	 �5�
+�
0��>��<�$��+�
=�
/� t�F3�4�$'�T�� r�*	��T��T�l�8�$����6�"O�J�X��.�%��%�N��#�)�0�0^rrF�__main__)�DistUpgradeConfig)�DistUpgradeView�foo�.zubuntu-desktop)0rdr_r)r�r'rr-rNr�r`rv�
subprocessrr�DistUpgradeGettextrrr�utilsrr/r
rrrr4r�r�r�r6rArerFr�sys�DistUpgradeConfigParserr
rr��cr	�exitr�r�r�r�r�r�rrr�<module>rsD��,���
�	�	������"�,�(� �	�Y�	�	�.�	�	�N�	��I��& �B?�@���[�
B��
B� A�n�A�h�c�i�i�h�V#�z���:�0�	�%�L��!�#�&��(9�4�@�A�
�!�
�
�
���C�H�H�J��G�G�I���������N�N�$�%�&�	�!�-�-�/������!r
¿Qué es la limpieza dental de perros? - Clínica veterinaria


Es la eliminación del sarro y la placa adherida a la superficie de los dientes mediante un equipo de ultrasonidos que garantiza la integridad de las piezas dentales a la vez que elimina en profundidad cualquier resto de suciedad.

A continuación se procede al pulido de los dientes mediante una fresa especial que elimina la placa bacteriana y devuelve a los dientes el aspecto sano que deben tener.

Una vez terminado todo el proceso, se mantiene al perro en observación hasta que se despierta de la anestesia, bajo la atenta supervisión de un veterinario.

¿Cada cuánto tiempo tengo que hacerle una limpieza dental a mi perro?

A partir de cierta edad, los perros pueden necesitar una limpieza dental anual o bianual. Depende de cada caso. En líneas generales, puede decirse que los perros de razas pequeñas suelen acumular más sarro y suelen necesitar una atención mayor en cuanto a higiene dental.


Riesgos de una mala higiene


Los riesgos más evidentes de una mala higiene dental en los perros son los siguientes:

  • Cuando la acumulación de sarro no se trata, se puede producir una inflamación y retracción de las encías que puede descalzar el diente y provocar caídas.
  • Mal aliento (halitosis).
  • Sarro perros
  • Puede ir a más
  • Las bacterias de la placa pueden trasladarse a través del torrente circulatorio a órganos vitales como el corazón ocasionando problemas de endocarditis en las válvulas. Las bacterias pueden incluso acantonarse en huesos (La osteomielitis es la infección ósea, tanto cortical como medular) provocando mucho dolor y una artritis séptica).

¿Cómo se forma el sarro?

El sarro es la calcificación de la placa dental. Los restos de alimentos, junto con las bacterias presentes en la boca, van a formar la placa bacteriana o placa dental. Si la placa no se retira, al mezclarse con la saliva y los minerales presentes en ella, reaccionará formando una costra. La placa se calcifica y se forma el sarro.

El sarro, cuando se forma, es de color blanquecino pero a medida que pasa el tiempo se va poniendo amarillo y luego marrón.

Síntomas de una pobre higiene dental
La señal más obvia de una mala salud dental canina es el mal aliento.

Sin embargo, a veces no es tan fácil de detectar
Y hay perros que no se dejan abrir la boca por su dueño. Por ejemplo…

Recientemente nos trajeron a la clínica a un perro que parpadeaba de un ojo y decía su dueño que le picaba un lado de la cara. Tenía molestias y dificultad para comer, lo que había llevado a sus dueños a comprarle comida blanda (que suele ser un poco más cara y llevar más contenido en grasa) durante medio año. Después de una exploración oftalmológica, nos dimos cuenta de que el ojo tenía una úlcera en la córnea probablemente de rascarse . Además, el canto lateral del ojo estaba inflamado. Tenía lo que en humanos llamamos flemón pero como era un perro de pelo largo, no se le notaba a simple vista. Al abrirle la boca nos llamó la atención el ver una muela llena de sarro. Le realizamos una radiografía y encontramos una fístula que llegaba hasta la parte inferior del ojo.

Le tuvimos que extraer la muela. Tras esto, el ojo se curó completamente con unos colirios y una lentilla protectora de úlcera. Afortunadamente, la úlcera no profundizó y no perforó el ojo. Ahora el perro come perfectamente a pesar de haber perdido una muela.

¿Cómo mantener la higiene dental de tu perro?
Hay varias maneras de prevenir problemas derivados de la salud dental de tu perro.

Limpiezas de dientes en casa
Es recomendable limpiar los dientes de tu perro semanal o diariamente si se puede. Existe una gran variedad de productos que se pueden utilizar:

Pastas de dientes.
Cepillos de dientes o dedales para el dedo índice, que hacen más fácil la limpieza.
Colutorios para echar en agua de bebida o directamente sobre el diente en líquido o en spray.

En la Clínica Tus Veterinarios enseñamos a nuestros clientes a tomar el hábito de limpiar los dientes de sus perros desde que son cachorros. Esto responde a nuestro compromiso con la prevención de enfermedades caninas.

Hoy en día tenemos muchos clientes que limpian los dientes todos los días a su mascota, y como resultado, se ahorran el dinero de hacer limpiezas dentales profesionales y consiguen una mejor salud de su perro.


Limpiezas dentales profesionales de perros y gatos

Recomendamos hacer una limpieza dental especializada anualmente. La realizamos con un aparato de ultrasonidos que utiliza agua para quitar el sarro. Después, procedemos a pulir los dientes con un cepillo de alta velocidad y una pasta especial. Hacemos esto para proteger el esmalte.

La frecuencia de limpiezas dentales necesaria varía mucho entre razas. En general, las razas grandes tienen buena calidad de esmalte, por lo que no necesitan hacerlo tan a menudo e incluso pueden pasarse la vida sin requerir una limpieza. Sin embargo, razas pequeñas como el Yorkshire o el Maltés, deben hacérselas todos los años desde cachorros si se quiere conservar sus piezas dentales.

Otro factor fundamental es la calidad del pienso. Algunas marcas han diseñado croquetas que limpian la superficie del diente y de la muela al masticarse.

Ultrasonido para perros

¿Se necesita anestesia para las limpiezas dentales de perros y gatos?

La limpieza dental en perros no es una técnica que pueda practicarse sin anestesia general , aunque hay veces que los propietarios no quieren anestesiar y si tiene poco sarro y el perro es muy bueno se puede intentar…… , pero no se va a poder pulir ni acceder a todas la zona de la boca …. Además los limpiadores dentales van a irrigar agua y hay riesgo de aspiración a vías respiratorias si no se realiza una anestesia correcta con intubación traqueal . En resumen , sin anestesia no se va hacer una correcta limpieza dental.

Tampoco sirve la sedación ya que necesitamos que el animal esté totalmente quieto, y el veterinario tenga un acceso completo a todas sus piezas dentales y encías.

Alimentos para la limpieza dental

Hay que tener cierto cuidado a la hora de comprar determinados alimentos porque no todos son saludables. Algunos tienen demasiado contenido graso, que en exceso puede causar problemas cardiovasculares y obesidad.

Los mejores alimentos para los dientes son aquellos que están elaborados por empresas farmacéuticas y llevan componentes químicos con tratamientos específicos para el diente del perro. Esto implica no solo limpieza a través de la acción mecánica de morder sino también un tratamiento antibacteriano para prevenir el sarro.

Conclusión

Si eres como la mayoría de dueños, por falta de tiempo , es probable que no estés prestando la suficiente atención a la limpieza dental de tu perro. Por eso te animamos a que comiences a limpiar los dientes de tu perro y consideres atender a su higiene bucal con frecuencia.

Estas simples medidas pueden conllevar a que tu perro tenga una vida más larga y mucho más saludable.

Si te resulta imposible introducir un cepillo de dientes a tu perro en la boca, pásate con él por clínica Tus Veterinarios y te explicamos cómo hacerlo.

Necesitas hacer una limpieza dental profesional a tu mascota?
Llámanos al 622575274 o contacta con nosotros

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

¡Hola!