Server : Apache System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64 User : dh_edsupp ( 6597262) PHP Version : 8.2.26 Disable Function : NONE Directory : /lib/python3/dist-packages/duplicity/__pycache__/ |
Upload File : |
o �~�_j � @ s� d Z ddlmZ ddlmZ e�� ddlmZ ddlmZ ddlm Z ddlm Z ddlmZ dd lZdd l Z dd lmZ ddlmZ ddlmZ dd lT dd lT ddlmZ d ad ZG dd� de�Zdd� Zdd� Zdd� Zdd� Zd=dd�Zd=dd�Zd>dd�Zd=dd �Z d!d"� Z!d#d$� Z"d%d&� Z#d'd(� Z$d)d*� Z%G d+d,� d,e�Z&G d-d.� d.e�Z'G d/d0� d0e�Z(G d1d2� d2e�Z)G d3d4� d4e)�Z*G d5d6� d6e)�Z+G d7d8� d8e)�Z,d9d:� Z-d;d<� Z.d S )?a Functions for producing signatures and deltas of directories Note that the main processes of this module have two parts. In the first, the signature or delta is constructed of a ROPath iterator. In the second, the ROPath iterator is put into tar block form. � )�division)�standard_library)�map)�next)�str)�range)�objectN)� statistics)�util)�config)�*)�progressc @ s e Zd ZdS )�DiffDirExceptionN)�__name__� __module__�__qualname__� r r �3/usr/lib/python3/dist-packages/duplicity/diffdir.pyr 6 s r c C s t | �S )z) Alias for SigTarBlockIter below )�SigTarBlockIter�� path_iterr r r �DirSig: s r c C s t | t�d��S )a Return a tarblock full backup of items in path_iter A full backup is just a diff starting from nothing (it may be less elegant than using a standard tar file, but we can be sure that it will be easy to split up the tar and make the volumes the same sizes). � )�DirDelta�io�StringIOr r r r �DirFullA s r c C s t | t�d�|�S )zN Return full backup like above, but also write signature to sig_outfp r )�DirDelta_WriteSigr r )r � sig_outfpr r r �DirFull_WriteSigM � r c C s^ t �� at|t�rtdd� |D ��}nt|�}t| |�}tj s'tj r+t j�� s+t |�S t|�S )z� Produce tarblock diff given dirsig_fileobj_list and pathiter dirsig_fileobj_list should either be a tar fileobj or a list of those, sorted so the most recent is last. c S � g | ]}t |��qS r ��sigtar2path_iter��.0�xr r r � <listcomp>^ � zDirDelta.<locals>.<listcomp>)r �StatsDeltaProcess�stats� isinstance�list�combine_path_itersr# �get_delta_iterr �dry_runr �tracker�has_collected_evidence�DummyBlockIter�DeltaTarBlockIter)r �dirsig_fileobj_list�sig_iter� delta_iterr r r r T s � r c C sJ |r|� � }n|r|� � }nJ d��t�td�t�| �t�|�f � dS )zA Called by get_delta_iter, report error in getting delta r z)Both new and sig are None for some reason�Error %s getting delta for %sN)�get_relative_path�log�Warn�_r �uexc�fsdecode)�exc�new_path�sig_path�sig_tar�index_stringr r r �delta_iter_error_handleri s �rC c s^ | sJ ��r | � � �| j� | �� }t�td�| |f � � ��fdd�}| �� rV|rV|�� rV|jdkrVd|_|�d�}t | �d��}�rLt ||| �� �}|�t �||�� nLd|_�rutjjdkrmd t�d �� �� �_ndd �� � �_| �� s��r����� tr�t j|�� 7 _nt | �d��}�r�t ||| �� �}|�|� | �|� | jj|j_|S )zj Return new delta_path which, when read, writes sig to sig_fileobj, if sigTarFile is not None zGetting delta of %s and %sc sT t | ��_tjjdkrdt�d�� �� �_ndd�� � �_�� �t �| �� dS )zG Callback activated when FileWithSignature read to end � � signature/� /� signature/N)�len�size�sys�version_info�majorr r= �join�name�addfiler �BytesIO)� sig_string��index� sigTarFile�tir r �callback� s z get_delta_path.<locals>.callback� signature�diff�rb�snapshotrD � snapshot/rF � snapshot/)�get_tarinforS � get_ropathr9 �Debugr; �isreg�difftype�open�FileWithReadCounter�FileWithSignature�getsize� setfileobj�librsync� DeltaFilerJ rK rL r r= rM rN rO r* �SourceFileSize�copy_attribs�stat�st_size)r? r@ rT � delta_pathrV � old_sigfp�newfpr rR r �get_delta_pathx sH � �� rp c C s� | j dkr'|r|r|�|� t�td�t�| �� � tjj t� | �� �� dS |r0|r0|�|� t�td�t�| �� � tjjt� | �� �� dS )zI Look at delta path and log delta. Add stats if new_path is set rZ zA %szM %sN) ra �add_new_filer9 �Infor; r r= r8 �InfoCode� diff_file_new�escape�add_changed_file�diff_file_changed)rm r? r* r r r �log_delta_path� s"