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/uaclient/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

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

���f��@sxddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
mZddlm
Z
mZmZmZmZmZmZddlZddlmZddlmZmZmZmZmZmZmZddlm Z ddl!m"Z"dZ#d	Z$d
Z%dZ&dZ'd
Z(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2dZ3dZ4ej5�6e d�ej5�6e d�gej5�6e d�ej5�6e d�ej5�6e d�ej5�6e d�gd �Z7gd!�Z8e�9�Z:e�;e�<e=��Z>ej?Gd"d#�d#ej@��ZAed$d%eBfd&eBfd'eBfg�ZCd(d)�ZDeDd*eBd+eBfd,d-��ZEd.d/�ZFd0eBd1eeBfd2d3�ZG		d�d4eeBd5eeBd6ee
eBeBfd1eBfd7d8�ZHe
dd9�		d�d5eeBd6ee
eBeBfd1eBfd:d;��ZIGd<d=�d=�ZJd>d?�ZKd@dA�ZLdBeBd1eeBfdCdD�ZM	Ed�dBeBdFeNd1eeBfdGdH�ZO	d�d6ee
eBeBfd1eBfdIdJ�ZPe�QejRejSfe8�dKeBfdLdM��ZT		d�dNeeBdOeeeBd6ee
eBeBfd1eBfdPdQ�ZUdReBd1eejVfdSdT�ZWdReeBd1eejVfdUdV�ZX	d�dWejVdXeeBd1eejYfdYdZ�ZZd[eeBd\eBd]eNd^eBd1eBf
d_d`�Z[	Ed�d[eeBd\eBd]eNd^eBdaeBdbeNd1eBfdcdd�Z\deeBd^eBdfeBd[eeBdaeBd1dfdgdh�Z]didj�Z^dkdl�Z_	d�deeBd^eBdaeeBd1dfdmdn�Z`dodp�Zadqdr�Zbdsdt�Zcdudv�ZddweBd1eNfdxdy�Zed1eeCfdzd{�Zfd1eeBfd|d}�ZgddeAjhfd~eeBdeeBd�eeAd1dfd�d��Zid1eejfd�d��Zkd1eejfd�d��Zld�d��Zmd�d�d��Znd�eeBd�eBfd�d��Zod�eeBd�eBfd�d��Zpd�eeBfd�d��Zqd�d��Zrd�d��Zsd�eeBd1e
eBeeBeeBfffd�d��Ztd1eBfd�d��ZudS)��N)�	lru_cache�wraps)�Dict�Iterable�List�
NamedTuple�Optional�Set�Union)�AcquireProgress)�event_logger�
exceptions�gpg�messages�secret_manager�system�util)�ESM_APT_ROOTDIR)�status_cache_filegN@z  # ubuntu-pro-clientzDir::Etc::netrc/zDir::Etc::netrcparts/zDir::State::lists/a�/*
 * Autogenerated by ubuntu-pro-client
 * Do not edit this file directly
 *
 * To change what ubuntu-pro-client sets, use the `pro config set`
 * or the `pro config unset` commands to set/unset either:
 *      global_apt_http_proxy and global_apt_https_proxy
 * for a global apt proxy
 * or
 *      ua_apt_http_proxy and ua_apt_https_proxy
 * for an apt proxy that only applies to Ubuntu Pro related repos.
 */
z$Acquire::http::Proxy "{proxy_url}";
z%Acquire::https::Proxy "{proxy_url}";
z4Acquire::http::Proxy::esm.ubuntu.com "{proxy_url}";
z5Acquire::https::Proxy::esm.ubuntu.com "{proxy_url}";
z/etc/apt/trusted.gpg.d/z/usr/share/keyringsz/usr/lib/apt/methods/httpsz /usr/sbin/update-ca-certificatesz//etc/apt/apt.conf.d/90ubuntu-advantage-aptproxyz*/var/lib/apt/periodic/update-success-stamp)�xenial�bionic�focal�jammy�manticz�# Written by ubuntu-pro-client
Types: deb{deb_src}
URIs: {url}
Suites: {suites}
Components: main
Signed-By: {keyrings_dir}/{keyring_file}
zetc/apt/sources.listzvar/lib/dpkg/statuszetc/apt/apt.conf.dzetc/apt/preferences.dzvar/cache/apt/archives/partialzvar/lib/apt/lists/partial)�files�folders)g�?g@g$@c@seZdZe�Ze�ZdS)�
AptProxyScopeN)�__name__�
__module__�__qualname__�object�GLOBAL�UACLIENT�r#r#�./usr/lib/python3/dist-packages/uaclient/apt.pyrbs
r�InstalledAptPackage�name�version�archcst���fdd��}|S)z*Decorator ensuring apt_pkg is initialized.cs&tj�d�dkrt���|i|��S)N�Dir�)�apt_pkg�config�get�init)�args�kwargs��fr#r$�new_fpsz"ensure_apt_pkg_init.<locals>.new_f)r)r2r3r#r1r$�ensure_apt_pkg_initmsr4�a�bcCst�||�S�N)r+�version_compare)r5r6r#r#r$r8{sr8c
Cs|�d�\}}tj�d�sdSz0t���!}tjddd�||||�tj�	|d�gt
td�Wd�WdS1s8wYWdStj
yx}z,|jdkrlt|j���}t�d	|�r`tj|d
��t�d|�rltj|d
��tjt|�d��d}~wtjy�tjt
|d
��w)aValidate apt credentials for a PPA.

    @param repo_url: private-ppa url path
    @param username: PPA login username.
    @param password: PPA login password or resource token.

    @raises: UbuntuProError for invalid credentials, timeout or unexpected
        errors.
    �://z/usr/lib/apt/apt-helperNz
download-filez{}://{}:{}@{}/pool/zapt-helper-output)�timeout�retry_sleeps�dz401\s+unauthorized|httperror401)�repozconnection timed out��detail)�secondsr=)�split�os�path�exists�tempfile�TemporaryDirectoryr�subp�format�join�APT_HELPER_TIMEOUT�APT_RETRIESr
�ProcessExecutionError�	exit_code�str�stderr�lower�re�search�APTInvalidCredentials�
APTTimeout�APTUnexpectedError�
subprocess�TimeoutExpired�APTCommandTimeout)�repo_url�username�password�protocol�	repo_path�tmpd�erOr#r#r$�assert_valid_apt_credentials�s>

���&�
���r`�	apt_error�returncCsVt�}|���d�D]}|r(t�d|�}|r(d|��d�d�d}|�|�q
|S)aAParse apt update errors for invalid apt config in user machine.

    This functions parses apt update errors regarding the presence of
    invalid apt config in the system, for example, a ppa that cannot be
    reached, for example.

    In that scenario, apt will output a message in the following formats:

    The repository 'ppa 404 Release' ...
    Failed to fetch ppa 404 ...

    On some releases, both of these errors will be present in the apt error
    message.

    :param apt_error: The apt error string
    :return: a NamedMessage containing the error message
    �
z2(Failed to fetch |The repository .)(?P<url>[^\s]+)z- �urlz/distsr)�set�striprArQrR�	groupdict�add)ra�failed_repos�line�
pattern_match�repo_url_matchr#r#r$�(_parse_apt_update_for_invalid_apt_config�s��
�rm�cmd�	error_msg�override_env_varsc
Cs�ztj|dt|d�\}}W|StjyG}z,dt|j�vr"t���	t|j�}|r5tj	d�
t|��d��|r9|nt|�}tj|d��d}~ww)a�Run an apt command, retrying upon failure APT_RETRIES times.

    :param cmd: List containing the apt command to run, passed to subp.
    :param error_msg: The string to raise as UbuntuProError when all retries
       are exhausted in failure.
    :param override_env_vars: Passed directly as subp's override_env_vars arg

    :return: stdout from successful run of the apt command.
    :raise UbuntuProError: on issues running apt-cache policy.
    T)�capturer;rpz%Could not get lock /var/lib/dpkg/lockrc)rir>N)
rrGrKr
rLrNrO�APTProcessConflictErrorrm�APTInvalidRepoErrorrI�sortedrU)rnrorp�out�_errr_ri�msgr#r#r$�run_apt_command�s*��
���rx)�maxsizecCstddg||d�S)N�	apt-cache�policy)rnrorp)rx)rorpr#r#r$�get_apt_cache_policy�s
�r|c@s$eZdZdd�Zdd�Zdd�ZdS)�PreserveAptCfgcCs||_i|_dSr7)�apt_func�current_apt_cfg)�selfr~r#r#r$�__init__s
zPreserveAptCfg.__init__cs&tj��fdd����D�|_|��S)Ncsi|]}|t���|���qSr#)�copy�deepcopyr-)�.0�key��cfgr#r$�
<dictcomp>s�z,PreserveAptCfg.__enter__.<locals>.<dictcomp>)r+r,�keysrr~)r�r#r�r$�	__enter__
s

�zPreserveAptCfg.__enter__cCs4tj}|j��D]}|�||j|�qt��dSr7)r+r,rr�re�init_system)r��type�value�	tracebackr�r�r#r#r$�__exit__szPreserveAptCfg.__exit__N)rrrr�r�r�r#r#r#r$r}sr}cCs.tj��D]}tj�|�qt��t�d�Sr7)r+r,r��clearr.�Cache�r�r#r#r$�get_apt_pkg_caches
r�cCsbz%tj��D]}t�d|�stj�|�qtj�dt�t��t�	d�WSt
y0iYSw)Nz^Acquirer))r+r,r�rQrRr�rerr.r��	Exceptionr�r#r#r$�get_esm_apt_pkg_cache#s��r��pkg_namec	Cshtt��}z||}WntyYWd�dSwWd�n1s&wY|jr2|jjSdSr7)r}r��KeyError�current_ver�ver_str)r��cache�packager#r#r$�get_pkg_version6s
���r�F�check_esm_cachec	CsTtt��7}z||}WntyYWd�dSwt�|�}|�|�}|s1	Wd�dS|j}Wd�n1s>wY|sG|Stt��U}|r�z||}Wntyf|YWd�Swt�|�}	|	�|�}
|
s||Wd�S|
j}t�||�dkr�|Wd�SWd�|SWd�|S1s�wY|S)Nr)	r}r�r�r+�DepCache�get_candidate_verr�r�r8)r�r�r�r��	dep_cache�	candidate�candidate_version�	esm_cache�esm_package�
esm_dep_cache�
esm_candidate�esm_candidate_versionr#r#r$�get_pkg_candidate_versionCsZ
�

��

�

����
��
��r�c
Cs�zDz
tddg|d�}Wn2tjyt���tjy*}ztj|jd��d}~wtjy=}ztj|jd��d}~wwWt	�
�|St	�
�w)N�apt-get�update�rnrp��repo_msgr>)rxr
rr�APTUpdateProcessConflictErrorrs�APTUpdateInvalidRepoErrorrw�UbuntuProError�APTUpdateFailedr|�cache_clear)rprur_r#r#r$�run_apt_update_commandos"
�����

�r��sources_list_pathcCs*tt���}tj�dtj�|��tj�dd�tj�dd�t��}|�	�t
�}tj�tj�d�d�}t�
|�}zDz|�|�||d�Wd�n1sOwYWn"ttd	d
�ydt���tyw}ztjt|�d��d}~wwWt��nt��wWd�dS1s�wYdS)NzDir::Etc::sourcelistzDir::Etc::sourcepartszN.O.F.O.L.D.E.RzAPT::List-Cleanup�0zDir::State::Lists�lockr�Errorr#r>)r}r�r+r,rerBrC�abspath�
SourceList�read_main_listrrI�find_dir�FileLockr��getattrr
rr�SystemErrorr�rNr|r�)r�r��sources_list�fetch_progress�	lock_filer�r_r#r#r$�update_sources_list�s6
��
�����"�r��packages�apt_optionsc
Csj|durg}ztgd�|||d�}W|Stjy!t���tjy4}ztj|jd��d}~ww)N)r��install�--assume-yesr�r�)rxr
rr�APTInstallProcessConflictErrorrs�APTInstallInvalidRepoErrorrw)r�r�rprur_r#r#r$�run_apt_install_command�s$������r��origincCsvt�}tt��(}|jD]}|j}|r$|jD]\}}|j|kr#|�|�qqWd�t|�S1s2wYt|�Sr7)	rer}r�r�r��	file_listr�rh�list)r��resultr�r��installed_version�file�_r#r#r$� get_installed_packages_by_origin�s



��
��r�c	Cs�|durgSt�}tt��8}t�|�}|jD]$}|j}|r:|�|�}|r:||kr:|jD]\}}|j	|kr9|�
|�q+qWd�t|�S1sHwYt|�Sr7)rer}r�r+r�r�r�r�r�r�rhr�)	r�r�r�r�r�r�r�r�r�r#r#r$�;get_installed_packages_with_uninstalled_candidate_in_origin�s&





��
��r�r��exclude_origincs6g}|jD]}�fdd�|jD�}|r|�|�q|S)Ncs(g|]\}}|jdkr|j�kr|�qS)�now)�	componentr�)r�r�r��r�r#r$�
<listcomp>�s
�z3get_remote_versions_for_package.<locals>.<listcomp>)�version_listr��append)r�r��valid_versionsr'�
valid_originsr#r�r$�get_remote_versions_for_package�s

�
�r��suites�series�updates_enabledrYcCsRd}|D]"}||vrqd}d|vr|st�d||�d}|dj|||d�7}q|S)Nr*�-updatesz?Not enabling apt suite "%s" because "%s-updates" is not enabledz# zC{maybe_comment}deb {url} {suite} main
# deb-src {url} {suite} main
)�
maybe_commentrd�suite)�LOG�warningrH)r�r�r�rY�contentr�r�r#r#r$�_get_list_file_content�s&���r��keyring_file�include_deb_srcc	sZ�fdd�|D�}|st�d��dd�|D�}|rdnd}tj|d�|�t||d�}|S)	Ncsg|]}�|vr|�qSr#r#�r�r��r�r#r$r� �z-_get_sources_file_content.<locals>.<listcomp>zPNot enabling service-related -updates suites because "%s-updates" is not enabledcSsg|]}d|vr|�qS)r�r#r�r#r#r$r�'sz deb-srcr*� )rdr��keyrings_dirr��deb_src)r�r��DEB822_REPO_FILE_CONTENTrHrI�KEYRINGS_DIR)	r�r�r�rYr�r��appliable_suitesr�r�r#r�r$�_get_sources_file_contents$���r��
repo_filename�credentialscCsz	|�d�\}}Wn
tyd}|}Ynwtj�|�t��j}|�d�r-|dd�}t	|||�d}t
ddgtj�}	|	�
�D]}
d	�|�|
vrKqAd
|
vrPqAd}t|||�|tvrytj�t|�}tj�t|�}t�||�t||||�}
nt|||||�}
t�||
�dS)z�Add an authenticated apt repo and credentials to the system.

    @raises: InvalidAPTCredentialsError when the token provided can't access
        the repo PPA.
    �:�bearer�/N���Frzr{za={}-updatesz	o=Ubuntu,T)rA�
ValueErrorr�secrets�
add_secretr�get_release_infor��endswithr`rxr�APT_POLICY_FAILED�
splitlinesrH�add_apt_auth_conf_entry�SERIES_NOT_USING_DEB822rBrCrIr��APT_KEYS_DIRr�export_gpg_keyr�r��
write_file)r�rYr�r�r�rZr[r�r�r{rj�source_keyring_file�destination_keyring_filer�r#r#r$�add_auth_apt_repo8sD�


��
�rc
Cs�t�}|�d�\}}|�d�s|d7}tj�|�rt�|�}nd}dj|||t	d�}d}g}	|�
�D].}
|s[|
��}t|�dkr[|d}||krP|	�|�d	}q2||vr[|	�|�d	}|	�|
�q2|sh|	�|�|	�d�tj
|d
�|	�dd�d
S)zBAdd or replace an apt auth line in apt's auth.conf file or conf.d.r9r�r*z:machine {repo_path} login {login} password {password}{cmt})r]�loginr[�cmtF��Trc���modeN)�!get_apt_auth_file_from_apt_configrAr�rBrCrDr�	load_filerH�APT_AUTH_COMMENTr��lenr�rrI)
rYrr[�
apt_auth_file�	_protocolr]�orig_content�repo_auth_line�added_new_auth�	new_linesrj�
split_line�curr_line_repor#r#r$rpsD
��	



rcs�|�d�\}}|�d�r|dd�}t�}tj�|�rGt�|�}dj|d��d�	�fdd	�|�
�D��}|s=t�|�dStj||d
d�dSdS)z+Remove a repo from the shared apt auth filer9r�Nr�zmachine {repo_path}/ login)r]rccsg|]}�|vr|�qSr#r#)r�rj��auth_prefixr#r$r��r�z2remove_repo_from_apt_auth_file.<locals>.<listcomp>rr
)
rAr�rrBrCrDrrrHrIr��ensure_file_absentr)rYrr]r�apt_authr�r#rr$�remove_repo_from_apt_auth_file�s

��rcCsNt�|�|�d�rt�t�|d��|r!tj�t|�}t�|�t	|�dS)z>Remove an authenticated apt repo and credentials to the systemz.sourcesr�N)
rrr�r�set_filename_extensionrBrCrIrr)r�rYr�r#r#r$�remove_auth_apt_repo�s


�
r!cCsB|�d�\}}|�d�r|dd�}dj||d�}t�||�dS)z.Add an apt preferences file and pin for a PPA.r9r�Nr�z<Package: *
Pin: release o={origin}
Pin-Priority: {priority}
)r��priority)rAr�rHrr)�apt_preference_filerYr�r"rr]r�r#r#r$�add_ppa_pinning�s
��r$cCsVt�dddtg�\}}|r|�d�ddSt�dddtg�\}}|�d�d�d�S)z7Return to patch to the system configured APT auth file.�
apt-config�shellr��'rz90ubuntu-advantager�)rrG�APT_CONFIG_AUTH_PARTS_DIRrA�APT_CONFIG_AUTH_FILE�rstrip)rurvr#r#r$r�s
�
�rc
Cs~|�d�\}}|�d�r|dd�}d}t�dddtg�\}}|r(|�d	�d
}|�dd�}tt�tj	�
||d�|����S)
zEList any apt files in APT_CONFIG_LISTS_DIR given repo_url and series.r9r�Nr�z/var/lib/apt/listsr%r&r�r'rr�z
_dists_{}*)rAr�rrG�APT_CONFIG_LISTS_DIR�replacert�globrBrCrIrH)rYr�rr]�	lists_dirrurv�aptlist_filenamer#r#r$�find_apt_list_files�s"

����r0cCst||�D]}t�|�qdS)z?Remove any apt list files present for this repo_url and series.N)r0rr)rYr�rCr#r#r$�remove_apt_list_files�s�r1�pkgcCs
|t�vSr7)�get_installed_packages_names)r2r#r#r$�is_installed�s
r4c	Csbg}tt��!}|jD]}|j}|r|�t|j|j|jd��q
Wd�|S1s*wY|S)N)r&r'r()	r}r�r�r�r�r%r&r�r()�	installedr�r�r�r#r#r$�get_installed_packages�s$

����
��r6cCst�}dd�|D�}|S)NcSsg|]}|j�qSr#)r&)r�r2r#r#r$r�sz0get_installed_packages_names.<locals>.<listcomp>)r6)�package_list�	pkg_namesr#r#r$r3
sr3�
http_proxy�https_proxy�proxy_scopecCs�|s|r!|r!d}|tjkrd}n|tjkrd}t�tjj|d��d}|r@|tjkr3|tj|d�7}n
|tjkr@|t	j|d�7}|r]|tjkrP|t
j|d�7}n
|tjkr]|tj|d�7}|dkret|}|dkrpt
�t�dSt
�t|�dS)a�
    Writes an apt conf file that configures apt to use the proxies provided as
    args.
    If both args are None, then no apt conf file is written. If this function
    previously wrote a conf file, and was run again with both args as None,
    the existing file is removed.

    :param http_proxy: the url of the http proxy apt should use, or None
    :param https_proxy: the url of the https proxy apt should use, or None
    :return: None
    r*z	UA-scoped�global)�scope)�	proxy_urlN)rr"r!�event�infor�SETTING_SERVICE_PROXY_SCOPErH�APT_CONFIG_UA_PROXY_HTTP�APT_CONFIG_GLOBAL_PROXY_HTTP�APT_CONFIG_UA_PROXY_HTTPS�APT_CONFIG_GLOBAL_PROXY_HTTPS�APT_PROXY_CONFIG_HEADERrr�APT_PROXY_CONF_FILEr)r9r:r;�message�apt_proxy_configr#r#r$�setup_apt_proxysD

�

�
�

�
�rJcCs d}tj�t�rt�t�j}|Sr7)rBrCrD�APT_UPDATE_SUCCESS_STAMP_PATH�stat�st_mtime��
cache_timer#r#r$�get_apt_cache_timeHsrPcCs$t�}|dur	dStj�|tjj�Sr7)rP�datetime�
fromtimestamp�timezone�utcrNr#r#r$�get_apt_cache_datetimeOsrUcs�tjtj�td�dd��tdtd}t�fdd�|D��r!dSt�t�tdD]}t�	|�q*tdD]
}tj
|ddd	�q6dS)
Nz**/*T)�	recursiverrc3s�|]}|�vVqdSr7r#)r�r���existing_filesr#r$�	<genexpr>^s�z._ensure_esm_cache_structure.<locals>.<genexpr>i�)�exist_okr)r-rBrCrIr�ESM_BASIC_FILE_STRUCTURE�allr�ensure_folder_absent�create_file�makedirs)�
desired_filesr��folderr#rWr$�_ensure_esm_cache_structureVs��
�rbcCs�t��sdSt�ddlm}ddlm}ddlm}m	}d}d}t
��}|dur/||�d}|�dg�D]"}|�dd�d	krG|�d
d�dk}|�dd�d
krW|�d
d�dk}q5||�}	|rl|	�
�d|jkrl|	��n|	��t��r�||�}
|r�|
�
�d|jkr�|
��n|
��tt��J}t��}|��Gdd�dt�}
|
�}z	|�||d�Wnty�}zt�d�t|���WYd}~n
d}~wwWd�dSWd�dS1s�wYdS)Nr)�status)�ApplicationStatus)�ESMAppsEntitlement�ESMInfraEntitlementF�servicesr&r*zesm-apps�	available�no�yesz	esm-infrac@s,eZdZdejfdd�Zdejfdd�ZdS)z-update_esm_caches.<locals>.EsmAcquireProgress�itemcS�t�d�|j��dS)NzFetched ESM Apt Cache item: {})r��debugrH�uri�r�rkr#r#r$�done�sz2update_esm_caches.<locals>.EsmAcquireProgress.donecSrl)Nz&Failed to fetch ESM Apt Cache item: {})r�r�rHrnror#r#r$�fail�s
�z2update_esm_caches.<locals>.EsmAcquireProgress.failN)rrrr+�AcquireItemDescrprqr#r#r#r$�EsmAcquireProgress�srsz%Failed to fetch the ESM Apt Cache: {})r�is_current_series_ltsrb�uaclient.actionsrc�(uaclient.entitlements.entitlement_statusrd�uaclient.entitlements.esmrerfr�readr-�application_status�DISABLED�setup_local_esm_repo�disable_local_esm_repo�is_current_series_active_esmr}r�r+r�r�rr�r�r�r�rHrN)r�rcrdrerf�apps_available�infra_available�current_status�service�apps�infrar�r�rsr�r_r#r#r$�update_esm_cachesksZ��
�

	 ����"�r��
package_names�
error_messagecC�"tgd�t|�|ddid�dS)a�
    Remove APT packages from the system.

    Setting DEBIAN_FRONTEND to noninteractive makes sure no prompts will
    appear during the operation. In this case, --force-confdef will
    automatically pick the default option when some debconf should appear.
    In the absence of a default option, --force-confold will automatically
    choose to keep the old configuration file.
    )r��remover��$-o Dpkg::Options::="--force-confdef"�$-o Dpkg::Options::="--force-confold"�DEBIAN_FRONTEND�noninteractive�rpN�rxr��r�r�r#r#r$�remove_packages��
�
�r�cCr�)a�
    Purge APT packages from the system - remove everything.

    Setting DEBIAN_FRONTEND to noninteractive makes sure no prompts will
    appear during the operation. In this case, --force-confdef will
    automatically pick the default option when some debconf should appear.
    In the absence of a default option, --force-confold will automatically
    choose to keep the old configuration file.
    )r��purger�r�r�r�r�r�Nr�r�r#r#r$�purge_packages�r�r�cCst|gd�ddid�dS)a6
    Install packages, allowing downgrades.

    The --allow downgrades flag is needed because sometimes we need to
    reinstall the packages to a lower version (passed in the package_name
    string, as package=version).

    Setting DEBIAN_FRONTEND to noninteractive makes sure no prompts will
    appear during the operation. In this case, --force-confdef will
    automatically pick the default option when some debconf should appear.
    In the absence of a default option, --force-confold will automatically
    choose to keep the old configuration file.
    )z--allow-downgradesr�r�r�r�)r�rpN)r�)r�r#r#r$�reinstall_packages�s

�r�cCs*tj��D]}tj�|�qt��tjSr7)r+r,r�r��init_configr�r#r#r$�_get_apt_config�sr�cCs8tt��}|�|�}Wd�|S1swY|Sr7)r}r�r�)�base_key�apt_cfg�apt_cfg_keysr#r#r$�get_apt_config_keyss

��r��	cfg_namescCsdi}tt��"}|D]}|�|�}t|�s|�|�pd}|||<q	Wd�|S1s+wY|S)z�
    Get all APT configuration values for the given config names. If
    one of the config names is not present on the APT config, that
    config name will have a value of None
    N)r}r�r-rN�
value_list)r��apt_cfg_dictr��cfg_name�	cfg_valuer#r#r$�get_apt_config_values
s


�
�	�	r�cCsd}d}tj�|�r|S|S)Nz/etc/apt/sources.listz&/etc/apt/sources.list.d/ubuntu.sources)rBrCrD)�old_sources_path�new_sources_pathr#r#r$�get_system_sources_file s
���r�)NN)Fr7)rbN)vr�rQ�enumr-�loggingrBrQrVrE�	functoolsrr�typingrrrrrr	r
r+�apt.progress.baser�uaclientrr
rrrrr�uaclient.defaultsr�uaclient.files.state_filesrrJrr)r(r+rFrCrErBrDrr��APT_METHOD_HTTPS_FILE�CA_CERTIFICATES_FILErGrKrr�rCrIr[rK�get_event_loggerr?�	getLogger�replace_top_level_logger_namerr��unique�EnumrrNr%r4r8r`rmrxr|r}r�r�r��boolr�r��retryrrr�r�r��Packager�r��Versionr�r�r�rrrr!r$rr0r1r4r6r3r!rJ�floatrPrUrbr�r�r�r�r�r�r�r�r#r#r#r$�<module>s�$$	������)�
�(����
�*�������
�-��
�
�'��
��
��
����
�����
� �������
� �����
�8,����
�
����
�8
E
�
�

Spamworldpro Mini