%PDF- %PDF-
Mini Shell

Mini Shell

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

�

�2e,����ddlZddlZddlZddlZddlZddlZddlZddlmZddlZddl	m
Z
ddl	mZddl	mZddl	m
Z
ddl	mZddl	mZdd	l	mZdd
l	mZddl	mZddl	mZdd
l	mZddl	mZddl	mZddl	mZddl	mZddl	mZddl	mZddl	mZddlmZdad�Zd5d�Z d�Z!d�Z"d�Z#d�Z$d�Z%d�Z&d�Z'd�Z(d �Z)d6d!�Z*d"�Z+d#�Z,d$�Z-d%�Z.d&�Z/d'�Z0d(�Z1d)�Z2d*�Z3d+�Z4d,�Z5d-�Z6d.�Z7d/�Z8ejrfd0�Z:Gd1�d2e;�Z<d3�Z=d4�Z>y)7�N)�datetime)�__version__)�asyncscheduler)�cli_main)�config)�diffdir)�dup_collections)�dup_temp)�dup_time)�errors)�file_naming)�gpg)�log��manifest)�patchdir)�path)�progress)�tempdir)�util)�BadVolumeExceptionc�4�ddl}ddl}|j|�S�Nr)�getpass�locale)�messagerrs   �4/usr/lib/python3/dist-packages/duplicity/dup_main.py�getpass_saferDs�����?�?�7�#�#�c��	|rtjdStjdS#t$rYnwxYw|r�tjj
tjjvs4tjj
tjjvrCdtjvr1tjtd��tjdS|s�tjj
tjjvs4tjj
tjjvrCdtjvr1tjtd��tjdStjrtjry|dvry|dk(ratjjstjjr-tjj
rtjs|sy|dk(ratjjstjjr-tjj
rtjs|sytjtd	��d
}	|r=|dk(r8|rtjj}n�tjj }n�|rO|r5tjjrtjj}nft#td��d
��}nN|r5tjj rtjj }nt#td��d
��}|dk(r|}n+|rt#td��}nt#td��}||k(s3tj$td�tj&d
��d}��J|sitjjsOtjjs5|s3tj$td�tj&d
��d}���|S)a^
    Check to make sure passphrase is indeed needed, then get
    the passphrase from environment, from gpg-agent, or user

    If n=3, a password is requested and verified. If n=2, the current
    password is verified. If n=1, a password is requested without
    verification for the time being.

    @type  n: int
    @param n: verification level for a passphrase being requested
    @type  action: string
    @param action: action to perform
    @type  for_signing: boolean
    @param for_signing: true if the passphrase is for a signing key, false if not
    @rtype: string
    @return: passphrase
    �SIGN_PASSPHRASE�
PASSPHRASEz.Reuse configured PASSPHRASE as SIGN_PASSPHRASEz.Reuse configured SIGN_PASSPHRASE as PASSPHRASE�)�collection-status�list-current-files�remove-all-but-n-full�remove-all-inc-of-but-n-full�
remove-old�full�incz)PASSPHRASE variable not set, asking user.T�z!GnuPG passphrase for signing key:� z GnuPG passphrase for decryption:�z.Retype passphrase for signing key to confirm: z-Retype passphrase for decryption to confirm: z=First and second passphrases do not match!  Please try again.��force_printFzICannot use empty passphrase with symmetric encryption!  Please try again.)�os�environ�KeyErrorr�gpg_profile�sign_key�
recipients�hidden_recipientsr�Notice�_�
encryption�	use_agent�restart�Info�signing_passphrase�
passphraser�Log�WARNING)�n�action�for_signing�	use_cache�pass1�pass2s      r�get_passphraserGKsD��(
���:�:�/�0�0��:�:�l�+�+���
��
��	����'�'�6�+=�+=�+H�+H�H��!�!�*�*�f�.@�.@�.R�.R�R��B�J�J�&��
�
�1�E�F�G��z�z�,�'�'�
����'�'�6�+=�+=�+H�+H�H��!�!�*�*�f�.@�.@�.R�.R�R�����+��
�
�1�E�F�G��z�z�+�,�,����� 0� 0��
��
��
	�&��
�
�
�
*�
*�f�.@�.@�.R�.R��#�#�,�,�V�^�^�K��
	�%��
�
�
�
*�
*�f�.@�.@�.R�.R��#�#�,�,�V�^�^�K��	����>�?�@��	���Q�!�V��"�.�.�A�A�E�"�.�.�9�9�E�� �V�%7�%7�%J�%J� &� 2� 2� E� E�� ,��2U�0V�/W�WX�-Y� Z�� �V�%7�%7�%B�%B� &� 2� 2� =� =�� ,��2T�0U�/V�VW�-X� Y���A�v����$�Q�'W�%X�Y��$�Q�'V�%W�X���E�>�����U�V�X[�Xc�Xc�qu��"�	����+�+�6�6�&�:L�:L�:^�:^�#�����a�b��K�K� $��
"�	���Ls�*�*�	6�6c��	t|�r
	t|�r�
tjdtj
j�y#t$rY�:wxYw)z�
    Fake writing to backend, but do go through all the source paths.

    @type tarblock_iter: tarblock_iter
    @param tarblock_iter: iterator for current tar block

    @rtype: int
    @return: constant 0 (zero)
    Nr)�next�
StopIterationr�Progressr�stats�SourceFileSize)�
tarblock_iters r�dummy_backuprO�sM��
��=�!���=�!��L�L��w�}�}�3�3�4����
��
�s�A	�		A�Ac�.�tjj}tjj}	t	|�}|r�|j
|k(r-|s
|jsy|r|jr|j|kDry|j
|kDr~tjtd�tj|�tj|j
�fztjj�|j|�yt	|�}|r��yy#t$rotjtd�tj|�tj|j
�fztjj�YywxYw)ay
    Fake writing to backend, but do go through all the source paths.
    Stop when we have processed the last file and block from the
    last backup.  Normal backup will proceed at the start of the
    next volume in the set.

    @type tarblock_iter: tarblock_iter
    @param tarblock_iter: iterator for current tar block

    @rtype: int
    @return: constant 0 (zero)
    z>File %s complete in backup set.
Continuing restart on file %s.z=File %s missing in backup set.
Continuing restart on file %s.N)rr;�
last_index�
last_blockrI�previous_index�previous_blockr�Warnr8r�uindex�	ErrorCode�restart_file_not_found�queue_index_datarJ)rNrQrR�iter_results    r�restart_position_iteratorr[�s?�����*�*�J����*�*�J�
��=�)����+�+�z�9�"�-�*F�*F���-�">�">�=�C_�C_�bl�Cl���+�+�j�8�����Z�[��{�{�:�.����M�<X�<X�0Y�Z�[��M�M�8�8���.�.�{�;���}�-�K�'��(�
����
�Q�R��{�{�:�&����M�4P�4P�(Q�R�
S��M�M�0�0�	
�
�s%�*D�!D�?BD�
D�A5F�Fc������d�}�fd����fd���fd�}tjs*d}tj|��}|j	��n�tjj
j
�}tjj|�tjj|�tjsBtjs2tjs"|tjj
|�ntjtd��||_tjj }	tj"td�tjj$t'j(tjj*�tjj fz�tjj$}t-|�d}
d}tj.r@t.j0j3|d	z�t.j4j7�tj8d	ksJ�t;j<tj8�}g}
|
�sK|j?�|d	z
}tAjB�|tjDtjF�
�}tIjJtAjL|��}tjDr?tOjP||jRtjTtjV�}
notjFr0tOjX||jRtjV�}
n/tOjZ||jRtjV�}
|j]�tj^�}|j`|g||����|jcdtOjdd|��|jg|�|d	k(r!|ji�|ji�n |jk�|jk�tjlr�tnjpjrdk(rz|
rx|d	k(rstd�}tjt|tnjpjv�tj"t|��d
t_<|j{�n�|
j}|j�fd�|||f��tjttd�|ztnjpjv�tj.rt.j0j�|�tj�|k7sJdt�|�����|
s��K|
D]}||�z
}�|j�tnjpj���|S)a�
    Encrypt volumes of tarblock_iter and write to backend

    backup_type should be "inc" or "full" and only matters here when
    picking the filenames.  The path_prefix will determine the names
    of the files written to backend.  Also writes manifest file.
    Returns number of bytes written.

    @type backup_type: string
    @param backup_type: type of backup to perform, either 'inc' or 'full'
    @type tarblock_iter: tarblock_iter
    @param tarblock_iter: iterator for current tar block
    @type backend: callable backend object
    @param backend: I/O backend for selected protocol

    @rtype: int
    @return: bytes written
    c��|j�\}}|�d}d}|r|dz}|j�\}}|�|}|}|r|dz}||||fS)z3Return start_index and end_index of previous volumeN�r-)�recall_index�get_previous_index)rN�start_index�start_block�	end_index�	end_blocks     r�get_indiciesz$write_multivol.<locals>.get_indicies2sp��#0�#=�#=�#?� ��[����K��K���1��K�,�?�?�A��	�9���#�I�#�I����N�I��K��I�=�=rc	����j|g�|}|d}|�ytdtjdz�D]�}�j|g�|}|d}||k(rnh|�yt	j
t
d�tj�|tj|�|fz�tjd|z���||k7r~tj|��dt|��dt|���}t	jt
d�tj |�ztj"j$|�yy)N�sizer-zD%s Remote filesize %d for %s does not match local size %d, retrying.r+r,z$File %s was corrupted during upload.)�
query_info�ranger�num_retriesrr7r8r�nowr�escape�time�sleep�int�
FatalErrorr0�fsdecoderW�volume_wrong_size)�	orig_size�
dest_filename�inforg�attempt�
code_extra�backends      �r�validate_blockz&write_multivol.<locals>.validate_blockBs2����!�!�=�/�2�=�A���F�|���<���Q�� 2� 2�Q� 6�7�	#�G��%�%�}�o�6�}�E�D���<�D��y� ���|���J�J��X�Y��<�<�>�4����]�)C�Y�O�P�
�
�J�J�q�'�z�"�	#��9�� �K�K�
�6�7�q��Y��8H��#�d�)��U�J��N�N��8�9�B�K�K�
�<V�V��
�
�/�/��
�rc���|j�}tj|k7r�j||��||�|jr|j�|S)z�
        Retrieve file size *before* calling backend.put(), which may (at least
        in case of the localbackend) rename the temporary file to the target
        instead of copying.
        )�getsizer�skip_volume�put�stat�delete)�tdprt�vol_num�putsizerxrys    ��rr}zwrite_multivol.<locals>.put[sK����+�+�-������(��K�K��]�+��w�
�.��8�8��J�J�L��rc�2��tjjstjjrtjjsytj�dtjtj��}||jdk7r7tjtd�tjj�tjr9ttj ||j"d�}|j%�yy)a�
        When restarting a backup, we have no way to verify that the current
        passphrase is the same as the one used for the beginning of the backup.
        This is because the local copy of the manifest is unencrypted and we
        don't need to decrypt the existing volumes on the backend.  To ensure
        that we are using the same passphrase, we manually download volume 1
        and decrypt it with the current passphrase.  We also want to confirm
        that we're using the same encryption settings (i.e. we don't switch
        from encrypted to non in the middle of a backup chain), so we check
        that the vol1 filename on the server matches the settings of this run.
        Nr-��	encrypted�gzippedzQRestarting backup, but current encryption settings do not match original settings)rr3r5r6r4r
�getr9�compression�volume_name_dictrrpr8rW�enryption_mismatch�restore_get_enc_fileobjrx�volume_info_dict�close)�
backup_setr�
vol1_filename�fileobj�backup_types    �r�validate_encryption_settingsz4write_multivol.<locals>.validate_encryption_settingsis����
���)�)�V�-?�-?�-Q�-Q�[a�[m�[m�[v�[v�
�#����Q�&�BS�BS�]c�]o�]o�p�
��J�7�7��:�:��N�N��h�i��
�
�0�0�
����-�f�n�n�m�X�Mf�Mf�gh�Mi�j�G��M�M�O�rr)�fhz:Skipping encryption validation due to glacier/deep storagez-Restarting after volume %s, file %s, block %sr-r��SHA1z8Skipped volume upload, as effectivly nothing has changedTc����|||�S�Nr^)r�rtr�r}s   �r�<lambda>z write_multivol.<locals>.<lambda>�s����C��PW�8X�rzProcessed volume %dz'Forced assertion for testing at volume )Err;r�Manifest�set_dirinfo�last_backup�get_local_manifest�
checkManifest�setLastSaved�s3_use_deep_archive�s3_use_glacier�s3_use_glacier_irrrUr8r�rRr7�	start_volrrVrQr[r�tracker�set_start_volume�progress_thread�start�async_concurrencyr�AsyncScheduler�remember_next_indexr
r�r9r�r
�new_tempduppath�parser�GPGWriteFile�namer3�volsize�
GzipWriteFile�PlainWriteFile�setdata�
VolumeInfo�set_info�set_hash�get_hash�add_volume_info�
to_partial�flush�skip_if_no_changerrL�DeltaEntriesrKrM�skipped_incr�append�
schedule_task�snapshot_progress�fail_on_volumero�set_files_changed_info�get_delta_entries_file)r�rN�	man_outfp�	sig_outfprxrer�r��mfrR�at_end�
bytes_written�io_scheduler�
async_waitersrtr��vi�msg�waiterr}rys`   `              @@r�write_multivolr�sH���(>� �2��<�>�>���
�
�
�)�
,��
�����^�^�
'�
'�
:�
:�
<�����$�$�R�(����#�#�B�'��*�*�f�.C�.C�v�G_�G_�(����)C�)C�R�H��H�H�Q�S�T�U�����^�^�.�.�
��
�
�
�=�>��~�~�'�'����V�^�^�5N�5N�)O�QW�Q_�Q_�Qj�Qj�k�
l�	
��.�.�*�*��!�-�0�
�F��M�������)�)�'�A�+�6�� � �&�&�(��#�#�q�(�(�(�!�0�0��1I�1I�J�L��M���)�)�+�	�1���#����W��HY�HY�ci�cu�cu�v�
��&�&�{�'8�'8��'G�H������%�%�m�S�X�X�v�?Q�?Q�SY�Sa�Sa�b�F�
�
�
��&�&�}�c�h�h����O�F��'�'�
�s�x�x����P�F����
��
 �
 �
"������G�:�l�=�9�:�
���F�C�L�L���5�6�
���2���a�<�� � �"�� � �"��O�O���O�O���#�#��
�
�(B�(B�a�(G�F�W^�bc�Wc��N�P�C��L�L��g�m�m�:�:�;��J�J�q��v��!%�F���J�J�L�
� � ��*�*�X�[^�`m�ov�Zw��
�
�L�L��0�1�G�;�W�]�]�=Y�=Y�Z����� � �2�2�7�;��(�(�G�3�m�7^�_b�cj�_k�^l�5m�m�3�q�x �"�����!�
�"�
���g�m�m�B�B�D�E��rc��|dk(s|dk(sJ�tj|dd��}tj|d��}tj|dtj��}t	j
tj|||�}|S)a5
    Return a fileobj opened for writing, save results as manifest

    Save manifest in config.archive_dir_path gzipped.
    Save them on the backend encrypted as needed.

    @type man_type: string
    @param man_type: either "full" or "new"

    @rtype: fileobj
    @return: fileobj opened for writing
    r)r*T)r�partialr)rr�)r
r�rr9r
�get_fileobj_duppath�archive_dir_path)r��part_man_filename�perm_man_filename�remote_man_filenamer�s     r�get_man_fileobjr��s����&� �K�5�$8�8�8�#����d�D�Q��#����d�C��%�/�/�+��PV�Pa�Pa�b��	�	%�	%����!2�4E�GZ�
�B��Irc�(�|dvsJ�tj|dd��}tj|d��}tj|tjtj��}tjtj|||d��}|S)a;
    Return a fileobj opened for writing, save results as signature

    Save signatures in config.archive_dir gzipped.
    Save them on the backend encrypted as needed.

    @type sig_type: string
    @param sig_type: either "full-sig" or "new-sig"

    @rtype: fileobj
    @return: fileobj opened for writing
    ��full-sig�new-sigFT�r�r��r�r���	overwrite�r
r�rr9r�r
r�r�)�sig_type�part_sig_filename�perm_sig_filename�remote_sig_filenamer�s     r�get_sig_fileobjr�s����.�.�.�.�#����%��N��#����$�?��%�/�/�(�f�>O�>O�Y_�Yk�Yk�l��	�	%�	%����!2�4E�GZ�fj�
�B��Irc�(�|dvsJ�tj|dd��}tj|d��}tj|tjtj��}tjtj|||d��}|S)a<
    Return a fileobj opened for writing, save statistic as json

    Save statistics in config.archive_dir gzipped.
    Save them on the backend encrypted as needed.

    @type stat_type: string
    @param stat_type: either "full-stat" or "new-stat"

    @rtype: fileobj
    @return: fileobj opened for writing
    )�	full-stat�inc-statFTr�r�r�r�r�)�	stat_type�part_stat_filename�perm_stat_filename�remote_stat_filenamer�s     r�get_stat_fileobjr�,s����1�1�1�1�$����E�4�P��$����D�A��&�?�?�9��@Q�@Q�[a�[m�[m�n��	�	%�	%����!3�5G�I]�im�
�B��Irc�N�tjr�tj�t_t	j
tj�}t|�tjjtjd�tj�tj�t_
tjrBt	j
tj�}t|�}|jd���nrt!d�}t#d�}t	j$tj|�}t'd|||tj(�}|j+�|j-�|j/�|j+�|j-�|j/�tjr�dtj_tjj3�t5j6ddtjj8tjj;�tjj<d�|jd��t?d	||�tAtj|�y)
z�
    Do full backup of directory to backend, using archive_dir_path

    @type col_stats: CollectionStatus object
    @param col_stats: collection status

    @rtype: void
    @return: void
    TN��sig_chain_warningr�r)�Y@rFr�)!rr�ProgressTrackerr�r�DirFull�selectrO�set_evidencerLr�
set_selection�LogProgressThreadr��dry_run�
set_valuesr�r��DirFull_WriteSigr�rxr��	to_remote�to_final�finished�joinr�TransferProgress�total_bytecount�total_elapsed_seconds�speed�write_json_stat�print_statistics)�	col_statsrNr�r�r�s     r�full_backuprEs������#�3�3�5�������
�
�6�
��]�#����%�%�g�m�m�T�:�	��� �#+�#=�#=�#?�� �
�~�~�����
�
�6�
�$�]�3�
����t��4�#�J�/�	�#�F�+�	��0�0����	�J�
�&�v�}�i��TZ�Tb�Tb�c�
�	������������	�������������?�?�04�H�$�$�-��$�$�)�)�+�� � ���� � �0�0�� � �6�6�8�� � �&�&��

�	���t��4��K��	�:��W�]�]�M�2rc�,�|jsztjdk(rHtjs8t	j
t
d�tjj�yt	jt
d��y|jdS)z�
    Get last signature chain for inc backup, or None if none available

    @type col_stats: CollectionStatus object
    @param col_stats: collection status
    r*zdFatal Error: Unable to start incremental backup.  Old signatures not found and incremental specifiedz.No signatures found, switching to full backup.Nr)
�matched_chain_pairrrB�implied_incrrpr8rW�inc_without_sigsrU�rs r�check_sig_chainr�sw���'�'��=�=�E�!�&�*<�*<��N�N��I���
�
�.�.�
��
�H�H�Q�G�H�I���'�'��*�*rc���tjrd|tj_tjjt
d��}tj|tjd��yy)zp
    If config.print_statistics, print stats after adding bytes_written

    @rtype: void
    @return: void
    zBackup StatisticsTr.N)
rrrrL�TotalDestinationSizeChange�get_stats_logstringr8rr?�NOTICE)rLr��	logstrings   rrr�sL�����3@��
�
�0��M�M�5�5�a�8K�6L�M�	����	�3�:�:�4�8�rc�D�tjs�tj|j�tj
tjk(rQtjd�tj�tj
tjk7sJd��tjr�tj�t_tjtj|j!��}t#|�tjj%tj&d�t)j*�tj,�t_tj0r?tjtj|j!��}t#|�}�n�t3d�}t5d�}tj6tj|j!�|�}t9d|||tj:�}tj<sa|j?�|jA�|jC�|j?�|jA�|jC�n@|j?�|jE�|j?�|jE�tjr�dtj._#tj.jI�tKjLddtjjNtjjQ�tjjRd�tUd	||�tWtj&|�y
)zs
    Do incremental backup of directory to backend, using archive_dir_path

    @rtype: void
    @return: void
    r+zBtime not moving forward at appropriate pace - system clock issues?Fr�r*Tr�rr�N),rr;r�setprevtime�end_time�curtime�prevtimermrn�
setcurtimerr�r�r�DirDeltar��get_fileobjsrOr�rLrr�r�r�r�r�r��DirDelta_WriteSigr�rxr�r�r�r��clean_upr�r�rr�r�r�r�r�r)�	sig_chainrrNr��
new_sig_outfp�
new_man_outfps      r�incremental_backupr�sz���>�>����Y�/�/�0����x�0�0�0��J�J�q�M����!�� � �H�$5�$5�5�
T�S�
T�5����#�3�3�5����(�(����	�8N�8N�8P�Q�
��]�#����%�%�g�m�m�U�;�	��� �#+�#=�#=�#?�� �
�~�~��(�(����	�8N�8N�8P�Q�
�$�]�3�
�'�	�2�
�'��.�
��1�1�&�-�-��AW�AW�AY�[h�i�
�&�u�m�]�M�[a�[i�[i�j�
��!�!�
���!��#�#�%��"�"�$�
���!��#�#�%��"�"�$�
���!��"�"�$����!��"�"�$��?�?�04�H�$�$�-��$�$�)�)�+�� � ���� � �0�0�� � �6�6�8�� � �&�&��

��J�
�y�9��W�]�]�M�2rc���tjr�tjj	|�}tj|t
jd��tjs�t|�}|tj_
|j|j��|j�tjs!|j�|j!�y|j#�yyy)ai
    If "--jsonstat" is given in the command line, write extra statistic file.

    @type stat_type: string
    @param stat_type: Name of the json_stat should be full-stat or inc-stat
    @type bytes_written: int
    @param bytes_written: no of bytes written, in this run
    @type col_stats: CollectionStatus object
    @param col_stats: collection status
    Tr.N)r�jsonstatrrL�get_stats_jsonrr?rr�r�r
�write�encoder�r�r�r�r)r�r�r�	json_stat�
stat_outfps     rr�r��s�������M�M�0�0��;�	����	�3�:�:�4�8��~�~�)�)�4�J�7D�G�M�M�4����Y�-�-�/�0������%�%��$�$�&��#�#�%��#�#�%��rc��tjxstj}|j	|�}tj|j|��}|D]�}|jdk7s�tj|j���dtj|j����}tj|j���dtj |j���d|j"��}t%j&|t$j(t$j*j,|d���y)z�
    List the files current in the archive (examining signature only)

    @type col_stats: CollectionStatus object
    @param col_stats: collection status

    @rtype: void
    @return: void
    �deletedr,TN)r�restore_timerr�get_signature_chain_at_timer�get_combined_path_iterr�difftype�timetopretty�getmtimer0rq�get_relative_path�timetostringrrl�typerr?�INFO�InfoCode�	file_list)rrmr�	path_iterr�	user_info�log_infos       r�list_currentr4s�����2�(�"2�"2�D��5�5�d�;�I��.�.�y�/E�/E�d�/K�L�I��Q���=�=�I�%�#�0�0������A�B�!�B�K�K�Pf�PT�Pf�Pf�Ph�Di�Cj�k�I�"�/�/�
��
�
��@�A��4�;�;�Oe�t�Oe�Oe�Og�Ch�Bi�ij�ko�kt�kt�ju�v�H��G�G�I�s�x�x����)?�)?��4�P�	Qrc���tjrt|�ytjtj
t|��s�tjr\tjtd�tjtj�ztjj�ytjtd�tjj�yy)z�
    Restore archive in config.backend to config.local_path

    @type col_stats: CollectionStatus object
    @param col_stats: collection status

    @rtype: void
    @return: void
    Nz,%s not found in archive - no files restored.z-No files found in archive - nothing restored.)rr��restore_get_patched_rop_iterr�
Write_ROPaths�
local_path�restore_pathrrpr8r0rqrW�restore_path_not_found�no_restore_filesrs r�restorer<s����~�~�$�Y�/���!�!�&�"3�"3�5Q�R[�5\�]�����N�N��@�A�R�[�[�QW�Qd�Qd�Ee�f��
�
�4�4�
�

�N�N�1�L�M�s�}�}�Om�Om�n�^rc��
���tjr)ttjjd���nd�tjxst
j}|j|�}|sJ|j��|j|�}d�|D]}�t|�z
��dg�
�
��fd�}ttjd�stjr�g}|D]I}|j�}|j��}	|	D] }
|j!|j"|
��"�Ktjr/t%j&ddj)d�|D��z�y	tjj+|�t-t/||��}t-t/t0j2|��}t1j4|��S)
z�
    Return iterator of patched ROPaths of desired restore data

    @type col_stats: CollectionStatus object
    @param col_stats: collection status
    �/r^rc3�l�K�|j�}|j��}|D]n}	t|j|j||j
|����dxxdz
cc<tjtd��d�fz�d���py#t$r}|��Yd}~�Md}~wwxYw�w)z<Get file object iterator from backup_set contain given indexNrr-zProcessed volume %d of %d)
�get_manifest�get_containing_volumesr�rxr�r�rrrKr8)r�r�volumesr��e�cur_vol�index�num_volss     ���r�get_fileobj_iterz6restore_get_patched_rop_iter.<locals>.get_fileobj_iterHs�������*�*�,��1�(�1�1�%�8���		h�G�
�-��&�&�
�(C�(C�G�(L�h�Ng�Ng�ho�Np���
�A�J�!�O�J��L�L��6�7�7�1�:�x�:P�P�RY�Z[�R\�^f�g�		h��
&�
����
�s.�(B4�3B�;B4�	B1�#B,�'B4�,B1�1B4�pre_process_download_batchzRequired volumes to restore:
	z
	c3�<K�|]}|j����y�wr�)�decode)�.0�	file_names  r�	<genexpr>z/restore_get_patched_rop_iter.<locals>.<genexpr>_s����Gw�_h�	�HX�HX�HZ�Gw�s�N)rr9�tuple�splitr%rr�get_backup_chain_at_time�all_backup_chains�get_sets_at_time�len�hasattrrxr�r@rAr�r�rr7r�rH�list�mapr�TarFile_FromFileobjs�tarfiles2rop_iter)rrm�backup_chain�backup_setlist�srG�
file_namesr�rrBr��
fileobj_iters�tarfilesrDrErFs             @@@rr6r64s��������f�)�)�/�/��5�6�������2�(�"2�"2�D��5�5�d�;�L��4��4�4�4�<�!�2�2�4�8�N��H�
����C��F�����c�G�
h��v�~�~�;�<�����
�(�	H�J�!�.�.�0�H�5�h�5�5�e�<�G�"�
H���!�!�*�"=�"=�g�"F�G�
H�	H�
�>�>��J�J�9�F�K�K�Gw�lv�Gw�<w�w�x���N�N�5�5�j�A���-�~�>�?�M��C��5�5�}�E�F�H��%�%�h��6�6rc
���tdtjdz�D]�}	tj|�}tj|�}|j||�	t||�\}}}|r�n;td�|dz�dtj|��dtd�|z�dtd�|dz�d�}	tj|	tjj����tj r�t"j$j'd	tj|����}
tj(td
�|
j*j,t/j0|
�fz�n/tj2	tjj��j5d�}j6r%tj8j:rt=|�|S)aH
    Return plaintext fileobj from encrypted filename on backend

    If volume_info is set, the hash of the file will be checked,
    assuming some hash is available.  Also, if config.sign_key is
    set, a fatal error will be raised if file not signed by sign_key.

    with --ignore-errors set continue on hash mismatch

    r-z)Invalid data - %s hash mismatch for file:rz
 zCalculated hash: %szManifest hash: %s�
)�codezHash mismatch for: z;IGNORED_ERROR: Warning: ignoring error as requested: %s: %s�rb)rirrjr
r�r
r�r��restore_check_hashr8r0rqr�ErrorrW�mismatched_hash�
ignore_errors�	duplicityrrrU�	__class__�__name__r�uexcrp�filtered_open_with_deleter�r3r4�restore_add_sig_check)rx�filename�volume_inforA�parseresultsr��verified�	hash_pair�calculated_hash�	error_msg�excr�s            rr�r�is����1�f�(�(�1�,�
-�J��!�"�(�(��2���&�&�|�4�����H�c�"�.�/A�+�s�/S�,��)�_����=�>��1��M����H�%��'�(�?�:��%�&��1��5�	�I�
�I�I�i�c�m�m�&C�&C�D�#J�&����"�"�5�5�8K�B�K�K�X`�La�Kb�6c�d�C��H�H��O�P��=�=�)�)�4�9�9�S�>�:�;�
�

�N�N�9�3�=�=�+H�+H�I��+�+�D�1�G����&�"4�"4�"=�"=��g�&��Nrc�~�|j�}|r&tj|d|�}||dk7rd||fS	d|fS)z�
    Check the hash of vol_path path against data in volume_info

    @rtype: boolean
    @return: true (verified) / false (failed)
    rr-FT)�
get_best_hashrr�)rn�vol_pathrqrrs    rrcrc�sR���)�)�+�I���,�,�y��|�X�>���i��l�*��)�_�4�4�-���O�+�+rc���t�tj�r$t�jtj
�sJ����fd�}�j
|�y)zo
    Require signature when closing fileobj matches sig in gpg_profile

    @rtype: void
    @return: void
    c�`���jj�}|�dn|}tjj}|�dn|}tt
|�t
|��}||d||dk7rCtjtd�||d||dfztjj�yy)z"Thunk run when closing volume fileN�Nonez#Volume was signed by key %s, not %s)r��
get_signaturerr3r4�minrSrrpr8rW�unsigned_volume)�
actual_sigr4�ofsr�s   �r�check_signaturez.restore_add_sig_check.<locals>.check_signature�s�����_�_�2�2�4�
�)�1�V�z�
��%�%�.�.��%�-�6�8���3�z�?�C��M�2�2���c�d��x���~�-��N�N��7�8�J�s�t�<L�h�WZ�W[�n�;]�]��
�
�-�-�
�.rN)�
isinstancer
�
FileobjHookedr�r�GPGFile�addhook)r�r�s` rrlrl�sH����g�x�5�5�6�:�g�o�o�WZ�Wb�Wb�;c�l�el�l�c���O�O�O�$rc���tjt|�tj�}d}d}|D]q\}}|stj|j�}|stj|j�}|j|tj�s|dz
}|dz
}�stjtd�td�|ztd�|zfz�|dk\rda
yy)z�
    Verify files, logging differences

    @type col_stats: CollectionStatus object
    @param col_stats: collection status

    @rtype: void
    @return: void
    rr-zVerify complete: %s, %s.z%d file(s) comparedz%d difference(s) foundN)r�
collate2itersr6rr�r�ROPathrE�compare_verbose�compare_datarr7r8�exit_val)r�collated�
diff_count�total_count�
backup_ropath�current_paths      r�verifyr��s����$�$�%A�)�%L�f�m�m�\�H��J��K�'/��#�
�|�� �K�K��(:�(:�;�M���;�;�}�':�':�;�L��,�,�\�6�;N�;N�O��!�O�J��q�����J�J�	�
$�%��
"�#�k�1�1�5M�3N�Q[�3[�
\�	]���Q����rc�v�|j�\}}||z}|stjtd��ydj	ttj|��}tjr�tjtd��d|���tjsQ|jj|�|D]0}	tjj|�j��2yytjtd�dz|zdztd�z�y#t $rY�twxYw)z�
    Delete the extraneous files in the current backend

    @type col_stats: CollectionStatus object
    @param col_stats: collection status

    @rtype: void
    @return: void
    z6No extraneous files found, nothing deleted in cleanup.Nr`z$Deleting these file(s) from backend:z&Found the following file(s) to delete:z?Run duplicity again with the --force option to actually delete.)�get_extraneousrrUr8r�rVr0rqr�forcer7r�rxrr�r��	Exception)r�	ext_local�
ext_remote�
extraneous�filestr�fns      r�cleanupr��s��&�4�4�6��I�z��Z�'�J������K�L�M���i�i��B�K�K��4�5�G�
�|�|��
�
�a�>�?�@��7�)�L�M��~�~����$�$�Z�0��
����+�+�2�2�2�6�=�=�?�
��	�
�
�
�6�7��
��
��
��Q�R�	
S�	
��!����s�-D,�,	D8�7D8c��tj�J�|jtj�t_t	|�y)z�
    Remove backup files older than the last n full backups.

    @type col_stats: CollectionStatus object
    @param col_stats: collection status

    @rtype: void
    @return: void
    N)r�keep_chains�get_nth_last_full_backup_time�remove_time�
remove_oldrs r�remove_all_but_n_fullr�s7�����)�)�)�"�@�@��AS�AS�T�F���y�rc	��tj�J�d�}d�}|jtj�}|r5tjtd��d||��dtd����|jrH|jdjtjkrtjtd��|jtj�}tjd	k(rtd
�|D��}|stjtd��ytj�rUtjtd�dz||�z�||jtj�z
}|j�|D]�}tjd	k(r2t|t j"�rtd
�}n=td�}n1t|t j"�rtd�}ntd�}tj|t%j&|j�z�tj(r��|j+tjd	k(����|j-d��ytjtd�dz||�zdztd�z�y)z�
    Remove backup files older than config.remove_time from backend

    @type col_stats: CollectionStatus object
    @param col_stats: collection status

    @rtype: void
    @return: void
    Nc	��dj|D�cgc]%}tj|j����'c}�Scc}w)z.Return string listing times of sets in setlistr`)r�rr)�get_time)�setlistr[s  r�
set_times_strz!remove_old.<locals>.set_times_str s0���y�y�w�O�!�(�/�/��
�
��=�O�P�P��Os�*Ac��dj|D�cgc]!}tj|j���#c}�Scc}w)z2Return string listing times of chains in chainlistr`)r�rr)r)�	chainlistr[s  r�chain_times_strz#remove_old.<locals>.chain_times_str$s.���y�y�Y�O��(�/�/��
�
�;�O�P�P��Os�&=z#There are backup set(s) at time(s):r`z9Which can't be deleted because newer sets depend on them.r-z�Current active backup chain is older than specified time.  However, it will not be deleted.  To remove all your backups, manually purge the repository.r'c3�K�|]R}t|tj�r|js&t|tj�r|j
r|���Ty�wr�)r�r	�SignatureChain�inclist�BackupChain�incset_list)rK�xs  rrMzremove_old.<locals>.<genexpr>@sD����
���1�o�<�<�=�!�)�)��1�o�9�9�:�q�}�}�
�
�s�AAz*No old backup sets found, nothing deleted.z!Deleting backup chain(s) at time:z5Deleting any incremental signature chain rooted at %sz2Deleting any incremental backup chain rooted at %sz$Deleting complete signature chain %sz!Deleting complete backup chain %s)�	keep_fullr�z0Found old backup chain(s) at the following time:z5Rerun command with --force option to actually delete.)rr��get_older_than_requiredrrUr8rr�get_chains_older_thanrBrUr7r��get_signature_chains_older_than�reverser�r	r�rr)r�rr�)rr�r��req_listr��chain�
chain_descs       rr�r�sV�����)�)�)�Q�Q��0�0��1C�1C�D�H������7�8��h�'��M�N�	
�	
��#�#�	�(D�(D�Q�(G�(P�(P�SY�Se�Se�(e����
�1�
�	
��/�/��0B�0B�C�I�
�}�}�6�6��
��
�
�	���
�
�1�A�B�C��
�|�|��
�
�1�8�9�D�@�?�S\�C]�]�^��Y�>�>�v�?Q�?Q�R�R�	������	Z�E��}�}� >�>��e�_�%C�%C�D�!"�#Z�![�J�!"�#W�!X�J��e�_�%C�%C�D�!"�#I�!J�J�!"�#F�!G�J��J�J�z�H�$9�$9�%�.�.�$I�I�J��>�>�����
�
�9W�(W��Y�	Z� 	���t��4��
�
�
�@�A��
��i�(�
)��
��G�H�	
I�	
rc	�4�����gd���fd�}�fd�}d���fd��d�}��fd�}tjj�}||�\}}}tjj	�}	||	�\}
}}t|
j��}
t|j��}g}g}|D])}||
vs�||vs�
||�s�|j
||��+|
D]}||vs||vs�|j
|
|��!|s!|stjtd��y|j�|j�tjs�tjtd	��|r#|s|rtd
d�tj_|D]
}||��ttjd�rtjj!|�|D]
}||���j#�y|rKtjtd
�dzdj%t't(j*|��z�|rLtjtd�dzdj%t't(j*|��z�yy)z�
    Synchronize local archive manifest file and sig chains to remote archives.
    Copy missing files from remote to local as needed to make sure the local
    archive is synchronized to remote storage.

    @rtype: void
    @return: void
    )s.gs.gpgs.zs.gzs.partc����tjdk(rytjdk(sJ�tj|�}	�j	tj
xstj�}|j�|j�|jx}}n|j}|j}||jk\xr||jkS#tj$rYywxYw)z�Indicates if the metadata file should be synced.

        In full sync mode, or if there's a collection misbehavior, all files
        are needed.

        Otherwise, only the metadata for the target chain needs sync.
        r)Tr�)
r�metadata_sync_moder
r�rPr%rrr	�CollectionsError�
start_timerrm)rm�parsed�target_chainr�rrs     �r�	is_neededzsync_archive.<locals>.is_neededus�����$�$��.���(�(�I�5�5�5��"�"�8�,��	�$�=�=�f�>Q�>Q�>e�U]�Ue�Ue�f�L����$����)@�$*�K�K�/�J���*�*�J����H��<�2�2�2�Z�z�\�EZ�EZ�7Z�Z���/�/�	��	�s�1C�C'�&C'c�(��i}i}d}|D]�}tj|�}|s�|jrd}|jdvs
|js�Dt
jj|�\}}|�vr|}|jr|||<�~|||<��|||fS)a]
        Return metafiles of interest from the file list.
        Files of interest are:
          sigtar - signature files
          manifest - signature files
          duplicity partial versions of the above
        Files excluded are:
          non-duplicity files

        @rtype: list
        @return: list of duplicity metadata files
        FTr�)	r
r�r�r-rr0r�splitextr�)	�filelist�	metafiles�partials�need_passphraser��pr�base�ext�suffixess	        �r�
get_metafilesz#sync_archive.<locals>.get_metafiles�s�����	������
	)�B��"�"�2�&�B����|�|�"&���w�w�1�1�R�[�[��G�G�,�,�R�0�	��c��h�&��D��:�:�%'�H�T�N�&(�I�d�O�
	)��(�O�3�3rc��t|d�}		|j�j}|j	|��-#t$rYnwxYw|j�y)z7
        Copy data from src_iter to file at fn
        �wbN)�open�__next__�datarJrr�)�src_iterrm�filer�s    r�copy_rawzsync_archive.<locals>.copy_raw�s^���H�d�#���
��(�(�*�/�/��
�J�J�t����!�
��
��	
�
�
�s�;�	A�Ac����tj|�}tjj	|�\}}|�vr|}tj
d|j�}||z}|||fS)zB
        @return: (parsedresult, local_name, remote_name)
        F)r
r�r0rr��
get_suffixr)r�r�r�r��suffix�loc_namer�s      �r�resolve_basenamez&sync_archive.<locals>.resolve_basename�sh����
�
�r�
"���G�G�$�$�R�(�	��c��h���D��'�'��2�;�;��?���&�=���8�R��rc���tjj|�j}t	j
t
d�tj|�z�	tjtj|�y#t$rS}t	jt
d�tj|�tj|�fz�Yd}~yd}~wwxYw)Nz1Deleting local %s (not authoritative at backend).zUnable to delete %s: %s)rr�r�r�rr7r8r0rqr�ignore_missing�unlinkr�rUrj)r��del_namerCs   r�remove_localz"sync_archive.<locals>.remove_local�s����*�*�1�1�"�5�:�:���
�
�1�H�I�B�K�K�X`�La�a�b�	[�����	�	�8�4���	[��H�H�Q�0�1�R�[�[��5J�D�I�I�VW�L�4Y�Y�Z�Z��	[�s�$B�	C �
A	C�C c�����Gd�dt��G��fd�dt�}tjtd�t	j
��z��
��\}}}tjj��}||�}tjtj|��}|jr�	||j�n0tj ||jt"j$��|j'�|j)tj*j-|��y)z5
        Copy remote file fn to local cache.
        c��eZdZdZd�Zy)�2sync_archive.<locals>.copy_to_local.<locals>.Blockz;
            Data block to return from SrcIter
            c��||_yr�)r�)�selfr�s  r�__init__z;sync_archive.<locals>.copy_to_local.<locals>.Block.__init__�s	�� ��	rN)ri�
__module__�__qualname__�__doc__r�r^rr�Blockr��s��
�
!rr�c�0��eZdZdZd�Z��fd�Zd�Zd�Zy)�4sync_archive.<locals>.copy_to_local.<locals>.SrcIterzG
            Iterate over source and return Block of data.
            c��||_yr�)r�)r�r�s  rr�z=sync_archive.<locals>.copy_to_local.<locals>.SrcIter.__init__�s	��&��rc�>��	�|jj|j���}js |jj!�t"�|S#t$r�}t	|jd�r/|jj
}t	|d�r|j
}nd}t
jtd�tj��tj|�fztjj�Yd}~��d}~wwxYw)Nr�zFailed to read %s: %s)r��read�
get_read_sizer�rTr�rrpr8r0rqrrjrW�genericr�r�rJ)r��resrCr�r�r�s    ��rr�z=sync_archive.<locals>.copy_to_local.<locals>.SrcIter.__next__�s����
x����� 1� 1�$�2D�2D�2F� G�H�C��x�x��L�L�&�&�(�'�'��
��!�x��t�|�|�V�4�#�|�|�0�0��"�4��0�#'�9�9�D�#���N�N�1�%<�#=����R��RV�R[�R[�\]�R^�@_�#_�ad�an�an�av�av�w�w��x�s�/A � 	D�)B)D�Dc��y)Nir^�r�s rr�zBsync_archive.<locals>.copy_to_local.<locals>.SrcIter.get_read_size�s��!rc��y)Nrr^r�s r�
get_footerz?sync_archive.<locals>.copy_to_local.<locals>.SrcIter.get_footer�s��rN)rir�r�r�r�r�r�r�)r�r�s��r�SrcIterr��s���
�
'�
�"
"�
rr�zCopying %s to local cache.)rgN)�objectrr7r8r0rqrrx�get_fileobj_readr
r�r
r�rr�rr��sys�maxsizer��mover�r�)r�r�r�r��rem_namer�r�r�r�r�r�s`       @��r�
copy_to_localz#sync_archive.<locals>.copy_to_local�s����
	!�F�	!�	�f�	�>	�
�
�1�1�2�R�[�[��_�D�E�!1�"�!5���H�h��.�.�1�1�"�5���7�#���&�&�{�'8�'8��'B�C��
�;�;��X�s�x�x�(����h����s�{�{�C����
�����(�(�/�/��9�:rz;Local and Remote metadata are synchronized, no sync needed.z/Synchronizing remote metadata to local cache...r-�syncrHz3Sync would copy the following from remote to local:r`z5Sync would remove the following spurious local files:N)rrxrUr��listdir�keysr�rr7r8�sortr�rGr3r>rTrHr�r�rVr0rq)rr�r�r�r��remlist�remote_metafiles�ignored�rem_needpass�loclist�local_metafiles�local_partials�loc_needpass�
local_keys�remote_keys�
local_missing�local_spurious�keyr�r�r�r�s`                  @@@r�sync_archiverjs]���9�H�[�24�@�
 �[�8;�v�n�n�!�!�#�G�.;�G�.D�+��g�|��%�%�-�-�/�G�4A�'�4J�1�O�^�\�
�o�*�*�,�-�J��'�,�,�.�/�K��M��N��8��
�j� �S��%>�9�S�>�� � �!1�#�!6�7�
8��8���k�!�S�N�%:��!�!�/�#�"6�7�8����
�
�1�R�S�T����������~�~��J�J�q�J�K�L��,�,�0>�q�&�0I��"�"�-�$�
!���R� �
!��v�~�~�'C�D����9�9�-�H�#�
"���b�!�
"�� � �"���
�
��K�L����i�i��B�K�K�� ?�@�A��
��
�
��M�N����i�i��B�K�K�� @�A�B��rc���|jsJ�|jdj�}tjxstjj
}|j
|��y)z�
    Check consistency and hostname/directory of last manifest

    @type col_stats: CollectionStatus object
    @param col_stats: collection status

    @rtype: void
    @return: void
    ���)�check_remoteN)rQ�get_lastrr9r3r>�check_manifests)r�last_backup_setrs   r�check_last_manifestrNs\���&�&�&�&��1�1�"�5�>�>�@�O��(�(�(�I�F�,>�,>�,I�,I�L��#�#��#�>rc��|dv�r�tj�j�\}}tj|�tj
jj|jtj
j�dd�}	tj|�}j |j"z}t$j&dzt$j(zt+dt$j(z�z}||kr=tjtd�||fztjj,�n#tj.td�||fz�	t1j2t0j4�\}}t;fD�	cgc]
}	|	d
kDs�	|	��c}	�}
|
dkr<tjtd�|
fztjj<�yyy#t$r;tjtd�tjj�Y���wxYw#t0j6$r:tjtd	�tjj8�Y��wxYwcc}	w)
z�
    Check for sufficient resources:
    - temp space for volume build
    - enough max open files
    Put out fatal error if not sufficient to run

    @type action: string
    @param action: action in progress

    @rtype: void
    @return: void
    )r)r*r<N���z!Unable to get free space on temp.r-g333333�?z4Temp space has %d available, backup needs approx %d.z1Temp has %d available, backup will use approx %d.zUnable to get max open files.r
iz_Max open files of %s is too low, should be >= 1024.
Use 'ulimit -n 1024' or higher to correct.
)r�default�mkstempr0r�r�sepr�rO�statvfsr�rrpr8rW�get_freespace_failed�f_frsize�f_bavailrr�r�ro�not_enough_freespacer<�resource�	getrlimit�
RLIMIT_NOFILE�error�get_ulimit_failedr|�maxopen_too_low)rB�tempfile�tempname�tempfsrL�	freespace�	needspace�soft�hard�l�maxopens           r�check_resourcesr,_s����+�+�%�_�_�.�6�6�8���(�
����������!�!�(�.�.������"=�c�r�"B�C��	g��J�J�v�&�E�
�N�N�U�^�^�3�	��.�.��2�f�n�n�D��D�SY�Sa�Sa�La�Hb�b�	��y� ��N�N��H�I�Y�Xa�Lb�b��
�
�2�2�
�

�H�H�Q�J�K�y�Zc�Nd�d�e�	`�!�+�+�H�,B�,B�C�J�D�$��4��,�9�Q�!�b�&�q�9�:���T�>��N�N��C���*�	�
�
�
�-�-�

��=,���	g��N�N�1�@�A�3�=�=�Ce�Ce�f�	g��$�~�~�	`��N�N�1�<�=�s�}�}�?^�?^�_�	`��9s2�G3�)&H:�
J
�%J
�3AH7�6H7�:A
J�Jc�N�tjd|�tjdt��|�tjddjtj
D�cgc]}t
j|���c}���|�tjdjtj��|�tjtjxstj�dtj��|�tjd|�ycc}w)z4
    log Python, duplicity, and system versions
    zP================================================================================z
duplicity zArgs: r,N)rr?rr�r��argvr0rq�platform�uname�
executable�version)�	verbosity�args  r�log_startup_parmsr5�s����G�G�H�i� ��G�G�j��
�&�	�2��G�G�f�S�X�X�3�8�8�D�C�r�{�{�3�/�D�E�F�G��S��G�G�C�H�H�X�^�^�%�&�	�2��G�G�s�~�~�-����.�a����}�=�y�I��G�G�H�i� ��Es�!D"c�(�eZdZdZd�Zd�Zd�Zd�Zy)�Restartzo
    Class to aid in restart of inc or full backup.
    Instance in config.restart if restart in progress.
    c��d|_d|_d|_d|_d|_d|_||_|j|�yr�)r-r�rr�rQrRr��setParms�r�r�s  rr�zRestart.__init__�s@����	������
����������&����
�
�k�"rc���|jrd|_|j|_n)d|_|j|_|j|_t	t|�dz
d�|_y)Nr)r*r-r)rmr-rr��maxrSr�r:s  rr9zRestart.setParms�sZ������D�I�#�(�(�D�I��D�I�'�0�0�D�M�)�4�4�D�O��S��-��1�1�5��rc��t|j�}||jk7s|r
|j�s�|jdk(r}tjtd��|jj�tjtjdtjtj�y||jz
dkDrqtjtd�|jdz||jdzfz�t|jdz|dz�D]}|j|��ytjtd�||jfz�|jj�tjtjdtjtj�yy)NrzRESTART: The first volume failed to upload before termination.
         Restart is impossible...starting backup from beginning.zgRESTART: Volumes %d to %d failed to upload before termination.
         Restarting backup at volume %d.r-z�RESTART: Impossible backup state: manifest has %d vols, remote has %d vols.
         Restart is impossible ... duplicity will clean off the last partial
         backup then restart the backup from the beginning.)rSr�r�rr7r8r�rr0�execver�r.r1ri�del_volume_info)r�r��mf_len�vols    rr�zRestart.checkManifest�sl���R�(�(�)���d�n�n�$�f�����~�~��"��
�
��[���� � �'�'�)��	�	�#�(�(�1�+�s�x�x����<��$�.�.�(�1�,��
�
��C���~�~��)�6�4�>�>�A�3E�F�	G��!����!�!3�V�a�Z�@�,�C��&�&�s�+�,��
�
��V��
�t�~�~�.�/��� � �'�'�)��	�	�#�(�(�1�+�s�x�x����<�C:Hrc��|j|j}|j|_|jxsd|_yr)r�r�rcrQrdrR)r�r�r�s   rr�zRestart.setLastSaved�s1��
�
 �
 ����
0���,�,����,�,�+�!��rN)rir�r�r�r�r9r�r�r^rrr7r7�s���
#�6�#=�J,rr7c���dtjvr7tjt	d�tj
j�tj�dk(rNtjtj��tjtj��tj�tjtj dd�}tj"j%t&j(j*d�t&_t.j0j3t&j,�t&_tj6t	d�tj8t&j,�z�t&j4j;d�	�sWtjd
tj
j<�tj>�tj@d�tCtjD�	tG|�tIjJ�y#tIjJ�wxYw)z
    Start/end here
    �PYTHONOPTIMIZEz�PYTHONOPTIMIZE in the environment causes duplicity to fail to
recognize its own backups.  Please remove PYTHONOPTIMIZE from
the environment and rerun the backup.

See https://bugs.launchpad.net/duplicity/+bug/931175
rr-NslockfilezAcquiring lockfile %sF)�blockingzJAnother duplicity instance is already running with this archive directory
r+)&r0r1rrpr8rW�pythonoptimize_set�geteuid�setuid�setgid�getegidrrr�process_command_liner�r.rr�rr�r��lockpath�	fasteners�process_lock�InterProcessLock�lockfile�Debugrq�acquire�
user_error�shutdown�exitr5r.�	do_backupr�release_lockfile)rBs r�mainrX�su���2�:�:�%����
��
�
�M�M�,�,�	
�
�z�z�|�q��
�	�	�"�*�*�,��
�	�	�"�*�*�,��
�����
*�
*�3�8�8�A�B�<�
8�F��g�g�l�l�6�#:�#:�#?�#?��M�F�O��,�,�=�=�f�o�o�N�F�O��I�I�a�'�(�2�;�;�v���+G�G�H��?�?�"�"�E�"�2����Y�[^�[h�[h�[s�[s�	
�	����������c�h�h�� ��&�����������s�3I�I)c�@
�tjr$tjtj�ntj�t	|�tjtjtj|�j�}|dvrt|�	|dv�r�|j�}|s�nv|j�}|j�rW|dvr�t|�t_tjj }|dk(r.tjtjj"�nZtjtjj$�tj&tjj(�t+j,t/d|�d���nwt+j,t/d|�d	���|j1�tjtjtj|�j�}���n	|j3�}|d
kDr7t+j,t/d��dtj4|����nt+j,t/d
��tjsX|dvrTtj6�D|tj8tj6z
kr t+j,t/d��d}t+j:|�t=d|�tj>_ |dk(r
tC|��n|dk(r
tE|��n�|dk(r
tG|��n�|dk(r�tjH��tjJs't+jL|tjHd��n�|jOtjH�}t+jPtS|�dt*jTjVdd��n6tjXst+j:|d��nt+jZ|tjXd��n�|dk(r
t]|��n�|dk(r
t_|��n�|dk(s|dk(r
ta|��n�|dk(r
t|��n�|dvsJ|��tj>jbr t=d|d�tj>_2tj>jfs�tj>jhs�t=d|�tj>_ tj>jdrltj>j@tj>jdk7r7t+jjt/d�t*jljn�|dk(rtq|�nkts|�}|stq|�nRtjs6|jtr*t=d|�tj>_ tw|�ty||�tjj{�t+j|�t~�t�j�t~�yy)N)r$r&r'r(T)r)r*r�)�backupr)r*r)zLast z' backup left a partial set, restarting.zCleaning up previous partial z backup set, restarting.rzLast full backup date:r,zLast full backup date: none)r*rZz0Last full backup is too old, forcing full backupr-r<r�r%r$�r�zremove-older-thanr&r'r�r+z]When using symmetric encryption, the signing passphrase must equal the encryption passphrase.)Br�current_timerrr,r	�CollectionsStatusrxr�r�r�get_last_backup_chainrr�r7r;r-rmrrr�rr7r8r�get_last_full_backup_timer)�full_if_older_thanr�PrintCollectionStatusrGr3r>r<r�r4�show_changes_in_setr�PrintCollectionChangesInSet�get_changes_in_set_jsonr?�strr/�collection_status�file_changed� PrintCollectionFileChangedStatusr�r�r�r4r=r5r6rprWrSrrrQrrr�rTr�r�rU)rBr�last_full_chainr��last_full_timer!rs       rrVrVs���
������F�/�/�0������F�� �1�1�&�.�.�&�BY�BY�[a�b�m�m�o�I����	�Y��
��/�/�'�=�=�?�O�"��)�2�2�4�K��"�"��6�6�%,�[�%9�F�N�#�^�^�0�0�F���'� �+�+�F�N�N�,?�,?�@� �+�+�F�N�N�,C�,C�D� �,�,�V�^�^�-F�-F�G��J�J�q�5���0W�!X�Y�Z���J�J�q�#@���H`�!a�b�c��&�&�(� /� A� A�����(?�(?��!� �j�l����
��8�8�:�N�����
�
�a�0�1�2�!�H�4I�4I�.�4Y�3Z�[�\��
�
�1�2�3�4��N�N��'�'��%�%�1��X�-�-��0I�0I�I�I��
�
�1�G�H�I������i�(�%3�1�f�$=�F���!�
����	��	�8�	��y��	�'�	'��Y��	�&�	&��%�%�1��?�?��/�/�	�6�;U�;U�W[�\�&�=�=�f�>X�>X�Y�	�����I���3�<�<�+I�+I�4�QU�V��$�$��%�%�i��6��0�0��F�<O�<O�QU�V�	�9�	��	��	�&�	&��9��	�*�	*�f�8V�.V��i�(�	�6�	��Y���2�2�:�F�:�2����&�&�4B�1�f�d�4S�F���1��"�"�-�-��1C�1C�1U�1U�,:�1�f�,E�F���)��"�"�5�5��&�&�1�1�V�5G�5G�5Z�5Z�Z�����@���M�M�,�,���V���	�"�'�	�2�I���I�&��~�~� �2�2�8F�q�&�8Q��*�*�5�+�I�6�"�9�i�8�
�N�N�����L�L�N��������r)Fr�)?�copyr0r/r�socketr�rmrrMrgrrrrrr	r
rrr
rrrrrrrr�duplicity.errorsrr�rrGrOr[r�r�r�r�rrrrr�r4r<r6r�rcrlr�r�r�r�rrr,r.r5r�r7rXrVr^rr�<module>rns!��B�	���
�
����!�$����%����!���������/���$�N�b
�(+
�\Y�x�2�2�2:3�z+�,
9�F3�R&�4Q�(o�027�j*�Z
,� %�2�@!
�H�"S
�la�H?�"3�l!$���	!�E,�f�E,�P2 �jTr

Zerion Mini Shell 1.0