ok
Direktori : /lib/python3.6/site-packages/dnf/cli/commands/__pycache__/ |
Current File : //lib/python3.6/site-packages/dnf/cli/commands/__pycache__/history.cpython-36.pyc |
3 ��f%F � @ s� d dl mZ d dl mZ d dl mZ d dlZd dlZd dlmZmZ d dl m Z d dlmZm Z d dl Zd dlZd dlZd dlZd dlZd dlZd dlZejd�ZG d d � d e j�ZdS )� )�absolute_import)�print_function)�unicode_literalsN)�_�ucd)�commands)�TransactionReplay�serialize_transaction�dnfc s� e Zd ZdZd+Zed�Zddddd d ddgZ� fd d�Ze dd� �Z dd� Zdd� Zdd� Z dd� Zdd� Zdd� Zdd� Zdd � Zd!d"� Zd#d$� Zd%d&� Zd'd(� Zd)d*� Z� ZS ),�HistoryCommandzUA class containing methods needed by the cli to execute the history command. �history�histz(display, or use, the transaction history�list�info�redo�replay�rollback�store�undo� userinstalledc s t t| �j||� d| _d S )NF)�superr �__init__�_require_one_transaction_id)�self�args�kw)� __class__� �/usr/lib/python3.6/history.pyr 4 s zHistoryCommand.__init__c C s� | j ddddjtjd djtjdd � ��d� | j d d dd� | j d dd td�d� | j dd td�d� | j dd td�d� | j dd td�d� | j ddddd� | j ddddd� d S )N�transactions_action�?ZCOMMANDz$Available commands: {} (default), {}r z, � )�nargs�metavar�helpz --reverse� store_truez$display history list output reversed)�actionr$ z-oz--outputz<For the store command, file path to store the transaction to)�defaultr$ z--ignore-installedzXFor the replay command, don't check for installed packages matching those in transactionz--ignore-extraszRFor the replay command, don't check for extra packages pulled into the transactionz--skip-unavailablezYFor the replay command, skip packages that are not available or have missing dependencies�transactions�*ZTRANSACTIONz�For commands working with history transactions, Transaction ID (<number>, 'last' or 'last-<number>' for one transaction, <transaction-id>..<transaction-id> for a range)�transaction_filenameZTRANSACTION_FILEzEFor the replay command, path to the stored transaction file to replay)�add_argument�formatr �_CMDS�joinr )�parserr r r � set_argparser9 s$ zHistoryCommand.set_argparserc C s. | j js| jd | j _n0| j j| jkrH| j jjd| j j� | jd | j _td�j| j j�| _| jj }| j jdk�r| j js�t jjtd���t| j j�dkr�t jjtd���t jj| j jd �| j _g | j _d|_d|_d|_d| jj_d| jj_t jjj| j| j� n�| j jd k�r6d| _| j j�s�t jjtd ���n�| j jdk�r�d|_d|_d|_d| _| j j�s�td �}tj|� t jj|��n,t| j j�dk�r�tj| j� t jj| j��d|_t jjj| j| j� nd|_d|_| jjjdk�r*t j | jjjt j!� �r*td| jjj �}tj|� t jj|��d S )Nr zUFound more than one transaction ID. '{}' requires one transaction ID or package name.r zNo transaction file name given.r! z6More than one argument given as transaction file name.TFr z(No transaction ID or package name given.r r r z:memory:z+You don't have access to the history DB: %s)r r r )"�optsr r- r( �insertr r, �_require_one_transaction_id_msg�cli�demandsr �CliError�len�os�path�abspathr* Zavailable_reposZ resolvingZ root_user�base�confZclean_requirements_on_removeZinstall_weak_depsr Z_checkGPGKeyr �logger�criticalZfresh_metadataZsack_activationr �access�R_OK)r r5 �msgr r r � configureU sZ ( zHistoryCommand.configurec C s� t |tjj�rv| jjdkr2| jj\}td�| fS | jjdkrv| jjd dkrV| jjn| jjdd� \}td�| fS tjj j j| |�S ) z.Get suggestions for resolving the given error.r zVCannot undo transaction %s, doing so would result in an inconsistent package database.r r �forcer! NzZCannot rollback transaction %s, doing so would result in an inconsistent package database.)� isinstancer � exceptionsZTransactionCheckErrorr1 r r( r r4 r �Command�get_error_output)r �errorZid_r r r rG � s zHistoryCommand.get_error_outputc C s: | j |�}t|�}t| j|dd| jjd�| _| jj� d S )NT)�data�ignore_installed� ignore_extras�skip_unavailable)�_history_get_transactionr r r; r1 rL r �run)r �extcmds�oldrI r r r � _hcmd_redo� s zHistoryCommand._hcmd_redoc C sD |st jjtd���| jjj|�}|s@t jjtd�j|d ���|S )NzNo transaction ID givenzTransaction ID "{0}" not found.r )r r4 r6 r r; r rP r, )r rO rP r r r �_history_get_transactions� s z(HistoryCommand._history_get_transactionsc C s. | j |�}t|�dkr&tjjtd���|d S )Nr! z#Found more than one transaction ID!r )rR r7 r r4 r6 r )r rO rP r r r rM � s z'HistoryCommand._history_get_transactionc C s | j |�}| j|� d S )N)rM �_revert_transaction)r rO rP r r r � _hcmd_undo� s zHistoryCommand._hcmd_undoc C s� | j |�}| jjj� }d }|j|jkr�x�| jjjtt|jd |jd ���D ]X}|jrjt j td�|j� n|jr�t j td�|j� |d kr�t jjj|�}qL|j|� qLW | j|� d S )Nr! z-Transaction history is incomplete, before %u.z,Transaction history is incomplete, after %u.)rM r; r �last�tidrP r �rangeZaltered_lt_rpmdbr= Zwarningr Zaltered_gt_rpmdbr ZdbZMergedTransactionWrapper�mergerS )r rO rP rU Zmerged_trans�transr r r �_hcmd_rollback� s *zHistoryCommand._hcmd_rollbackc C s& dddddddddd d d�}t |�}x�dD ]�}x�|j|g �D ]�}||d |d<