PHP WebShell
Текущая директория: /usr/lib/python3/dist-packages/landscape/lib/apt/package/__pycache__
Просмотр файла: testing.cpython-310.pyc
o
���coH � @ s4 d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dlmZ d dl m
Z
G dd� de�ZG dd � d e�Z
d
ZdZdZd
ZdZdZdZdZdZd�d�Zd�d�Zd�d�Zd�d�Zd�d�Zd�d�Zd�d�Zd�d�Zd�d�Z e
�!d�Z"e
�!d�Z#e
�!d�Z$d Z%d!Z&d"Z'd#Z(d$Z)d%d&� Z*d'd(� Z+dS ))� N)� AptFacade)�append_binary_file)�create_binary_file)�base64c @ s^ e Zd ZdZdd� Z ddd �Z dd
d�Zdd
� Z ddd�Zdd� Z dd� Z
dS )�AptFacadeHelperz<Helper that sets up an AptFacade with a tempdir as its root.c C sr |� � |_tj�|jdddd�| _t|_t|jd�|_d|j_ d|j_
| j|_| j|_| j
|_
| j|_| j|_d S )N�var�lib�dpkg�status)�rootTr )�makeDir�apt_root�os�path�join�dpkg_statusr �Facade�facade�refetch_package_index�dpkg_retry_sleep�_add_system_package�_install_deb_file�_add_package_to_deb_dir�_touch_packages_file�_hash_packages_by_name��self� test_case� r �C/usr/lib/python3/dist-packages/landscape/lib/apt/package/testing.py�set_up s
�zAptFacadeHelper.set_up�all�1.0�descriptionNc
s |d u ri }|dddd|d|d| d� � � � |� zt|d��}|�� �d �}W d � n1 s1w Y W n tyB g }Y nw d
|v rL|�d
� d�� fdd
�tjD ��� d�} |�
| � t|dd��}
|
�d �t|��� |
�d� W d � d S 1 s�w Y d S )N�optional�misc�1234�Someone�sourcezshort description
) �Package�Priority�SectionzInstalled-Size�
Maintainer�Architecture�Source�Version�Description�rb�
� �
c s$ g | ]}|� v rd � |� | ��qS )z{}: {})�format)�.0�key��package_stanzar r �
<listcomp>9 s
�z0AptFacadeHelper._add_package.<locals>.<listcomp>zutf-8�wbr �
)
�update�open�read�split�IOError�remover �apt_pkg�REWRITE_PACKAGE_ORDER�encode�append�write�sorted)r �
packages_file�name�architecture�versionr# �control_fields�src�packages�new_package�destr r8 r �_add_package sB �
���
��
"�zAptFacadeHelper._add_packagec C s4 ddi}|dur
|� |� | j| j||||d� dS )z&Add a package to the dpkg status file.�Statuszinstall ok installedN)rK rL rM )r= rR r )r rJ rK rL rM �system_control_fieldsr r r r E s
�z#AptFacadeHelper._add_system_packagec C sX t |�}t�|�}|j�d�}|�� |�� }|�dd� d�|�}t | j
|d � dS )z7Fake the the given deb file is installed in the system.�control� s Status: install ok installedr<