%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/duplicity/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/duplicity/__pycache__/manifest.cpython-312.pyc

�

�2e5F����dZddlZddlZddlmZddlmZddlmZGd�de�ZGd�d	e	�Z
Gd
�de�ZGd�d
e	�Zejd�Zd�Zd�Zd�Zy)z-Create and edit manifest for session contents�N)�config)�log)�utilc��eZdZdZy)�
ManifestErrorz5
    Exception raised when problem with manifest
    N��__name__�
__module__�__qualname__�__doc__���4/usr/lib/python3/dist-packages/duplicity/manifest.pyrr ����	rrc�d�eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
e
Zd
�Zd�Z
d�Zd
�Zd�Zd�Zy)�Manifestz8
    List of volumes and information about each one
    Nc�J�d|_d|_i|_||_g|_y)z�
        Create blank Manifest

        @param fh: fileobj for manifest
        @type fh: DupPath

        @rtype: Manifest
        @return: manifest
        N)�hostname�
local_dirname�volume_info_dict�fh�
files_changed)�selfrs  r�__init__zManifest.__init__-s*����
�!��� "��������rc��tj|_tjj|_|j
r|jr6|j
j
d|jj�z�|jr1|j
j
dt|j�z�|S)z�
        Set information about directory from config,
        and write to manifest file.

        @rtype: Manifest
        @return: manifest
        �Hostname %s
�Localdir %s
)	rr�
local_path�namerr�write�encode�Quote�rs r�set_dirinfozManifest.set_dirinfo=s�������
�#�.�.�3�3����7�7��}�}����
�
�.����1E�1E�1G�G�H��!�!����
�
�.��t�7I�7I�1J�J�K��rc���tjry|jr�|jtjk7r�|jtjk7r�t	d�tj|jfz}t
jj}tjtj��dtj|j���}n�|jr�|jtjjk7r�t	dtjj�dtj|j����}t
jj }tjtjj��dtj|j���}nytj"|dzt	d�z||�y)z�
        Return None if dirinfo is the same, otherwise error message

        Does not raise an error message if hostname or local_dirname
        are not available.

        @rtype: string
        @return: None or error message
        NzWFatal Error: Backup source host has changed.
Current hostname: %s
Previous hostname: %s� zEFatal Error: Backup source directory has changed.
Current directory: z
Previous directory: z

z�Aborting because you may have accidentally tried to backup two different data sets to the same remote location, or using the same archive directory.  If this is not a mistake, use the --allow-source-mismatch switch to avoid seeing this message)r�allow_source_mismatchr�fqdn�_r�	ErrorCode�hostname_mismatchr�escaperrr�uc_name�os�fsdecode�source_path_mismatch�
FatalError)r�errmsg�code�
code_extras    r�
check_dirinfozManifest.check_dirinfoNsx���'�'���=�=�T�]�]�f�o�o�=�$�-�-�SY�S^�S^�B^��q�����$�-�-�0�1�F��=�=�2�2�D� �K�K����8�9��4�;�;�t�}�}�;U�:V�W�J�
�
�
�D�$6�$6�&�:K�:K�:P�:P�$P��&�&,�&7�&7�&?�&?�%@�A'�')�{�{�4�3E�3E�'F�&G�I��F�
�=�=�5�5�D� �K�K��(9�(9�(>�(>�?�@��$�+�+�d�N`�N`�Ba�Ab�c�J�������
����	
�
��
	
rc	��|r||_|jrr|jjdt|j�z�|jD]1}|jjd|dt	|d�fz��3yy)N�Filelist %d
�
    %-7s  %s
�r)rrr �lenr")rr�fileinfos   r�set_files_changed_infozManifest.set_files_changed_info~sy���!.�D���7�7��G�G�M�M�*�S��1C�1C�-D�D�E� �.�.�
U�����
�
�/�8�A�;��h�q�k�@R�2S�S�T�
U�rc��|j}||j|<|jr-|jj|j	�dz�yy)z�
        Add volume info vi to manifest and write to manifest

        @param vi: volume info to add
        @type vi: VolumeInfo

        @return: void
        �
N)�
volume_numberrrr �	to_string)r�vi�vol_nums   r�add_volume_infozManifest.add_volume_info�sF���"�"��)+����g�&��7�7��G�G�M�M�"�,�,�.�5�0�1�rc�j�	|j|=y#t$rtdt|��d���wxYw)z�
        Remove volume vol_num from the manifest

        @param vol_num: volume number to delete
        @type vi: int

        @return: void
        zVolume z not present in manifestN)r�	Exceptionr�int)rrBs  r�del_volume_infozManifest.del_volume_info�s@��	R��%�%�g�.���	R��'�#�g�,��7O� P�Q�Q�	R�s�
�"2c����d}�jr |d�jj�zz
}�jr|dt�j�zz
}|dt	�j
�zz
}�j
D]}|d|dt|d�fzz
}�t
�jj��}�fd�}d	|d
jt||��fz}|S)z�
        Return string version of self (just concatenate vi strings)

        @rtype: string
        @return: self in string form
        rrrr7r8r9rc�>���j|j�S�N)rr@)rBrs �r�vol_num_to_stringz-Manifest.to_string.<locals>.vol_num_to_string�s����(�(��1�;�;�=�=rs%s%s
r>)rr!rr"r:r�sortedr�keys�join�map)r�resultr;�vol_num_listrKs`    rr@zManifest.to_string�s�������=�=��&����)=�)=�)?�?�?�F�����&��t�/A�/A�)B�B�B�F��"�S��);�);�%<�<�<���*�*�	L�H��'�8�A�;��h�q�k�8J�*K�K�K�F�	L��d�3�3�8�8�:�;��	>��f�e�j�j��5F��1U�&V�W�W���
rc�$���fd�}|d�|_|j�|jj�|_|d�|_d}d}tjdtj
�}|j
��}|D]t}t�j|jd��}|j|�|j}t||�}tjtd�|z��vt!|dz|dz�D]}	|j#|	��tj$td�|z�d}
t&j(�t&j*��&tjd	tj
tj,z�}|j/��}|rt1|jd
��}
|
dkDr;d�}t3t5||jd�j7d
���|_|
t;|j8�k7rltj<td|j>r|j>j@nd�dt1|
��dt;|j8�����d|_!|S)z<
        Initialize self from string s, return self
        c����t|t�s|j�}tjd|z�tj
�}|syt
|jd��S)zW
            Return the value of a field by parsing s, or None if no field
            s(^|\n)%s\s(.*?)
N�)�
isinstance�bytesr!�re�search�I�Unquote�group)�	fieldname�m�ss  �r�	get_fieldz'Manifest.from_string.<locals>.get_field�sR����i��/�%�,�,�.�	��	�	�0�9�<�a����F�A����q�w�w�q�z�*�*rr�localdirrs.(?:^|\n)(volume\s.*(?:\n.*)*?)(?=\nvolume\s|$)r9zFound manifest volume %szFound %s volumes in manifests-(^|\n)filelist\s([0-9]+)\n(.*?)(\nvolume\s|$)rTc�p�|j�j�}|ddj|dd�fS)Nrrr9)�strip�splitrN)�liner;s  r�parse_fileinfoz,Manifest.from_string.<locals>.parse_fileinfo�s4��#�z�z�|�1�1�3�H�#�A�;�����!�"��(>�>�>r�r>zManifest file '�z' is corrupt: File count says z, File list contains T)"r�decoderrW�compilerY�finditer�
VolumeInfo�from_stringr[rCr?�maxr�Debugr)�rangerG�Infor�file_changed�show_changes_in_set�SrXrF�listrOrcrr:�Errorr�base�corrupt_filelist)
rr^r_�highest_vol�
latest_vol�	vi_regexp�vi_iterator�matchrA�i�	filecount�filelist_regexpres
 `           rrlzManifest.from_string�s5���

	+�"�*�-��
��=�=�$� �M�M�0�0�2�D�M�&�z�2������
��J�J�U�WY�W[�W[�\�	��(�(��+�� �	B�E���)�)�%�+�+�a�.�9�B�� � ��$��)�)�J��k�:�6�K��I�I�a�2�3�j�@�A�	B��z�A�~�{�Q��7�	$�A�� � ��#�	$�����1�2�Z�?�@��	����*�f�.H�.H�.T� �j�j�)^�`b�`d�`d�gi�gk�gk�`k�l�O�#�*�*�1�-�E������A��/�	��1�}�?�&*�#�n�e�k�k�!�n�>R�>R�SX�>Y�*Z�%[��"��C�� 2� 2�3�3��	�	��)�$�'�'�$�'�'�,�,�r�)J�K+�+.�y�>�*:�:O�PS�TX�Tf�Tf�Pg�Oh�j���)-��%��rc��|jSrJ)rr#s r�get_files_changedzManifest.get_files_changeds���!�!�!rc��t|jj��}t|jj��}||k7rtjtd��yt
t|��D]-}||||k(r�tjtd��y|j|jk7s|j|jk7rtjtd��yy)zO
        Two manifests are equal if they contain the same volume infos
        z4Manifests not equal because different volume numbersFz/Manifests not equal because volume lists differz7Manifests not equal because hosts or directories differT)
rLrrMr�Noticer)ror:rr)r�other�vi_list1�vi_list2r}s     r�__eq__zManifest.__eq__s����$�/�/�4�4�6�7���%�0�0�5�5�7�8���x���J�J�q�O�P�Q���s�8�}�%�	�A��A�;�(�1�+�-��
�
�1�N�O�P��	�
�=�=�E�N�N�*�d�.@�.@�E�DW�DW�.W��J�J�q�R�S�T��rc�&�|j|�S)zN
        Defines !=.  Not doing this always leads to annoying bugs...
        �r��rr�s  r�__ne__zManifest.__ne__����;�;�u�%�%�%rc���|j�rJ�|jd�}|j|j��|j	�rJ�|j�y)z@
        Write string version of manifest to given path
        �wbN)�exists�openr r@�close�setdata)r�path�fouts   r�
write_to_pathzManifest.write_to_path sK���;�;�=� � ��y�y�����
�
�4�>�>�#�$��:�:�<������rc� �t|�dk(r-t|ddj�r|dj�f}t	|j
j
��D�cgc]"}|j
|j|�r|��$c}Scc}w)zM
        Return list of volume numbers that may contain index_prefix
        r9rrg)r:rU�	__class__r!rtrrM�contains)r�index_prefixrBs   r�get_containing_volumeszManifest.get_containing_volumes*s����|���!�j��a��"�,�,�&O�(��O�2�2�4�6�L� �� 5� 5� :� :� <�=�
���$�$�W�-�6�6�|�D�
�
�	
��
s�!'BrJ)r	r
rrrr$r5r<rCrGr@�__str__rlr�r�r�r�r�r
rrrr(sT��� � �".
�`U�2�R��2�G�A�F"��,&��

rrc��eZdZdZy)�VolumeInfoErrorzN
    Raised when there is a problem initializing a VolumeInfo from string
    Nrr
rrr�r�7rrr�c�L�eZdZdZd�Zd�Zd�Zd�Zd�ZeZ	d�Z
d�Zd	�Zdd
�Z
y)
rkz+
    Information about a single volume
    c�X�d|_d|_d|_d|_d|_i|_y)zVolumeInfo initializerN)r?�start_index�start_block�	end_index�	end_block�hashesr#s rrzVolumeInfo.__init__Ds/��!�����������������rc�L�||_||_||_||_||_|S)z�
        Set essential VolumeInfo information, return self

        Call with starting and ending paths stored in the volume.  If
        a multivol diff gets split between volumes, count it as being
        part of both volumes.
        )r?r�r�r�r�)r�
vol_numberr�r�r�r�s      r�set_infozVolumeInfo.set_infoMs/��(���&���&���"���"����rc��t|t�r|j�}t|t�r|j�}||j|<y)zF
        Set the value of hash hash_name (e.g. "MD5") to data
        N)rUrVrhr�)r�	hash_name�datas   r�set_hashzVolumeInfo.set_hash]s?���i��'�!�(�(�*�I��d�E�"��;�;�=�D�!%����I�rc���|jsy	d|jdfS#t$rYnwxYw	d|jdfS#t$rYnwxYwt|jj��dS)z�
        Return pair (hash_type, hash_data)

        SHA1 is the best hash, and MD5 is the second best hash.  None
        is returned if no hash is available.
        N�SHA1�MD5r)r��KeyErrorrt�itemsr#s r�
get_best_hashzVolumeInfo.get_best_hashgs����{�{��	��4�;�;�v�.�.�.���	��	��	��$�+�+�e�,�,�,���	��	���D�K�K�%�%�'�(��+�+s� �	,�,�A�	A
�A
c���d�}d�}d|jzg}d}|jd|||j�||j�fz�|jd|||j�||j
�fz�|jD]B}|jd||j�|j|j�fz��Ddj|�S)	zJ
        Return nicely formatted string reporting all information
        c�@�|rdj|�}t|�Sy)z8Return printable version of index without any whitespace�/�.)rNr")�indexr^s  r�index_to_stringz-VolumeInfo.to_string.<locals>.index_to_strings����I�I�e�$���Q�x��rc�:�|�yt|�j�S)N� )�strr!)�xs r�bfmtz"VolumeInfo.to_string.<locals>.bfmt�s���y���q�6�=�=�?�"rs
Volume %d:s    s%sStartingPath   %s %ss%sEndingPath     %s %ss%sHash %s %sr>)	r?�appendr�r�r�r�r�r!rN)rr�r��slist�
whitespace�keys      rr@zVolumeInfo.to_stringzs���
	�	#�
��!3�!3�3�4���
�
���%��_�T�EU�EU�5V�X\�]a�]m�]m�Xn�(o�o�	
�	���.�*�o�d�n�n�>]�_c�dh�dr�dr�_s�1t�t�u��;�;�	b�C��L�L��J��
�
��d�k�k�RU�FV�F]�F]�F_�+`�`�a�	b��z�z�%� � rc�N�d�}|j�jd�}tjd|dtj�}|std|d�d���t
|jd��|_|ddD]�}|s�|j�j�}|dj�}|dd}|d	k(r tjtd
��n�|dk(r:||d�|_
t|�dkDrt
|d�|_��d|_��|dk(r:||d�|_t|�dkDrt
|d�|_��d|_��|d
k(s��|j%|d|d���|j�|j �td��|S)zG
        Initialize self from string s as created by to_string
        c�X�t|�}|dk(ryt|jd��S)z8
            Return tuple index from string
            r�r
r�)rZ�tuplerc)r^s r�string_to_indexz/VolumeInfo.from_string.<locals>.string_to_index�s*����
�A��D�y��������'�'rr>s^Volume ([0-9]+):rzBad first line '�'r9NsVolumez&Warning, found extra Volume identifiersstartingpaths
endingpathshashzStart or end index not set)rbrcrWrXrYr�rFr[r?�lowerr�Warnr)r�r:r�r�r�r�)	rr^r��linelistr]rd�
line_split�
field_name�other_fieldss	         rrlzVolumeInfo.from_string�s���
	(��7�7�9�?�?�5�)��
�I�I�*�H�Q�K����>���!�$4�X�a�[�M��"C�D�D� ������_����Q�R�L�	@�D�������+�+�-�J�#�A��,�,�.�J�%�a�b�>�L��Y�&�����C�D�E����.�#2�<��?�#C�� ��|�$�q�(�'*�<��?�';�D�$�'+�D�$��}�,�!0��a��!A����|�$�q�(�%(��a��%9�D�N�%)�D�N��w�&��
�
�l�1�o�|�A��?�-	@�0���#�t�~�~�'=�!�">�?�?��rc��t|t�stjt	d��y|j
|j
k7rtjt	d��y|j|jk7rtjt	d��y|j|jk7rtjt	d��yt|jj��}t|jj��}||k7rtjt	d��yy)z$
        Used in test suite
        zOther is not VolumeInfoNzVolume numbers don't matchzstart_indicies don't matchzend_index don't matchzHashes don't matchr9)rUrkrr�r)r?r�r�rLr�r�)rr��
hash_list1�
hash_list2s    rr�zVolumeInfo.__eq__�s����%��,��J�J�q�2�3�4������!4�!4�4��J�J�q�5�6�7�����u�0�0�0��J�J�q�5�6�7���>�>�U�_�_�,��J�J�q�0�1�2���D�K�K�-�-�/�0�
��E�L�L�.�.�0�1�
���#��J�J�q�-�.�/��rc�&�|j|�S)z
        Defines !=
        r�r�s  rr�zVolumeInfo.__ne__�r�rc��|r0|jdt|�|cxkxr|jkScS|j|cxkxr|jkScS)a
        Return true if volume might contain index

        If recursive is true, then return true if any index starting
        with index_prefix could be contained.  Otherwise, just check
        if index_prefix itself is between starting and ending
        indicies.
        N)r�r:r�)rr��	recursives   rr�zVolumeInfo.contains�sT����#�#�$7�c�,�&7�8�L�Z�D�N�N�Z�Z�Z�Z��#�#�|�E�t�~�~�E�E�E�ErN)r9)r	r
rrrr�r�r�r@r�rlr�r�r�r
rrrkrk?s=����� &�,�&!�8�G�1�f�.&�Frrks(\s|[\\"'])c�(�tj|�s|Sg}tdt|��D]N}|||dz}tj|�r|j	dt|�z��>|j	|��Pddj
|�zS)zM
    Return quoted version of s safe to put in a manifest or volume info
    rr9s\x%02xs"%s"r)�nonnormal_char_rerXror:r��ordrN)r^r�r}�chars    rr"r"�s����#�#�A�&����E�
�1�c�!�f�
�����Q��U�|���#�#�D�)��L�L��c�$�i�/�0��L�L�����S�X�X�e�_�$�$rc��t|�SrJ)�chr)�chs r�	maybe_chrr�
s���r�7�Nrc���t|d�dk(rt|d�dk(r|S|d|dk(sJ�g}d}|t|�dz
kr�|||dz}|dk(r_t||dz�dk(sJ�|jt||dz|d	zj	�d
�jdd���|d	z
}n|j|�|dz
}|t|�dz
kr��d
j
|�S)zE
    Return original string from quoted_string produced by above
    r�"r����r9�\r�rT���big)�	byteorderr)r�r:r�rFrh�to_bytesrN)�
quoted_string�return_listr}r�s    rrZrZs���]�1�%�&�#�-��=��;K�1L�PS�1S������}�R�0�0�0�0��K�	�A�
�c�-� �1�$�
$��Q��Q��'���5�=��]�1�q�5�1�2�c�9�9�9����s�=��Q���Q��#?�#F�#F�#H�"�M�V�V�WX�di�V�j�k�
��F�A����t�$�
��F�A��c�-� �1�$�
$��8�8�K� � r)rr.rW�	duplicityrrrrEr�objectrr�rkrir�r"r�rZr
rr�<module>r�st��,4�	�	����	�I�	�L
�v�L
�^	�i�	�uF��uF�p�B�J�J�1�2��
%� �!r

Zerion Mini Shell 1.0