Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/landscape/lib/apt/package/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/landscape/lib/apt/package/__pycache__/facade.cpython-310.pyc
o

���c*��@s8ddlmZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlZddlZddl
Z
ddlmZddlmZddlmZddlmZddlmZdd	lmZmZdd
lmZmZmZddlmZGd
d�de �Z!Gdd�de �Z"Gdd�de �Z#Gdd�de�Z$Gdd�de�Z%Gdd�de&�Z'dS)�)�absolute_importN)�
attrgetter��SourcesList)�AcquireProgress)�InstallProgress)�
itervalues)�StringIO)�append_text_file�create_text_file)�read_text_file�read_binary_file�
touch_file���build_skeleton_aptc@�eZdZdZdS)�TransactionErrorz)Raised when the transaction fails to run.N��__name__�
__module__�__qualname__�__doc__�rr�B/usr/lib/python3/dist-packages/landscape/lib/apt/package/facade.pyr�rc@s eZdZdZdd�Zdd�ZdS)�DependencyErrorz9Raised when a needed dependency wasn't explicitly marked.cCs
||_dS�N)�packages)�selfrrrr�__init__$s
zDependencyError.__init__cCsdd�dd�|jD��S)NzMissing dependencies: %s�, cSsg|]}t|��qSr)�str)�.0�packagerrr�
<listcomp>)�z+DependencyError.__str__.<locals>.<listcomp>)�joinr�rrrr�__str__'s�zDependencyError.__str__N)rrrrr r)rrrrr!src@r)�ChannelErrorz"Raised when channels fail to load.Nrrrrrr*,rr*c@seZdZdd�Zdd�ZdS)�LandscapeAcquireProgresscG�dS)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�dummyrrr�_winch2szLandscapeAcquireProgress._winchcCr,)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�ownerrrr�pulse<szLandscapeAcquireProgress.pulseN)rrrr.r0rrrrr+0s
r+cs8eZdZdZdZ�fdd�Z�fdd�Zdd�Z�ZS)�LandscapeInstallProgressNcstt|���}t�|�|_|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.
        )�superr1�
wait_child�os�	WIFEXITED�dpkg_exited)r�res��	__class__rrr3Ksz#LandscapeInstallProgress.wait_childcs*tt|���}|dkrtj|_|jt_|S)z6Fork and override the excepthook in the child process.r)r2r1�fork�sys�
excepthook�old_excepthook�_prevent_dpkg_apport_error)r�pidr8rrr:[s
zLandscapeInstallProgress.forkcCs,|tur
t�|||�dS|�|||�dS)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__r=)r�exc_type�exc_obj�exc_tbrrrr>esz3LandscapeInstallProgress._prevent_dpkg_apport_error)	rrrr6r=r3r:r>�
__classcell__rrr8rr1Fs
r1c@s�eZdZdZdZdZdZdxdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdydd�Zdd�Zdd�Z		dzdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd{d2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Z d<d=�Z!d>d?�Z"d@dA�Z#dBdC�Z$dDdE�Z%dFdG�Z&dHdI�Z'dJdK�Z(dLdM�Z)dNdO�Z*dPdQ�Z+dRdS�Z,dTdU�Z-dVdW�Z.dXdY�Z/dZd[�Z0d\d]�Z1d^d_�Z2d`da�Z3dbdc�Z4ddde�Z5dfdg�Z6dhdi�Z7djdk�Z8dldm�Z9dndo�Z:dpdq�Z;drds�Z<dtdu�Z=dvdw�Z>dS)|�	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/statusNcCs�||_g|_|jdur|��|j�d|jg�tjj|d�|_d|_i|_	i|_
g|_t�|_
d|_g|_g|_g|_d|_dS)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�rootrrrr �s 

zAptFacade.__init__cCs�|�d�}|�d�|�d�|�d�|�d�}|�d�|�d�|�d�ttj�|d	�d
�tj�|d�|_tj�|j�sGt|jd
�tj�tj�|d��s]ttj�|d
��dSdS)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_dirrr4�pathr'�_dpkg_status�exists�isdirr)r�apt_dir�dpkg_dirrrrrL�s







�zAptFacade._ensure_dir_structurecCs*tj�|j|�}tj�|�st�|�|S)z)Ensure that a dir in the Apt root exists.)r4rbr'rJrd�makedirs)r�sub_dir�	full_pathrrrra�s
zAptFacade._ensure_sub_dircCs
t|j�S)z/Get all the packages available in the channels.)rrTr(rrr�get_packages��
zAptFacade.get_packagescs�fdd����D�S)zqGet all packages in the channels that are locked.

        For Apt, it means all packages that are held.
        cs&g|]}��|�r��|j�r|�qSr)�is_package_installed�_is_package_heldr$�r#�versionr(rrr%�s�
��z1AptFacade.get_locked_packages.<locals>.<listcomp>�rkr(rr(r�get_locked_packages��
�zAptFacade.get_locked_packagescCstdd�|��D��S)z5Return the name of all the packages that are on hold.cS�g|]}|jj�qSr�r$�namerorrrr%���z/AptFacade.get_package_holds.<locals>.<listcomp>)�sortedrrr(rrr�get_package_holds�s�zAptFacade.get_package_holdscCs.tjddg|jtjd�}|�|�d��dS)zfSet the dpkg selection.

        It basically does "echo $selection | dpkg --set-selections".
        �dpkgz--set-selections)�stdin�utf-8N)�
subprocess�PopenrK�PIPE�communicate�encode)r�	selection�processrrr�_set_dpkg_selections�s
�zAptFacade._set_dpkg_selectionscCs|�|jjd�dS)zdAdd a dpkg hold for a package.

        @param version: The version of the package to hold.
        z holdN)r�r$rv�rrprrr�set_package_hold�szAptFacade.set_package_holdcCs0|�|�r|�|j�s
dS|�|jjd�dS)zjRemoves a dpkg hold for a package.

        @param version: The version of the package to unhold.
        Nz install)rmrnr$r�rvr�rrr�remove_package_hold�s


�zAptFacade.remove_package_holdFcCs|j�d�|��}|js|rTtj�|�rTi}|r |js ||d<zz|jjdi|��Wnty:|j��YnwWnt	j
jyMtd|�
���w|j�d�|j��|j��|jD]#}|�|�siqa|jD]}|j|dd���}||j||f<||j|<qlqad|_dS)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_listz"Apt failed to reload channels (%r)F)�	with_infoTr)rQ�open�_get_internal_sources_listr\r4rbrd�update�	TypeErrorrNrO�FetchFailedExceptionr*�get_channelsrS�clearrT�_is_main_architecture�versions�get_package_skeleton�get_hashrR)r�force_reload_binaries�internal_sources_list�new_apt_argsr$rp�hashrrr�reload_channels�sP�
�
�����




���
zAptFacade.reload_channelscCs|jrdS|��dS)z6Reload the channels if they haven't been reloaded yet.N)rRr�r(rrr�ensure_channels_reloadedsz"AptFacade.ensure_channels_reloadedcCstj�d�}tj�|d�S)z@Return the path to the source.list file for the facade channels.zDir::Etc::sourcepartsz_landscape-internal-facade.list)�apt_pkg�config�find_dirr4rbr')r�sources_dirrrrr�sz$AptFacade._get_internal_sources_listc
Cs�|��}d}|dur|�d�r|rdnd}d�|�}d�|||�}|r,|dd	�|�7}tj�|�r?t|��d
�}	||	vr?dS|d
7}t	||�dS)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).
        r_Nzfile:�yes�noz[ trusted={} ] zdeb {}{} {}z %s� �
)
r��
startswith�formatr'r4rbrdr�splitr
)
r�url�codename�
components�trusted�sources_file_path�source_options�trusted_val�sources_line�current_contentrrr�add_channel_apt_debs	
zAptFacade.add_channel_apt_debcCs$|�|�|jd|dddd�dS)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.
        z	file://%sz./NT)r�)�_create_packages_filer�)rrbrrr�add_channel_deb_dir2s
zAptFacade.add_channel_deb_dircCs&|��}tj�|�rt�|�dSdS)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�r4rbrd�remove)rr�rrr�clear_channels?s�zAptFacade.clear_channelscCs�tt�|��}ttj�|d�dd��(}t|�D]\}}|dkr$|�d�tj�||�}|�||�qWd�dS1s=wYdS)z0Create a Packages file in a directory with debs.�Packages�wbr�
N)	rxr4�listdirr�rbr'�	enumerate�write�write_package_stanza)r�deb_dirr�dest�i�filename�deb_filerrrr�Js
�"�zAptFacade._create_packages_filecCst�}dd�|D�S)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.
        cSs.g|]}|js|j|jd�|j�|jd��qS)r�)�baseurl�distributionr��type)�disabled�uri�distr'�compsr�)r#�entryrrrr%\s

�
�z*AptFacade.get_channels.<locals>.<listcomp>r)rr�rrrr�Ts�zAptFacade.get_channelscCs&t�}|D]}|�d�q|��dS)z#Remove all the configured channels.FN)r�set_enabled�save)rr�r�rrr�reset_channels`szAptFacade.reset_channelscCs�t|�}t�|�}|j�d�}|��tj�|�}tj�	|�}t
|�}t�|��
�}	t�|��
�}
t�|��
�}t�|�}d|fdt|�fd|	fd|
fd|fg}
z|�|tjdd�|
D��Wd
Styzt�|tj|
�}|�|�d	��Yd
Sw)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�SHA256cSsg|]
\}}t�||��qSr)r��
TagRewrite)r#�k�vrrrr%~sz2AptFacade.write_package_stanza.<locals>.<listcomp>r|N)r��apt_inst�DebFiler��extractdata�closer4rb�basename�getsizer
�hashlib�md5�	hexdigest�sha1�sha256r��
TagSectionr"r��REWRITE_PACKAGE_ORDER�AttributeError�rewrite_sectionr�)r�deb_pathr�r��debr�r��size�contentsr�r�r��tag_section�new_tags�sectionrrrr�gs4

�
���zAptFacade.write_package_stanzacCstj�d�S)z1Return the architecture APT is configured to use.�APT::Architecture)r�r��getr(rrr�get_arch��zAptFacade.get_archcCsD|durd}tj�d�tj�d|�tj�d|�}|j�d�|S)zkSet the architecture that APT should use.

        Setting multiple architectures isn't supported.
        Nr_zAPT::ArchitectureszAPT::Architectures::r�)r�r�r�rVrQr�)r�architecture�resultrrr�set_arch�szAptFacade.set_archTcCst||dd�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�rrrr��szAptFacade.get_package_skeletoncCs|j�|j|f�S)ziReturn a hash from the given package.

        @param version: an L{apt.package.Version} object.
        )rSr�r$r�rrr�get_package_hash�szAptFacade.get_package_hashcCs
|j��S)z=Get the hashes of all the packages available in the channels.)rS�valuesr(rrr�get_package_hashes�rlzAptFacade.get_package_hashescCs|j�|�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.
        )rTr�)rr�rrr�get_package_by_hash�szAptFacade.get_package_by_hashcCs||jjkS)z!Is the package version installed?)r$�	installedr�rrrrm�r�zAptFacade.is_package_installedcCs|jS)z*Is the package available for installation?)�downloadabler�rrr�is_package_available�szAptFacade.is_package_availablecCs |jjr|jjs
dS||jjkS)z8Is the package an upgrade for another installed package?F)r$�
is_upgradabler�r�rrr�is_package_upgrade�szAptFacade.is_package_upgradecCs|jjS)z;Was the package auto-installed, but isn't required anymore?)r$�is_auto_removabler�rrr�is_package_autoremovable�sz"AptFacade.is_package_autoremovablecCst|d�sdS|j|jkS)z2Is the package for the facade's main architecture?�	shortnameT)�hasattrrvr��rr$rrrr��s
zAptFacade._is_main_architecturecCs|jjtjkS)zIs the package marked as held?)�_pkg�selected_stater��
SELSTATE_HOLDrrrrrn�szAptFacade._is_package_heldcs�fdd�|��D�S)z�Get all available packages matching the provided name.

        @param name: The name the returned packages should have.
        csg|]
}|jj�kr|�qSrruro�rvrrr%�s
�z2AptFacade.get_packages_by_name.<locals>.<listcomp>rq)rrvrrr�get_packages_by_name�rszAptFacade.get_packages_by_namecCs*|jrdS|js|js|js||jvSdS)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_downgraderWrrrr�_is_package_broken�s��
zAptFacade._is_package_brokencst�fdd����D��S)z/Return the packages that are in a broken state.c3s"�|]}��|j�r|jVqdSr)r
r$ror(rr�	<genexpr>�s�
�
�z1AptFacade._get_broken_packages.<locals>.<genexpr>)rVrkr(rr(r�_get_broken_packages�s�zAptFacade._get_broken_packagescCs8|jr|jgS|js
|jr|j|jgS|jr|jgSdS)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�	candidaterr	r��
marked_deleterrrr�_get_changed_versionsszAptFacade._get_changed_versionscs~dd�|D�}t�}|j��D]�|���sq|���}|��fdd�|D��q|�|�}|r9tdd�|D���t|�dkS)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.
        cSsg|]}|j|f�qSr�r$rorrrr%s
�z,AptFacade._check_changes.<locals>.<listcomp>c3s�|]}�|fVqdSrrrorrrr#s�
�z+AptFacade._check_changes.<locals>.<genexpr>cSsg|]\}}|�qSrr)r#r$rprrrr%(r&r)	rVrQ�get_changesr�rr��
differencer�len)r�requested_changes�all_changes�versions_to_be_changedr��dependenciesrrr�_check_changess"�


�
�zAptFacade._check_changescCs�|jj}|jr|d|j|jf7}d}|jj|jvr:|j|jj}|js'|jr:|jj}||j�	�vr6|jj}d|}||7}|S)zAReturn a string representation of a specific dependency relation.z (%s %s)z but is not installablez but %s is to be installed)
�
target_pkgrv�
target_ver�	comp_typerQr�rr
rpr)r�dep_relation�info�reason�dep_packagerprrr�_get_unmet_relation_info+s�z"AptFacade._get_unmet_relation_infocCs`|dv}|jj}|D]"}|��D]}|j}|jtjks |�|�r+|�|�s+|Sqq
|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)	rQ�	_depcache�all_targets�
parent_pkg�
current_stater��CURSTATE_INSTALLEDrr)r�
dependency�dep_type�is_positive�depcache�or_dep�targetr$rrr�_is_dependency_satisfied<s����z"AptFacade._is_dependency_satisfiedc	s�|��}|sdSdg}t|td�d�D]^�d}t�fdd�|jD��}dD]?}|j�|g�}|D]3}|�||�r9q0g}|D]
}	|�|�	|	��q=d	�j
|f}
d
dt|
�}|�|
|�|��d}q0q%|sq|�d
�j
df�qd�|�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.
        r_z/The following packages have unmet dependencies:rv)�keyFc3s �|]}|j�kr|jVqdSr)r$�_cand)r#r�rrrrcs�
��z7AptFacade._get_unmet_dependency_info.<locals>.<genexpr>)�
PreDepends�Dependsr"r!z
  %s: %s: z or
r�Tz  %s: %szUnknown dependency errorr�)
rrxr�nextrU�depends_listr�r.�appendr rvrr')r�broken_packages�all_info�found_dependency_errorr
r)rr(�relation_infosrr�
or_dividerrrr�_get_unmet_dependency_infoQs8
����
z$AptFacade._get_unmet_dependency_infocCs"dtjd<dtjd<dtjd<dS)zW
        Set the environment to avoid attempts by apt to interact with a user.
        �noninteractive�DEBIAN_FRONTEND�none�APT_LISTCHANGES_FRONTEND�APT_LISTBUGS_FRONTENDN)r4�environr(rrr�_set_frontend_noninteractivews

z&AptFacade._set_frontend_noninteractivecCs&|��tj�d�tj�dd�dS)zV
        Setup environment and apt options for successful package operations.
        z
DPkg::optionszDPkg::options::z--force-confoldN)rBr�r�r�rVr(rrr�_setup_dpkg_for_changessz!AptFacade._setup_dpkg_for_changescs�t�j�dkp
t�j�dk}|sdS�fdd��jD�}|r0tddd�dd�t|�D�����jD]}��|�q3�jD]}��|�q>d	S)
z>
        Perform pending hold operations on packages.
        rNcsg|]	}��|�s|�qSr)rmror(rrr%�s
�z3AptFacade._perform_hold_changes.<locals>.<listcomp>z0Cannot perform the changes, since the following zpackages are not installed: %sr!cSrtrrurorrrr%�rwz#Package holds successfully changed.)rrZr[rr'rxr�r�)r�hold_changes�
not_installedrprr(r�_perform_hold_changes�s.�
�����

zAptFacade._perform_hold_changesc
Cs�t�}t��\}}t�d�}t�d�}t�|d�t�|d�t�}z�d}||jkr�d}|dkr@t�	|j
�t�d|j|�|d7}z|j
jt|�|d�|jsVtd��WnKty|}	z|��t|�}
t|	jdd|
�}WYd}	~	n9d}	~	wtjjy�}z|��t|�}
t|jdd|
�}WYd}~nd}~ww|��t|�}
n||jks*|dur�|�Wt�|d�t�|d�t�|�|
St�|d�t�|d�t�|�w)	zd
        Commit cached APT operations and give feedback on the results as a
        string.
        r�rNzMdpkg process might be in use. Retrying package changes. %d retries remaining.)�fetch_progress�install_progresszdpkg didn't exit cleanly.z

Package operation log:
)r	�tempfile�mkstempr4�dup�dup2r1�max_dpkg_retries�time�sleep�dpkg_retry_sleep�logging�warningrQ�commitr+r6r@�getvaluerr�argsrNrO�LockFailedExceptionr�)r�fetch_output�fd�install_output_path�
old_stdout�
old_stderrrI�
dpkg_tries�error�exc�result_text�	exceptionrrr�_commit_package_changes�s�


�����
����
�����
�%�
�z!AptFacade._commit_package_changescCst|jD]4}||jjkrq||j_|jjp|jj}|jjd|d�|j�|j�|�|jj	�|�
|jj	�qdS)NF)�auto_fix�	from_user)rUr$r�r
�is_auto_installed�mark_installrW�addr�r�protect)r�fixerrp�	is_manualrrr�_preprocess_installs�s

��zAptFacade._preprocess_installsc	s�t�}tdd�|jD���t�fdd�|jD��}|jD]@}|�|j�r+|�|jj�|j|vr1q|jjdd�|�|jj	�|�
|jj	�|�|jj	�z|��Wqt
y\Yqw|rltddd�t|����dS)	Ncss�|]}|jVqdSrrrorrrrs�
�z0AptFacade._preprocess_removes.<locals>.<genexpr>c3s �|]}|j�vr|jVqdSrrro��package_installsrrrs�
��F)rcz7Can't perform the changes, since the following packagesz
 are held: %sr!)rVrUrYrnr$rgrv�mark_deleter�rrhr��install_protectr�rr'rx)rri�held_package_names�package_upgradesrprrlr�_preprocess_removes�s8��

����zAptFacade._preprocess_removescCs|jr|jjdd�dSdS)NT)�dist_upgrade)rXrQ�upgrader(rrr�_preprocess_global_upgrade"s�z$AptFacade._preprocess_global_upgradec
Csv|��}||kr7z|�d�Wnty(}z
t|jdd|����d}~ww|��}||kr9t|����dSdS)zQ
        Attempt to automatically resolve problems with broken packages.
        Trr�N)r�resolver@rrVr;)rri�already_broken_packages�now_broken_packagesr^rrr�_resolve_broken_packages&s����z"AptFacade._resolve_broken_packagescCsj|jdd�}|�|j�|s|jsgS|��}t�|jj�}|�	|�|�
�|�|�|�||�|Sr)
rUrMrYrXrr��ProblemResolverrQr#rkrurrry)r�version_changesrwrirrr�_preprocess_package_changes6s


z%AptFacade._preprocess_package_changescCs|��}|�|�sdS|��S)zD
        Perform pending install/remove/upgrade operations.
        N)r|rrb)rr{rrr�_perform_package_changesCs
z"AptFacade._perform_package_changescCsZ|��|��}|��}g}|dur|�|�|dur |�|�t|�dkr+d�|�SdS)z9
        Perform the pending package operations.
        Nrr�)rCrFr}r5rr')r�hold_result_text�package_result_text�resultsrrr�perform_changesLs


�zAptFacade.perform_changescCsN|jdd�=|j��|jdd�=|jdd�=|jdd�=d|_|j��dS)z%Clear the pending package operations.NF)rUrWr�rYr[rZrXrQr(rrr�reset_marks[s
zAptFacade.reset_markscC�|j�|�dS)z"Mark the package for installation.N)rUr5r�rrrrfe�zAptFacade.mark_installcCs
d|_dS)zUpgrade all installed packages.TN)rXr(rrr�mark_global_upgradeirlzAptFacade.mark_global_upgradecCr�)zMark the package for removal.N)rYr5r�rrr�mark_removemr�zAptFacade.mark_removecCr�)zMark the package to be held.N)rZr5r�rrr�	mark_holdqr�zAptFacade.mark_holdcCr�)z*Mark the package to have its hold removed.N)r[r5r�rrr�mark_remove_holdur�zAptFacade.mark_remove_holdr)F)NN)T)?rrrrrNrQrcr rLrarkrrryr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rmr�r�r�r�rnrr
rrrr r.r;rBrCrFrbrkrrruryr|r}r�r�rfr�r�r�r�rrrrrFvs~


,
�


	
	&E#
	
rF)(�
__future__rr�rRr4r}r;rJrO�operatorrrNr�r��aptsources.sourceslistr�apt.progress.textr�apt.progress.baser�twisted.python.compatr�landscape.lib.compatr	�landscape.lib.fsr
rrr
r�skeletonr�	Exceptionrrr*r+r1�objectrFrrrr�<module>s40

Spamworldpro Mini