Current File : //usr/lib/python3/dist-packages/landscape/lib/apt/package/__pycache__/facade.cpython-312.pyc
�

��gޑ��f�ddlZddlZddlZddlZddlZddlZddlZddlmZddl	Z	ddl
Z
ddlZddlm
Z
ddlmZddlmZddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZGd�de�ZGd�de�Z Gd�de�Z!Gd�de�Z"Gd�de
�Z#Gd�d�Z$y)�N)�
attrgetter)�InstallProgress)�AcquireProgress)�SourcesList)�
itervalues���build_skeleton_apt)�StringIO)�append_text_file)�create_text_file)�read_binary_file)�read_text_file)�
touch_filec��eZdZdZy)�TransactionErrorz)Raised when the transaction fails to run.N��__name__�
__module__�__qualname__�__doc__���B/usr/lib/python3/dist-packages/landscape/lib/apt/package/facade.pyrrs��3rrc��eZdZdZd�Zd�Zy)�DependencyErrorz9Raised when a needed dependency wasn't explicitly marked.c��||_y�N)�packages)�selfrs  r�__init__zDependencyError.__init__"s	�� ��
rc
��djdj|jD�cgc]
}t|���c}��Scc}w)NzMissing dependencies: {}�, )�format�joinr�str�r �packages  r�__str__zDependencyError.__str__%s:��)�0�0��I�I�-1�]�]�;�'��W��;�
�
�	
��;s�AN)rrrrr!r)rrrrrs��C�!�
rrc��eZdZdZy)�ChannelErrorz"Raised when channels fail to load.Nrrrrr+r+-s��,rr+c��eZdZd�Zd�Zy)�LandscapeAcquireProgressc��y)aDOverride trying to get the column count of the buffer.

        We always send the output to a file, not to a terminal, so the
        default width (80 columns) is fine for us.

        Overriding this method means that we don't have to care about
        fcntl.ioctl API differences for different Python versions.
        Nr)r �dummys  r�_winchzLandscapeAcquireProgress._winch2s�rc��y)z�Override updating the acquire progress, which needs a tty.

        Under Python3, StringIO.fileno() raises UnsupportedOperation instead
        of an AttributeError. This would be uncaught by apt, thus we force a
        NOOP here.
        Tr)r �owners  r�pulsezLandscapeAcquireProgress.pulse<s��rN)rrrr0r3rrrr-r-1s���rr-c�6��eZdZdZdZ�fd�Z�fd�Zd�Z�xZS)�LandscapeInstallProgressNc�X��t�|��}tj|�|_|S)aOverride to find out whether dpkg exited or not.

        The C{run()} method returns os.WEXITSTATUS(res) without checking
        os.WIFEXITED(res) first, so it can signal that everything is ok,
        even though something causes dpkg not to exit cleanly.

        Save whether dpkg exited cleanly into the C{dpkg_exited}
        attribute. If dpkg exited cleanly the exit code can be used to
        determine whether there were any errors. If dpkg didn't exit
        cleanly it should mean that something went wrong.
        )�super�
wait_child�os�	WIFEXITED�dpkg_exited)r �res�	__class__s  �rr8z#LandscapeInstallProgress.wait_childKs(����g� �"���<�<��,����
rc���t�|��}|dk(r*tj|_|j
t_|S)z6Fork and override the excepthook in the child process.r)r7�fork�sys�
excepthook�old_excepthook�_prevent_dpkg_apport_error)r �pidr=s  �rr?zLandscapeInstallProgress.fork[s5����g�l�n���!�8�#&�.�.�D��!�<�<�C�N��
rc�j�|turtj|||�y|j|||�y)a�Prevent dpkg errors from generating Apport crash reports.

        When dpkg reports an error, a SystemError is raised and cleaned
        up in C code. However, it seems like the Apport except hook is
        called before the C code clears the error, generating crash
        reports even though nothing crashed.

        This exception hook doesn't call the Apport hook for
        SystemErrors, but it calls it for all other errors.
        N)�SystemErrorr@�__excepthook__rB)r �exc_type�exc_obj�exc_tbs    rrCz3LandscapeInstallProgress._prevent_dpkg_apport_errores3���{�"����x��&�9�����H�g�v�6r)	rrrr;rBr8r?rC�
__classcell__)r=s@rr5r5Fs����K��N�� �7rr5c��eZdZdZdZdZdZd?d�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd@d�Zd�Zed��Zd�Z		dAd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZdBd�Zd�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+�Z-d,�Z.d-�Z/d.�Z0d/�Z1d0�Z2d1�Z3d2�Z4d3�Z5d4�Z6d5�Z7d6�Z8d7�Z9d8�Z:d9�Z;d:�Z<d;�Z=d<�Z>d=�Z?d>�Z@y)C�	AptFacadeatWrapper for tasks using Apt.

    This object wraps Apt features, in a way that makes using and testing
    these features slightly more comfortable.

    @param root: The root dir of the Apt configuration files.
    @ivar refetch_package_index: Whether to refetch the package indexes
        when reloading the channels, or reuse the existing local
        database.
    ��z/var/lib/dpkg/statusNc��||_g|_|j�7|j�|jjd|jg�tj
j
|��|_d|_i|_	i|_
g|_t�|_
d|_g|_g|_g|_d|_y)Nz--root)�rootdirF)�_root�
_dpkg_args�_ensure_dir_structure�extend�apt�cache�Cache�_cache�_channels_loaded�	_pkg2hash�	_hash2pkg�_version_installs�set�_package_installs�_global_upgrade�_version_removals�_version_hold_creations�_version_hold_removals�refetch_package_index)r �roots  rr!zAptFacade.__init__�s�����
�����:�:�!��&�&�(��O�O�"�"�H�d�j�j�#9�:��i�i�o�o�d�o�3��� %���������!#���!$����$���!#���')��$�&(��#�%*��"rc��|jd�}|jd�|jd�|jd�|jd�}|jd�|jd�|jd�ttjj	|d	�d
�tjj	|d�|_tjj
|j
�st|j
d
�tjjtjj	|d��s*ttjj	|d
��yy)Nzetc/aptzetc/apt/sources.list.dzvar/cache/apt/archives/partialzvar/lib/apt/lists/partialzvar/lib/dpkgzvar/lib/dpkg/infozvar/lib/dpkg/updateszvar/lib/dpkg/triggers�	available��statusz
trusted.gpg.dztrusted.gpg)	�_ensure_sub_dirr
r9�pathr%�_dpkg_status�exists�isdirr)r �apt_dir�dpkg_dirs   rrTzAptFacade._ensure_dir_structure�s���&�&�y�1�����5�6����=�>����8�9��'�'��7�����0�1����3�4����4�5�������h��<�b�A��G�G�L�L��8�<����w�w�~�~�d�/�/�0��T�.�.��3��w�w�}�}�R�W�W�\�\�'�?�C�D��r�w�w�|�|�G�]�;�<�Erc���tjj|j|�}tjj	|�stj
|�|S)z)Ensure that a dir in the Apt root exists.)r9rkr%rRrm�makedirs)r �sub_dir�	full_paths   rrjzAptFacade._ensure_sub_dir�s<���G�G�L�L����W�5�	��w�w�~�~�i�(��K�K�	�"��rc�,�t|j�S)z/Get all the packages available in the channels.)rr\�r s r�get_packageszAptFacade.get_packages�s���$�.�.�)�)rc��|j�D�cgc]0}|j|�r|j|j�r|��2c}Scc}w)zqGet all packages in the channels that are locked.

        For Apt, it means all packages that are held.
        )rw�is_package_installed�_is_package_heldr(�r �versions  r�get_locked_packageszAptFacade.get_locked_packages�sM�� �,�,�.�
���)�)�'�2��)�)�'�/�/�:�	
�
�	
��
s�5Ac��t|j�D�cgc]}|jj��c}�Scc}w)z5Return the name of all the packages that are on hold.)�sortedr}r(�namer{s  r�get_package_holdszAptFacade.get_package_holds�s3���15�1I�1I�1K�L�g�W�_�_�
!�
!�L�
�	
��Ls�<c��tjddg|jztj��}|j	|jd��y)zfSet the dpkg selection.

        It basically does "echo $selection | dpkg --set-selections".
        �dpkgz--set-selections)�stdin�utf-8N)�
subprocess�PopenrS�PIPE�communicate�encode)r �	selection�processs   r�_set_dpkg_selectionszAptFacade._set_dpkg_selections�sH��
�"�"�
�'�(�4�?�?�:��/�/�
��
	���I�,�,�W�5�6rc�T�|j|jjdz�y)zdAdd a dpkg hold for a package.

        @param version: The version of the package to hold.
        z holdN)r�r(r�r{s  r�set_package_holdzAptFacade.set_package_hold�s!��
	
�!�!�'�/�/�"6�"6��"@�Arc��|j|�r|j|j�sy|j|jjdz�y)zjRemoves a dpkg hold for a package.

        @param version: The version of the package to unhold.
        Nz install)ryrzr(r�r�r{s  r�remove_package_holdzAptFacade.remove_package_hold�sH��
�(�(��1��9N�9N��O�O�:
�
��!�!�'�/�/�"6�"6��"C�Drc�~�|jjd�|j�}|js!|rmtj
j
|�rNi}|r|js||d<		|jjdi|��|jjd�|jj�|j j�|jD]f}|j#|�s�|j$D]C}|j'|d��j)�}||j||f<||j |<�E�hd|_y#t$r|jj�Y��wxYw#tjj$rtd|j��d���wxYw)	z�Reload the channels and update the cache.

        @param force_reload_binaries: Whether to always reload
            information about the binaries packages that are in the facade's
            internal repo.
        N�sources_listzApt failed to reload channels (�)F)�	with_infoTr)rY�open�_get_internal_sources_listrdr9rkrm�update�	TypeErrorrVrW�FetchFailedExceptionr+�get_channelsr[�clearr\�_is_main_architecture�versions�get_package_skeleton�get_hashrZ)r �force_reload_binaries�internal_sources_list�new_apt_argsr(r|�
skeleton_hashs       r�reload_channelszAptFacade.reload_channels�s���	
������� $� ?� ?� A���%�%�!�b�g�g�n�n�5J�&K�
�L�$�T�-G�-G�/D��^�,�
�)�&�D�K�K�&�&�6��6�
�K�K���T�"��������������{�{�	8�G��-�-�g�6��"�+�+�	
8�� $� 9� 9��#�!:�!��(�*��6C������1�2�07����}�-�	
8�	8�!%����/!�)��K�K�&�&�(�)���9�9�1�1�
�"�5�d�6G�6G�6I�5L�A�N���
�s$�0E�#E>�;F�=E>�>F�;F<c�>�|jry|j�y)z6Reload the channels if they haven't been reloaded yet.N)rZr�rvs r�ensure_channels_reloadedz"AptFacade.ensure_channels_reloadeds��� � �����rc�@�tjjd�S)NzDir::Etc::sourceparts)�apt_pkg�config�find_dirrvs r�_sourceparts_directoryz AptFacade._sourceparts_directorys���~�~�&�&�'>�?�?rc�V�tjj|jd�S)z@Return the path to the source.list file for the facade channels.z_landscape-internal-facade.list)r9rkr%r�rvs rr�z$AptFacade._get_internal_sources_list!s#���w�w�|�|��'�'�-�
�	
rc�b�|j�}d}|�|jd�r|rdnd}d|�d�}d|�|�d	|��}|r#|d
jd	j|��z
}tj
j
|�rt|�jd�}	||	vry|dz
}t||�y)a!Add a deb URL which points to a repository.

        @param url: The base URL of the repository.
        @param codename: The dist in the repository.
        @param components: The components to be included.
        @param trusted: Whether validation should be skipped (if local).
        rhNzfile:�yes�noz
[ trusted=z ] zdeb � z {}�
)
r��
startswithr$r%r9rkrmr�splitr)
r �url�codename�
components�trusted�sources_file_path�source_options�trusted_val�sources_line�current_contents
          r�add_channel_apt_debzAptFacade.add_channel_apt_deb(s���!�;�;�=������3�>�>�'�#:�#*�%��K�)�+��c�:�N��n�-�c�U�!�H�:�>����E�L�L����*�)=�>�>�L�
�7�7�>�>�+�,�,�->�?�E�E�d�K�O���.�������*�L�9rc�V�|j|�|jd|��ddd��y)z�Add a directory with packages as a channel.

        @param path: The path to the directory containing the packages.

        A Packages file is created in the directory with information
        about the deb files.
        zfile://z./NT)r�)�_create_packages_filer�)r rks  r�add_channel_deb_dirzAptFacade.add_channel_deb_dirEs2��	
�"�"�4�(�	
� � �7�4�&�!1�4��t� �Lrc��|j�}tjj|�rtj|�yy)z�Clear the channels that have been added through the facade.

        Channels that weren't added through the facade (i.e.
        /etc/apt/sources.list and /etc/apt/sources.list.d) won't be
        removed.
        N)r�r9rkrm�remove)r r�s  r�clear_channelszAptFacade.clear_channelsRs6��!�;�;�=��
�7�7�>�>�+�,��I�I�'�(�-rc�x�ttj|��}ttjj|d�dd�5}t
|�D]M\}}|dkDr|jd�tjj||�}|j||��O	ddd�y#1swYyxYw)z0Create a Packages file in a directory with debs.�Packages�wbr�
N)	rr9�listdirr�rkr%�	enumerate�write�write_package_stanza)r �deb_dirr�dest�i�filename�deb_files       rr�zAptFacade._create_packages_file]s����"�*�*�W�-�.��
�"�'�'�,�,�w�
�3�T�1�
=�	:��(��2�
:���8��q�5��J�J�u�%��7�7�<�<���:���)�)�(�D�9�	
:�	:�	:�	:�s
�
AB0�0B9c��t�}t|d�rd|_|j�|D�cgc]L}|js>|j
|jdj|j�|jd���Nc}Scc}w)z�Return a list of channels configured.

        A channel is a deb line in sources.list or sources.list.d. It's
        represented by a dict with baseurl, distribution, components,
        and type keys.
        �deb822Tr�)�baseurl�distributionr��type)
r�hasattrr��refresh�disabled�uri�distr%�compsr��r r��entrys   rr�zAptFacade.get_channelsgs{��#�}���<��*�"&�L��� � �"�&�	
���>�>�
!�9�9� %�
�
�!�h�h�u�{�{�3��
�
�	
�	
�		
��	
s�ABc��t�}t|d�rd|_|j�|D]}|j	d��|j�y)z#Remove all the configured channels.r�TFN)rr�r�r��set_enabled�saver�s   r�reset_channelszAptFacade.reset_channels~sP��"�}���<��*�"&�L��� � �"�!�	%�E����e�$�	%����rc��t|�}tj|�}|jj	d�}|j�tjj|�}tjj|�}t|�}tj|�j�}	tj|�j�}
tj|�j�}t!j"|�}d|fdt%|�fd|	fd|
fd|fg}
	|j'|t j(|
D��cgc]\}}t!j*||���c}}�ycc}}w#t,$rHt!j.|t j(|
�}|j'|j1d��YywxYw)	z�Write a stanza for the package to a Packages file.

        @param deb_path: The path to the deb package.
        @param dest: A writable package file.
        �control�Filename�Size�MD5sum�SHA1�SHA256r�N)r��apt_inst�DebFiler��extractdata�closer9rk�basename�getsizer�hashlib�md5�	hexdigest�sha1�sha256r��
TagSectionr&r��REWRITE_PACKAGE_ORDER�
TagRewrite�AttributeError�rewrite_sectionr�)r �deb_pathr�r��debr�r��size�contentsr�r�r��tag_section�new_tags�k�v�sections                 rr�zAptFacade.write_package_stanza�sz����>�����x�(���+�+�)�)�)�4�������7�7�#�#�H�-���w�w���x�(��#�H�-���k�k�(�#�-�-�/���|�|�H�%�/�/�1������)�3�3�5���(�(��1��
��"�
�S��Y��
�s�O�
�T�N�
�v��
��
	0������-�-�6>�?�d�a���#�#�A�q�)�?�
��@���	0��-�-���-�-���G�

�J�J�w�~�~�g�.�/�	0�s%�. E=� E7�.E=�7E=�=AG�
Gc�@�tjjd�S)z1Return the architecture APT is configured to use.�APT::Architecture)r�r��getrvs r�get_archzAptFacade.get_arch�s���~�~�!�!�"5�6�6rc��|�d}tjjd�tjjd|�tjjd|�}|jjd�|S)zkSet the architecture that APT should use.

        Setting multiple architectures isn't supported.
        NrhzAPT::ArchitectureszAPT::Architectures::r)r�r�r�r^rYr�)r �architecture�results   r�set_archzAptFacade.set_arch�si��
���L�
	�����1�2������1�<�@����#�#�$7��F��	
��������
rc��t||d��S)a�Return a skeleton for the provided package.

        The skeleton represents the basic structure of the package.

        @param pkg: Package to build skeleton from.
        @param with_info: If True, the skeleton will include information
            useful for sending data to the server.  Such information isn't
            necessary if the skeleton will be used to build a hash.

        @return: a L{PackageSkeleton} object.
        T)r��with_unicoder	)r �pkgr�s   rr�zAptFacade.get_package_skeleton�s��"�#���N�Nrc�P�|jj|j|f�S)ziReturn a hash from the given package.

        @param version: an L{apt.package.Version} object.
        )r[rr(r{s  r�get_package_hashzAptFacade.get_package_hash�s"��
�~�~�!�!�7�?�?�G�"<�=�=rc�6�|jj�S)z=Get the hashes of all the packages available in the channels.)r[�valuesrvs r�get_package_hasheszAptFacade.get_package_hashes�s���~�~�$�$�&�&rc�8�|jj|�S)z�Get the package having the provided hash.

        @param hash: The hash the package should have.

        @return: The L{apt.package.Package} that has the given hash.
        )r\r)r �hashs  r�get_package_by_hashzAptFacade.get_package_by_hash�s���~�~�!�!�$�'�'rc�4�||jjk(S)z!Is the package version installed?)r(�	installedr{s  rryzAptFacade.is_package_installed�s���'�/�/�3�3�3�3rc��|jS)z*Is the package available for installation?)�downloadabler{s  r�is_package_availablezAptFacade.is_package_available�s���#�#�#rc��|jjr|jjsy||jjkDS)z8Is the package an upgrade for another installed package?F)r(�
is_upgradablerr{s  r�is_package_upgradezAptFacade.is_package_upgrade�s3�����,�,�G�O�O�4M�4M������2�2�2�2rc�.�|jjS)z;Was the package auto-installed, but isn't required anymore?)r(�is_auto_removabler{s  r�is_package_autoremovablez"AptFacade.is_package_autoremovable�s�����0�0�0rc�N�t|d�sy|j|jk(S)z2Is the package for the facade's main architecture?�	shortnameT)r�r�r"r's  rr�zAptFacade._is_main_architecture�s&���w��,���|�|�w�0�0�0�0rc�P�|jjtjk(S)zIs the package marked as held?)�_pkg�selected_stater��
SELSTATE_HOLDr's  rrzzAptFacade._is_package_helds���|�|�*�*�g�.C�.C�C�Crc�z�|j�D�cgc]}|jj|k(r|��c}Scc}w)z�Get all available packages matching the provided name.

        @param name: The name the returned packages should have.
        )rwr(r�)r r�r|s   r�get_packages_by_namezAptFacade.get_packages_by_name	s?�� �,�,�.�
�����#�#�t�+�
�
�	
��
s�"8c��|jry|js&|js|js||jvSy)a]Is the package broken?

        It's considered broken if it's one that we marked for install,
        but it's not marked for install, upgrade or downgrade
        anymore.

        Before Trusty, checking is_inst_broken was enough, but
        in Trusty the behaviour changed, so the package simply gets
        unmarked for installation.
        TF)�is_inst_broken�marked_install�marked_upgrade�marked_downgrader_r's  r�_is_package_brokenzAptFacade._is_package_brokens?���!�!���&�&��*�*��,�,��d�4�4�4�4�rc��|j�D�chc])}|j|j�r|j��+c}Scc}w)z/Return the packages that are in a broken state.)rwr.r(r{s  r�_get_broken_packageszAptFacade._get_broken_packages)sC�� �,�,�.�
���&�&�w���7�
�O�O�
�	
��
s�.Ac���|jr
|jgS|js|jr|j|jgS|j
r
|jgSy)a]Return the versions that will be changed for the package.

        Apt gives us that a package is going to be changed and have
        variables set on the package to indicate what will change. We
        need to convert that into a list of versions that will be either
        installed or removed, which is what the server expects to get.
        N)r+�	candidater,r-r�
marked_deleter's  r�_get_changed_versionszAptFacade._get_changed_versions1s_���!�!��%�%�&�&��!�!�W�%=�%=��%�%�w�'8�'8�9�9�� � ��%�%�&�&�rc���|D�cgc]}|j|f��}}t�}|jj�D]?�|j	��s�|j��}|j
�fd�|D���A|j|�}|rt|D��cgc]\}}|��	c}}��t|�dkDScc}wcc}}w)aCheck that the changes Apt will do have all been requested.

        @raises DependencyError: If some change hasn't been explicitly
            requested.
        @return: C{True} if all the changes that Apt will perform have
            been requested.
        c3�&�K�|]}�|f���
y�wrr)�.0r|r(s  �r�	<genexpr>z+AptFacade._check_changes.<locals>.<genexpr>Ts�����*�'.��'�"�*�s�r)
r(r^rY�get_changesr�r4r��
differencer�len)r �requested_changesr|�all_changes�versions_to_be_changedr��dependenciesr(s       `r�_check_changeszAptFacade._check_changesAs����7H�
�+2�W�_�_�g�&�
��
�"%����{�{�.�.�0�	�G��-�-�g�6���1�1�'�:�H�"�)�)�*�2:�*�
�		�.�8�8��E���!�1=�>�-�W�g��>��
��)�*�Q�.�.��!
��?s�C� C
c��|jj}|jr)|dj|j|j�z
}d}|jj|j
vr�|j
|jj}|js|jrN|jj}||j
j�vr|jj}d|�d�}||z
}|S)zAReturn a string representation of a specific dependency relation.z ({} {})z but is not installablez but z is to be installed)�
target_pkgr��
target_verr$�	comp_typerYrr+r2r|r9)r �dep_relation�info�reason�dep_packager|s      r�_get_unmet_relation_infoz"AptFacade._get_unmet_relation_info^s����&�&�+�+���"�"��J�%�%��&�&��'�'��
�D�+���"�"�'�'�4�;�;�6��+�+�l�&=�&=�&B�&B�C�K��$�$��(B�(B�%�/�/�7�7���d�k�k�&=�&=�&?�?�)�3�3�;�;�G� ��	�)<�=�������rc��|dv}|jj}|D]i}|j�D]T}|j}|jt
jk(s|j|�s�>|j|�r�P|ccS�k|S)a+Return whether a dependency is satisfied.

        For positive dependencies (Pre-Depends, Depends) it means that
        one of its targets is going to be installed. For negative
        dependencies (Conflicts, Breaks), it means that none of its
        targets are going to be installed.
        )�Breaks�	Conflicts)	rY�	_depcache�all_targets�
parent_pkg�
current_stater��CURSTATE_INSTALLEDr+r3)r �
dependency�dep_type�is_positive�depcache�or_dep�targetr(s        r�_is_dependency_satisfiedz"AptFacade._is_dependency_satisfiedqs����&=�=���;�;�(�(�� �	'�F� �,�,�.�
'�� �+�+���)�)�W�-G�-G�G��.�.�w�7�"�0�0��9�&�&�
'�	'���rc	���|j�}|sydg}t|td���D�]�d}t�fd�|jD��}dD]�}|j
j
|g�}|D]�}|j||�r�g}|D]"}	|j|j|	���$d�j�d	|�d	�}
d
dt|
�zz}|j|
|j|�z�d}����|r��|jd
j�jd����dj|�S)aGet information about unmet dependencies in the cache state.

        Go through all the broken packages and say which dependencies
        haven't been satisfied.

        @return: A string with dependency information like what you get
            from apt-get.
        rhz/The following packages have unmet dependencies:r�)�keyFc3�V�K�|] }|j�k(s�|j���"y�wr)r(�_cand)r7rr(s  �rr8z7AptFacade._get_unmet_dependency_info.<locals>.<genexpr>�s%�������1�9�9��;O�����s�)�))�
PreDepends�DependsrLrKz  z: z or
r�Tz  {}: {}zUnknown dependency errorr�)r0rr�nextr]�depends_listrrX�appendrIr�r;r%r$)
r �broken_packages�all_info�found_dependency_errorr2rSr?rR�relation_infosrErF�
or_dividerr(s
            @r�_get_unmet_dependency_infoz$AptFacade._get_unmet_dependency_info�sc����3�3�5����E�F���o�:�f�3E�F�	�G�%*�"���!%�!7�!7���I�M�

2��(�5�5�9�9�(�B�G��".�2�J��4�4�Z��J� �%'�N�(2���&�-�-� �9�9�,�G��� ����~�R��z��<�D�!(�3��T��?�!:�J��O�O�D�:�?�?�>�+J�$J�K�-1�*�2�

2�*�����%�%����2���-	�8�y�y��"�"rc�v�dtjd<dtjd<dtjd<y)zW
        Set the environment to avoid attempts by apt to interact with a user.
        �noninteractive�DEBIAN_FRONTEND�none�APT_LISTCHANGES_FRONTEND�APT_LISTBUGS_FRONTENDN)r9�environrvs r�_set_frontend_noninteractivez&AptFacade._set_frontend_noninteractive�s1��)9��
�
�$�%�17��
�
�-�.�.4��
�
�*�+rc��|j�tjjd�tjj	dd�y)zV
        Setup environment and apt options for successful package operations.
        z
DPkg::optionszDPkg::options::z--force-confoldN)ror�r�r�r^rvs r�_setup_dpkg_for_changesz!AptFacade._setup_dpkg_for_changes�s8��	
�)�)�+������_�-������,�.?�@rc��t|j�dkDxst|j�dkD}|sy|jD�cgc]}|j|�s|��}}|rWt	ddjdj
t|�D�cgc]}|jj��c}��z��|jD]}|j|��|jD]}|j|��ycc}wcc}w)z>
        Perform pending hold operations on packages.
        rNz0Cannot perform the changes, since the following zpackages are not installed: {}r#z#Package holds successfully changed.)r;rbrcryrr$r%rr(r�r�r�)r �hold_changesr|�
not_installeds    r�_perform_hold_changeszAptFacade._perform_hold_changes�s#��

��,�,�-��1�
4��4�.�.�/�!�3�	��� �7�7�
���,�,�W�5�
�
�
�
�
�"�B�2�9�9��I�I�,2�-�+@�� '�$�O�O�0�0�����
�

��3�3�	+�G��!�!�'�*�	+��2�2�	.�G��$�$�W�-�	.�5��1
��s�C>�Dc�$�t�}tj�\}}tjd�}tjd�}tj
|d�tj
|d�t
�}	d}||jkr�d}|dkDrFtj|j�tjd|j|z
d�d��|dz
}	|jjt|�|��|j st#d	��	|j%�t'|�z}		�|�	tj
|d�tj
|d�tj2|�	S#t"$rD}
|j%�t'|�z}	t)|
j*dd
z|	z�}Yd}
~
��d}
~
wt,j.j0$rD}|j%�t'|�z}	t)|j*dd
z|	z�}Yd}~nd}~wwxYw||jkr�����
#tj
|d�tj
|d�tj2|�wxYw)zd
        Commit cached APT operations and give feedback on the results as a
        string.
        r�rNz8dpkg process might be in use. Retrying package changes. �dz retries remaining.)�fetch_progress�install_progresszdpkg didn't exit cleanly.z

Package operation log:
)r�tempfile�mkstempr9�dup�dup2r5�max_dpkg_retries�time�sleep�dpkg_retry_sleep�logging�warningrY�commitr-r;rF�getvaluerr�argsrVrW�LockFailedExceptionr�)r �fetch_output�fd�install_output_path�
old_stdout�
old_stderrrz�
dpkg_tries�error�result_text�exc�	exceptions            r�_commit_package_changesz!AptFacade._commit_package_changes�sm�� �z��#+�"2�"2�"4�����V�V�A�Y�
��V�V�A�Y�
�
����A��
����A��3�5��9	+��J��� 5� 5�5�����>��J�J�t�4�4�5��O�O�5��0�0�:�=�a�@�A-�-���a��
� ��K�K�&�&�'?��'M�)9�'��,�7�7�)�*E�F�F�8�0#/�"7�"7�"9�N�+�=�#�K��� ���!�
�G�G�J��"��G�G�J��"��I�I�)�*����E#��".�"7�"7�"9�N�+�=�#�K�-������8�9�%�&��E����y�y�4�4��".�"7�"7�"9�N�+�=�#�K�-�!���q�)�8�9�%�&��E��	��C�� 5� 5�5��f
�G�G�J��"��G�G�J��"��I�I�)�*�sJ�A#I�'=F
�%!I�
	H6�:G�
I� H6�2:H1�,I�1H6�6I�AJc���|jD]�}||jjk(r�||j_|jjxs|jj}|jjd|��|jj|j�|j|jj�|j|jj���y)NF)�auto_fix�	from_user)r]r(rr2�is_auto_installed�mark_installr_�addr�r$�protect)r �fixerr|�	is_manuals    r�_preprocess_installszAptFacade._preprocess_installs5s����-�-�	0�G��'�/�/�3�3�3��)0�G�O�O�%��O�O�-�-�-�9����8�8�8�
�
�O�O�(�(�%�9�(�M��"�"�&�&�w���7��K�K����,�,�-��M�M�'�/�/�.�.�/�/	0rc	�T�t�}|jD�chc]}|j��}}|jD�chc]}|j|vr|j��}}|jD]�}|j	|j�r%|j|jj�|j|vr�R|jjd��|j|jj�|j|jj�|j|jj�	|j���|r2tdjdj!t#|�����ycc}wcc}w#t$rY��;wxYw)NF)r�zDCan't perform the changes, since the following packages are held: {}r#)r^r]r(rarzr�r��mark_deleter�r$r�r��install_protectr�rr$r%r)r r��held_package_namesr|�package_installs�package_upgradess      r�_preprocess_removeszAptFacade._preprocess_removesOsx�� �U��,0�+A�+A�
� '�G�O�O�
��
� �1�1�
�����"2�2�
�O�O�
��
��-�-�	�G��$�$�W�_�_�5�"�&�&�w���';�';�<����"2�2���O�O�'�'��'�7�
�K�K����,�,�-��M�M�'�/�/�.�.�/��L�L����-�-�.�
��%�%�'�!	�(�"��%�v�d�i�i��7I�0J�&K�L��
���=
��
��."�
��
�s�F�!F�	F�	F'�&F'c�V�|jr|jjd��yy)NT)�dist_upgrade)r`rY�upgradervs r�_preprocess_global_upgradez$AptFacade._preprocess_global_upgradevs%������K�K���T��2� rc�*�|j�}||k7rA	|jd�|j�}||k7rt|j���yy#t$r1}t|j
ddz|j�z��d}~wwxYw)zQ
        Attempt to automatically resolve problems with broken packages.
        Trr�N)r0�resolverrgrFr�)r r��already_broken_packages�now_broken_packagesr�s     r�_resolve_broken_packagesz"AptFacade._resolve_broken_packageszs���#�7�7�9���"9�9�	
N��
�
�d�#�'+�&?�&?�&A�#�&�*A�A�*�4�+J�+J�+L�M�M�B�:���
�&��J�J�q�M�D�(�4�+J�+J�+L�L����
�s�A�	B�!,B
�
Bc�t�|jdd}|j|j�|s|jsgS|j	�}tj|jj�}|j|�|j�|j|�|j||�|Sr)
r]rUrar`r0r��ProblemResolverrYrMr�r�r�r�)r �version_changesr�r�s    r�_preprocess_package_changesz%AptFacade._preprocess_package_changes�s����0�0��3�����t�5�5�6��t�';�';��I�"&�";�";�"=���'�'����(=�(=�>���!�!�%�(��'�'�)�� � ��'��%�%�e�-D�E��rc�f�|j�}|j|�sy|j�S)zD
        Perform pending install/remove/upgrade operations.
        N)r�r@r�)r r�s  r�_perform_package_changesz"AptFacade._perform_package_changes�s2���:�:�<���"�"�?�3���+�+�-�-rc���|j�|j�}|j�}g}|�|j|�|�|j|�t	|�dkDrdj|�Sy)z9
        Perform the pending package operations.
        Nrr�)rqrur�rar;r%)r �hold_result_text�package_result_text�resultss    r�perform_changeszAptFacade.perform_changes�sy��	
�$�$�&��5�5�7��"�;�;�=�����*��N�N�.�/��'��N�N�+�,��w�<�!���8�8�G�$�$�rc���|jdd�=|jj�|jdd�=|jdd�=|j
dd�=d|_|jj�y)z%Clear the pending package operations.NF)r]r_r�rarcrbr`rYrvs r�reset_markszAptFacade.reset_marks�sd���"�"�1�%����$�$�&��"�"�1�%��'�'��*��(�(��+�$��������rc�:�|jj|�y)z"Mark the package for installation.N)r]rar{s  rr�zAptFacade.mark_install�������%�%�g�.rc��d|_y)zUpgrade all installed packages.TN)r`rvs r�mark_global_upgradezAptFacade.mark_global_upgrade�s
��#��rc�:�|jj|�y)zMark the package for removal.N)rarar{s  r�mark_removezAptFacade.mark_remove�r�rc�:�|jj|�y)zMark the package to be held.N)rbrar{s  r�	mark_holdzAptFacade.mark_hold�s���$�$�+�+�G�4rc�:�|jj|�y)z*Mark the package to have its hold removed.N)rcrar{s  r�mark_remove_holdzAptFacade.mark_remove_hold�s���#�#�*�*�7�3rr)F)NN)T)Arrrrrr�rlr!rTrjrwr}r�r�r�r�r�r��propertyr�r�r�r�r�r�r�r�r�rr
r�rrrryrrr r�rzr(r.r0r4r@rIrXrgrorqrur�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrMrMvs^��	�����)�L�+�(=�$�*�
�
�
7�B�	E�,%�\��@��@�
���:�:M�	)�:�
�.	�%0�N7��&O�>�'�(�4�$�3�1�1�D�	
��*
�� /�:�&�**#�X5�A�"5�HM�^0�4%�N3�N�"�.�
%��/�$�/�5�4rrM)%r�r�r9r�r@r{r��operatorrrVr�r��apt.progress.baser�apt.progress.textr�aptsources.sourceslistr�twisted.python.compatr�skeletonr
�landscape.lib.compatr�landscape.lib.fsrr
rrr�	Exceptionrrr+r-r5rMrrr�<module>r�s�����	��
����
���-�-�.�,�(�)�-�-�-�+�'�4�y�4�
�i�
�-�9�-����*-7��-7�`V
4�V
4r
¿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!