__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
�

��g����SSKJr SSKrSSKrSSKrSSKrSSKrSSKJr SSK	J
r
 SSKJr SSKJ
r
 SSKJr SSKJr SS	KJr SS
KJr SSKJr SSKJr SS
KJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SqSr S6Sjr!Sr"Sr#Sr$Sr%Sr&Sr'Sr(S r)S!r*S7S"jr+S#r,S$r-S%r.S&r/S'r0S(r1S)r2S*r3S+r4S,r5S-r6S.r7S/r8S0r9\Rt4S1jr;"S2S3\<5r=S4r>S5r?g)8�)�	dataclassN)�dedent)�Dict)�__version__)�backend_pool)�cli_main)�config)�diffdir)�dup_collections)�dup_temp)�dup_time)�file_naming)�gpg)�log��manifest)�patchdir)�path)�progress)�tempdir)�util)�BadVolumeExceptionc�,�SSKnURU5$�Nr)�getpass)�messagers  �4/usr/lib/python3/dist-packages/duplicity/dup_main.py�getpass_saferAs����?�?�7�#�#�c���U(a[RS$[RS$![a Of=fU(a�[RR
[RR;d6[RR
[RR;aFS[R;a2[R"[S55 [RS$U(d�[RR
[RR;d6[RR
[RR;aFS[R;a2[R"[S55 [RS$[R(a[R(agUS;agUS;az[RR(d[RR(a<[RR
(a[R(dU(dg[R"[S55 S	nU(aCUS
:Xa=U(a[RRnO�[RR nO�U(aYU(a:[RR(a[RRnOp[#[S5S35nOXU(a:[RR (a[RR nO[#[S
5S35nUS:XaUnO0U(a[#[S55nO[#[S55nXE:Xd2[R$"[S5[R&S	S9 SnGMsU(dw[RR(dX[RR(d9U(d2[R$"[S5[R&S	S9 SnGM�U$)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�inc�verifyz)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_passphraserHGs��(
���:�:�/�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��	����>�?�@��	���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���>�����U�V�X[�Xc�Xc�qu��"�	����+�+�6�6�&�:L�:L�:^�:^�#�����a�b��K�K� $��
"�	���Ls�/�/�
<�<c���[U5(a[U5(aM[R"S[R
R5 g![a N<f=f)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_backuprP�sS��
��=�!�!���=�!�!��L�L��w�}�}�3�3�4����
��
�s�!A�
A"�!A"c��[RRn[RRn[	U5nU(a�UR
U:XaBU(dUR(dgU(a"UR(aURU:�agUR
U:�a�[R"[S5[R"U5[R"UR
54-[RR5 URU5 g[	U5nU(aM�gg![ar [R"[S5[R"U5[R"UR
54-[RR5 gf=f)aU
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)r	r<�
last_index�
last_blockrJ�previous_index�previous_blockr�Warnr9r�uindex�	ErrorCode�restart_file_not_found�queue_index_datarK)rOrRrS�iter_results    r�restart_position_iteratorr\�sA�����*�*�J����*�*�J�
��=�)����+�+�z�9�"�-�*F�*F���-�">�">�=�C_�C_�bl�Cl���+�+�j�8�����Z�[��{�{�:�.����M�<X�<X�0Y�Z�[��M�M�8�8���.�.�{�;���}�-�K�'�k��(�
����
�Q�R��{�{�:�&����M�4P�4P�(Q�R�
S��M�M�0�0�	
�
�s%�:E�1(E�BE�+E�A9F=�<F=c�(^^�SnU4SjnU4Sjn["SS55nS[S[[U44Sjn	S[[U44S	jn
[R(d(S
n[
R"US9nUR5 GO�[RRR5n[RRU5 [RRU5 [R(dL[R(d7[R(d"U"[RRU5 O[R "[#S55 X,l[RR&n
[R("[#S
5[RR*[,R."[RR05[RR&4-5 [RR*n[3U5 S
nS
n[R4(a@[4R6R9US-5 [4R:R=5 Sn0n[R>S
:�aA[@RB"TRDRFRH[R>S9nU(Gd�URK5 US-
n[LRN"TU[RP[RRS9n[TRV"[LRX"U55n[RP(a@[ZR\"UUR^[R`[Rb5nOv[RR(a1[ZRd"UUR^[Rb5nO0[ZRf"UUR^[Rb5nURi5 [
Rj"5nURl"U/U"U5Q76 URoS[ZRp"SU55 US:XaURs5 OURu5 [Rv(a�[xRzR|S
:Xa�U(a}US:Xaw[#S5n[R~"U[xRzR�5 [R("[#U55 S[lAUR�5 GM�[R>S
:�atU(am[4R�"S
UR�55 UR�TR�R�UU4S9nU"UUU5UU'U	"UUU5 U
"X�U5 O�UR�U5 US:XaURs5 OURu5 X�"UUU5-
n[R~"[#S5U-[xRzR�5 [R4(a[4R6R�U5 U(dGM�U(Ga�[R�"S5 U(aoU	"UUU5 U
"X�U5 UR�5S
:XaOG[R�"SUR�5S35 [�R�"S5 U(aMoUR�5n[R�"SUSSUSSS 3S!USS"S#USS$3-5 [�UR�5Vs/sHnUR�PM sn5(dv[R�(daUR�5Vs/sH,nUR�(aMUR�R�PM. nn[R�"S%US&35 [xRz=R�S'-
slY[xRzR�S(U5 UR�5 UR�[xRzR�55 U$![�[�4anUR�5 eSnAff=fs snfs snf!UR�5 f=f))aN
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��UR5upUcSnSnU(aUS-nUR5up4UcUnUnU(aUS-nXX44$)z3Return start_index and end_index of previous volumeN�r.)�recall_index�get_previous_index)rO�start_index�start_block�	end_index�	end_blocks     r�get_indicies�$write_multivol.<locals>.get_indicies%sh��#0�#=�#=�#?� �����K��K���1��K�,�?�?�A��	���#�I�#�I����N�I���=�=rc�>�UR5n[RU:waTRX5 TR	XUS9upEU(dk[
R"U5SU3n[R"[S5[R"U5-[RRU5 UR(aUR5 U$)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.
)�source_pathz: z$File %s was corrupted during upload.)�getsizer	�skip_volume�put�validater�escaper�
FatalErrorr9r1�fsdecoderX�backend_validation_failed�stat�delete)�tdp�
dest_filename�vol_num�putsize�res�msg�
code_extra�backends       �rrl�write_multivol.<locals>.put5s�����+�+�-������(��K�K��+��#�#�M��#�L���� �K�K�
�6�7�r�#��?�J��N�N��8�9�B�K�K�
�<V�V��
�
�7�7��
��8�8��J�J�L��rc�V>�[RR(d[RR(a [RR(dg[
R"TS[R[RS9nX RS:wa8[R"[S5[RR5 [R(a8[[R X!R"S5nUR%5 gg)aq
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)r	r4r6r7r5r�getr:�compression�volume_name_dictrror9rX�enryption_mismatch�restore_get_enc_fileobjr{�volume_info_dict�close)�
backup_setr�
vol1_filename�fileobj�backup_types    �r�validate_encryption_settings�4write_multivol.<locals>.validate_encryption_settingsKs����
���)�)�V�-?�-?�-Q�-Q�[a�[m�[m�[v�[v�
�#����Q�&�BS�BS�]c�]o�]o�p�
��7�7��:�:��N�N��h�i��
�
�0�0�
����-�f�n�n�m�Mf�Mf�gh�Mi�j�G��M�M�O�rc�d�\rSrSr%\\S'\R\S'\R\S'Sr
SrSrg)�'write_multivol.<locals>.CommandMetaDataiirv�path_obj�vol_infoFr_N)
�__name__�
__module__�__qualname__�__firstlineno__�int�__annotations__r�Pathr�
VolumeInfo�transfer_success�manifest_written�__static_attributes__r_rr�CommandMetaDatar�is)�����)�)���%�%�%� �� �rr��
bytes_written�command2vol_mapc��UR5GH1nURnURnX-
n[R"XU5 [
R"[S5X$R-U5 SX$l	X$RR(aX$RR5 [R(a+[RRX$R5 [
R "SX$RR#5SUSUSUR%535 GM4 g)N�Processed volume %dTzTransfer of z	 with id z
 and size z took )�results_since_last_call�track_id�resultr�report_transferrrLr9rvr�r�rrrsr	�tracker�snapshot_progress�Debug�get_filename�get_runtime)r��backend_poolerr�r�r��sizes      r�collect_put_results�+write_multivol.<locals>.collect_put_resultsqs��$�<�<�>�F����H��=�=�D��!�M��$�$�T�0��L�L��0�1�O�4M�4U�4U�U�Wd�e�9=�O�%�6��(�1�1�6�6��)�2�2�9�9�;����� � �2�2�?�3L�3T�3T�U��I�I���8�A�A�N�N�P�Q�QZ�[c�Zd�dn��&��v�1�1�3�4�6�
�?rc�J�[UR55nU[U5nUR(aCUR(a2U[U5nUR(aUR(aM2UR(a�UR(dURUR5 SUlU[U5nURS:XaUR5 OUR5 UR(aM�gg![a gf=f)z�
Ensure volume info is written only if the volume transfer was successful and in sequence
without gap otherwise missing volumes won't be detected and data is missing.
Tr.N)�iter�keysrJr�r��add_volume_infor�rv�
to_partial�flushrK)�mf�mf_filer��i�infos     r�write_manifest_in_sequence�2write_multivol.<locals>.write_manifest_in_sequence�s���
	��_�)�)�+�,�A�"�4��7�+�D��'�'�D�,A�,A�&�t�A�w�/���'�'�D�,A�,A�,A��'�'��,�,��&�&�t�}�}�5�(,��%�&�t�A�w�/���<�<�1�$��&�&�(��M�M�O��'�'�'���	��	�s�A9D�=BD�
D"�!D"r)�fhz:Skipping encryption validation due to glacier/deep storagez-Restarting after volume %s, file %s, block %sr.N)�	processesr~�SHA1z8Skipped volume upload, as effectivly nothing has changedT)�argsr�z/Collecting remaining results from backend pool.zStill z commands left, waiting ...r,zTransferred �countz volumes, a volume took avg: �time�avgz, zmax: �maxz, min: �minzVolumes with number z! were not transferred successful.)�ConcurrentTransferStatsr�)]rr�rr	r<r�Manifest�set_dirinfo�last_backup�get_local_manifest�
checkManifest�setLastSaved�s3_use_deep_archive�s3_use_glacier�s3_use_glacier_irrrVr9r�rSr8�	start_volrrWrRr\rr��set_start_volume�progress_thread�start�concurrencyr�BackendPoolr{�
parsed_url�
url_string�remember_next_indexrr�r:r�r�new_tempduppath�parser�GPGWriteFile�namer4�volsize�
GzipWriteFile�PlainWriteFile�setdatar��set_info�set_hash�get_hashr�r��skip_if_no_changer
rM�DeltaEntriesrLrN�skipped_incrsr�rj�command_throttled�
put_validatedr��	Exception�
SystemExit�shutdownr�r�r��get_queue_lengthr��sleep�	get_statsr=�any�valuesr�r��
volume_numberro�
stat_attrs�set_stat�set_files_changed_info�get_delta_entries_file)r�rO�	man_outfp�	sig_outfpr{rfrlr�r�r�r�rvr�rS�at_endr�r�r�rurt�viryr��erM�x�failed_volume_numberss`   `                      r�write_multivolr�s����(>� �,�<�!�!��!��3��QU�VY�[j�Vj�Qk��"��c�?�FZ�A[��0�>�>���
�
�
�)�
,��
�����^�^�
'�
'�
:�
:�
<�����$�$�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�� � �&�&�(��N�24�O�
���A��%�1�1�'�/�/�2L�2L�2W�2W�ci�cu�cu�v����)�)�+�	�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��a�<�� � �"��O�O���#�#��
�
�(B�(B�a�(G�F�W^�bc�Wc��N�O�C��L�L��g�m�m�:�:�;��J�J�q��v��!%�F���J�J�L������!�n�

��(�(��C�K�K�M�:�)�;�;�G�<Q�<Q�<Z�<Z�be�gt�au�;�v��,;�G�S�"�,M���)�#�M�>�?�S�*�2�/�J�
���r�"��!�|��$�$�&����!��S��m�W�=�=�M�
�L�L��0�1�G�;�W�]�]�=Y�=Y�Z����� � �2�2�7�;�I�f�L�	&��I�I�G�H�)�#�M�>�?�S�*�2�/�J�!�2�2�4��9���I�I��~�'F�'F�'H�&I�Id�e�f��J�J�q�M�*�>�#�,�,�.�E��H�H��u�W�~�.�.K�E�RX�M�Z_�L`�Ka�ac�d��%��-��.�/�w�u�V�}�U�7K�6L�M�N�
�
�O�4J�4J�4L�M�4L�q��*�*�4L�M�N�N�W]�Wi�Wi�6E�6L�6L�6N�)�6N��VW�Vh�Vh�,�A�J�J�,�,�6N�&�)����!5�6K�5L�Lm�n�o��M�M�$�$�(D�D�$��M�M�"�"�#<�e�D�
�#�#�%����g�m�m�B�B�D�E����u�z�*�
��'�'�)���
��TN��)��
�#�#�%�sR�A+c�B
c?�A"c?�2c5�3c?�;c:�c:�.Ac?�c2�c-�-c2�5
c?�?dc��US:XdUS:Xde[R"USSS9n[R"USS9n[R"US[RS9n[R
"[RXU5nU$)a
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)rr�r	r:r�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�GZ�
�B��Irc��US;de[R"USSS9n[R"USS9n[R"U[R[RS9n[
R"[RXUSS9nU$)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�rr�r	r:r�rr�r�)�sig_type�part_sig_filename�perm_sig_filename�remote_sig_filenamer�s     r�get_sig_fileobjrDs����.�.�.�.�#����%��N��#����$�?��%�/�/�(�f�>O�>O�Y_�Yk�Yk�l��	�	%�	%����!2�GZ�fj�
�B��Irc��US;de[R"USSS9n[R"USS9n[R"U[R[RS9n[
R"[RXUSS9nU$)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-statFTrr	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�I]�im�
�B��Irc�j�[R(a�[R"5[l[R
"[R5n[U5 [RR[RS5 [R"5 [R"5[l
[R(a@[R
"[R5n[U5nURSS9 GOu[!S5n[#S5n[R$"[RU5n['SXU[R(5nUR+5 UR-5 UR/5 UR+5 UR-5 UR/5 [R(a�S[Rl[RR35 [4R6"SS[RR8[RR;5[RR<S5 URSS9 [?S	X 5 [A[RU5 g)
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_warningrr)�Y@rFr)!r	r�ProgressTrackerr�r
�DirFull�selectrP�set_evidencerMr�
set_selection�LogProgressThreadr��dry_run�
set_valuesrr�DirFull_WriteSigr�r{r��	to_remote�to_final�finished�joinr�TransferProgress�total_bytecount�total_elapsed_seconds�speed�write_json_stat�print_statistics)�	col_statsrOr�r�r�s     r�full_backupr2vs������#�3�3�5�������
�
�6�
��]�#����%�%�g�m�m�T�:�	��� �#+�#=�#=�#?�� �
�~�~�����
�
�6�
�$�]�3�
����t��4�#�J�/�	�#�F�+�	��0�0����	�J�
�&�v�}��TZ�Tb�Tb�c�
�	������������	�������������?�?�04�H�$�$�-��$�$�)�)�+�� � ���� � �0�0�� � �6�6�8�� � �&�&��

�	���t��4��K��:��W�]�]�M�2rc�F�UR(d�[RS:XaN[R(d9[R
"[
S5[RR5 g[R"[
S55 gURS$)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_pairr	rC�implied_incrror9rX�inc_without_sigsrV�r1s r�check_sig_chainr8�sw���'�'��=�=�E�!�&�*<�*<��N�N��I���
�
�.�.�
��
�H�H�Q�G�H�I���'�'��*�*rc���[R(abU[Rl[RR[
S55n[R"U[RSS9 gg)z`
If config.print_statistics, print stats after adding bytes_written

@rtype: void
@return: void
zBackup StatisticsTr/N)
r	r0r
rM�TotalDestinationSizeChange�get_stats_logstringr9rr@�NOTICE)rMr��	logstrings   rr0r0�sL�����3@��
�
�0��M�M�5�5�a�8K�6L�M�	����	�3�:�:�4�8�rc��[R(d�[R"UR5 [R
[R:XaT[R"S5 [R"5 [R
[R:wdS5e[R(a�[R"5[l[R"[RUR!55n[#U5 [RR%[R&S5 [(R*"5 [R,"5[l[R0(a@[R"[RUR!55n[#U5nGO�[3S5n[5S5n[R6"[RUR!5U5n[9SX%U[R:5n[R<(daUR?5 URA5 URC5 UR?5 URA5 URC5 O@UR?5 URE5 UR?5 URE5 [R(a�S[R.l#[R.RI5 [JRL"SS[RRN[RRQ5[RRRS5 [US	X15 [W[R&U5 g
)zc
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?Frr*TrrrN),r	r<r
�setprevtime�end_time�curtime�prevtimer�r��
setcurtimerrr�r
�DirDeltar �get_fileobjsrPr!rMrr"r#r�r$rr�DirDelta_WriteSigr�r{r�r�r'r(�clean_upr)r*rr+r,r-r.r/r0)�	sig_chainr1rOr��
new_sig_outfp�
new_man_outfps      r�incremental_backuprK�sv���>�>����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�
�9��W�]�]�M�2rc��[R(a�[RR	U5n[
R"U[
RSS9 [R(d�[U5nU[Rl
URUR55 UR5 [R(d!UR5 UR!5 gUR#5 ggg)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	�jsonstatr
rM�get_stats_jsonrr@r<r$rr:�write�encoder�r�r'r(rG)rr�r1�	json_stat�
stat_outfps     rr/r/s�������M�M�0�0��;�	����	�3�:�:�4�8��~�~�)�)�4�J�7D�G�M�M�4����Y�-�-�/�0������%�%��$�$�&��#�#�%��#�#�%��rc���[R=(d [RnUR	U5n[
R"URU55nUH�nURS:wdM[R"UR"55S[R"UR"553n[R"UR"55S[R "UR"55SUR"3n[$R&"U[$R([$R*R,US5 M� g)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_timer
rA�get_signature_chain_at_timer
�get_combined_path_iterrE�difftype�timetopretty�getmtimer1rp�get_relative_path�timetostringrrn�typerr@�INFO�InfoCode�	file_list)r1r�rH�	path_iterr�	user_info�log_infos       r�list_currentrd9s������2�(�"2�"2�D��5�5�d�;�I��.�.�y�/E�/E�d�/K�L�I����=�=�I�%�#�0�0�����A�B�!�B�K�K�PT�Pf�Pf�Ph�Di�Cj�k�I�"�/�/��
�
��@�A��4�;�;�t�Oe�Oe�Og�Ch�Bi�ij�ko�kt�kt�ju�v�H��G�G�I�s�x�x����)?�)?��4�P�	rc��[R(a[U5 g[R"[R
[U55(d�[R(a^[R"[S5[R"[R5-[RR5 g[R"[S5[RR5 gg)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.)r	r$�restore_get_patched_rop_iterr�
Write_ROPaths�
local_path�restore_pathrror9r1rprX�restore_path_not_found�no_restore_filesr7s r�restorerlMs����~�~�$�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�^
^^�[R(a)[[RRS55mOSm[R=(d [
RnURU5nU(dUR5eURU5nSmUHnT[U5-
mM S/m
U
UU4Sjn[[RS5(d[R(a�/nUHLnUR5nUR"T5n	U	H!n
UR!UR"U
5 M# MN [R(a0[$R&"SSR)SU55-5 g	[RR+U5 [-[/XS55n[-[/[0R2U55n[0R4"UT5$)
z�
Return iterator of patched ROPaths of desired restore data

@type col_stats: CollectionStatus object
@param col_stats: collection status
�/r_rc3�~># �UR5nUR"T5nUHun[URURUUR
U5nUbUv� TS==S-
ss'[R"[S5TST4-TST5 Mw g![anUv� SnANQSnAff=f7f)z<Get file object iterator from backup_set contain given indexNrr.zProcessed volume %d of %d)
�get_manifest�get_containing_volumesr�r{r�r�rrrLr9)	r�r�volumesrv�fobjr��cur_vol�index�num_volss	      ���r�get_fileobj_iter�6restore_get_patched_rop_iter.<locals>.get_fileobj_iterys������*�*�,���1�1�%�8���G�
�.��&�&�
�(C�(C�G�(L�h�Ng�Ng�ho�Np����#��J�
�A�J�!�O�J��L�L��6�7�7�1�:�x�:P�P�RY�Z[�R\�^f�g���&�
����
�s.�(B=�8B"�$>B=�"
B:�,B5�0B=�5B:�:B=�pre_process_download_batchzRequired volumes to restore:
	z
	c3�@# �UHoR5v� M g7f�N)�decode)�.0�	file_names  r�	<genexpr>�/restore_get_patched_rop_iter.<locals>.<genexpr>�s���Gw�lv�_h�HX�HX�HZ�HZ�lv�s�N)r	ri�tuple�splitrUr
rA�get_backup_chain_at_time�all_backup_chains�get_sets_at_time�len�hasattrr{r$rprq�appendr�rr8r*ry�list�mapr�TarFile_FromFileobjs�tarfiles2rop_iter)r1r��backup_chain�backup_setlist�srw�
file_namesr�rrrrv�
fileobj_iters�tarfilesrtrurvs             @@@rrfrfes��������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�~�~�;�<�<�����
�(�J�!�.�.�0�H��5�5�e�<�G�"���!�!�*�"=�"=�g�"F�G�#�)�
�>�>��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
���[S[RS-5H�n[R"U5n[
R"U5nURX5 [X%5upgnU(a GO2[S5US-<S[R"U5<S[S5U-<S[S5US-<S3n	[R"U	[RRS9 M� [R (ao[#S	[R"U535n
[R$"[S
5U
R&R([*R,"U
54-5 g[R."W	[RRS9 WR1S5nWR2(a*[R4R6(a[9U5 U$)
a0
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: %sN�rb)�ranger	�num_retriesrr�rr�r��restore_check_hashr9r1rpr�ErrorrX�mismatched_hash�
ignore_errorsrrV�	__class__r�r�uexcro�filtered_open_with_deleterr4r5�restore_add_sig_check)r{�filename�volume_inforB�parseresultsrt�verified�	hash_pair�calculated_hash�	error_msg�excr�s            rr�r��st���1�f�(�(�1�,�
-��!�"�(�(��2���&�&�|�4�����H�"�.�/A�+�/S�,��_����=�>��1��M����H�%��'�(�?�:��%�&��1��5�	�I�
�I�I�i�c�m�m�&C�&C�D�#.�&���$�':�2�;�;�x�;P�:Q�%R�S�C��H�H��O�P��=�=�)�)�4�9�9�S�>�:�;�
�
��N�N�9�3�=�=�+H�+H�I��+�+�D�1�G����&�"4�"4�"=�"=��g�&��Nrc��UR5nU(a&[R"USU5nX2S:waSX#4$SUW4$)zx
Check the hash of vol_path path against data in volume_info

@rtype: boolean
@return: true (verified) / false (failed)
rr.FT)�
get_best_hashrr�)r��vol_pathr�r�s    rr�r��sN���)�)�+�I���,�,�y��|�X�>����l�*��)�4�4�-���O�+�+rc��^�[T[R5(a)[TR[R
5(dT5eU4SjnTR
U5 g)z_
Require signature when closing fileobj matches sig in gpg_profile

@rtype: void
@return: void
c�`>�TRR5nUcSOUn[RRnUcSOUn[[
U5[
U55*nXSXS:waB[R"[S5XSXS4-[RR5 gg)z"Thunk run when closing volume fileN�Nonez#Volume was signed by key %s, not %s)r��
get_signaturer	r4r5r�r�rror9rX�unsigned_volume)�
actual_sigr5�ofsr�s   �r�check_signature�.restore_add_sig_check.<locals>.check_signature�s�����_�_�2�2�4�
�)�1�V�z�
��%�%�.�.��%�-�6�8���3�z�?�C��M�2�2���d��x��~�-��N�N��7�8�J�t�<L�h�W[�n�;]�]��
�
�-�-�
�.rN)�
isinstancer�
FileobjHookedr�r�GPGFile�addhook)r�r�s` rr�r��sN����g�x�5�5�6�6�:�g�o�o�WZ�Wb�Wb�;c�;c�l�el�l�c���O�O�O�$rc��[R"[U5[R5nSnSnUH�upEU(d [
R"UR5nU(d [
R"UR5nURU[R5(dUS-
nUS-
nM� [R"[S5[S5U-[S5U-4-5 US:�aSq
gg)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
�
collate2itersrfr	r r�ROPathru�compare_verbose�compare_datarr8r9�exit_val)r1�collated�
diff_count�total_count�
backup_ropath�current_paths      rr+r+�s����$�$�%A�)�%L�f�m�m�\�H��J��K�'/�#�
�� �K�K��(:�(:�;�M���;�;�}�':�':�;�L��,�,�\�6�;N�;N�O�O��!�O�J��q���(0��J�J�	�
$�%��
"�#�k�1�1�5M�3N�Q[�3[�
\�	]���Q����rc��UR5upX-nU(d [R"[S55 gSR	[[RU55n[R(a�[R"[S5SU35 [R(dSURRU5 UH1n[RRU5R5 M3 gg[R"[S5S-U-S-[S5-5 g![ a Myf=f)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_extraneousrrVr9r*r�r1rpr	�forcer8r$r{rsr�r�r�)r1�	ext_local�
ext_remote�
extraneous�filestr�fns      r�cleanupr�s��&�4�4�6��I��'�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>�>
E�Ec��[RceUR[R5[l[	U5 g)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_oldr7s r�remove_all_but_n_fullr�7s7�����)�)�)�"�@�@��AS�AS�T�F���y�rc	���[RceSnSnUR[R5nU(a9[R"[S5<SU"U5<S[S5<35 UR(aJURSR[R:a[R"[S55 UR[R5n[RS	:Xa[S
U55nU(d [R"[S55 g[R(Gad[R"[S5S-U"U5-5 X@R5-
nUR5 UH�n[RS	:Xa7[U[ R"5(a[S
5nOB[S5nO6[U[ R"5(a[S5nO[S5n[R"U[$R&"UR5-5 [R((aM�UR+[RS	:HS9 M� UR-SS9 g[R"[S5S-U"U5-S-[S5-5 g)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	��SRUVs/sH'n[R"UR55PM) sn5$s snf)z.Return string listing times of sets in setlistr�)r*r
rY�get_time)�setlistr�s  r�
set_times_str�!remove_old.<locals>.set_times_strTs4���y�y�w�O�w�!�(�/�/��
�
��=�w�O�P�P��Os�.Ac��SRUVs/sH#n[R"UR5PM% sn5$s snf)z2Return string listing times of chains in chainlistr�)r*r
rYr@)�	chainlistr�s  r�chain_times_str�#remove_old.<locals>.chain_times_strXs2���y�y�Y�O�Y��(�/�/��
�
�;�Y�O�P�P��Os�*Az#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��# �UHkn[U[R5(aUR(d4[U[R5(dMTUR
(dMgUv� Mm g7fr{)r�r�SignatureChain�inclist�BackupChain�incset_list)r}r�s  rr�remove_old.<locals>.<genexpr>tsR���
����1�o�<�<�=�=�!�)�)��1�o�9�9�:�
�@A�}�}�
�A��s�AA5�A5�,	A5z*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_fullrz0Found old backup chain(s) at the following time:z5Rerun command with --force option to actually delete.)r	r��get_older_than_requiredrrVr9r4r@�get_chains_older_thanrCr�r8r��get_signature_chains_older_than�reverser�rr�r
rYr$rsr%)r1r�r��req_listr��chain�
chain_descs       rr�r�HsW�����)�)�)�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]�]�^��>�>�v�?Q�?Q�R�R�	������E��}�}� >�>��e�_�%C�%C�D�D�!"�#Z�![�J�!"�#W�!X�J��e�_�%C�%C�D�D�!"�#I�!J�J�!"�#F�!G�J��J�J�z�H�$9�$9�%�.�.�$I�I�J��>�>�>�����
�
�9W�(W��Y�� 	���t��4��
�
�
�@�A��
��i�(�
)��
��G�H�	
I�	
rc	��^^^^�/SQmU4SjnU4SjnSmU4SjmSnUU4Sjn[RR5nU"U5upgn[RR	5n	U"U	5up�n[U
R55n
[UR55n/n/nUH6nUU
;dMUU;dMU"U5(dM"UR
UU5 M8 U
H%nUU;dUU;dMUR
U
U5 M' U(d'U(d [R"[S55 gUR5 UR5 [R(d�[R"[S	55 U(a-U(dU(a[S
S5[RlUHnU"U5 M
 [[RS5(a[RR!U5 UHnU"U5 M
 TR#5 gU(aL[R"[S
5S-SR%['[(R*U55-5 U(aM[R"[S5S-SR%['[(R*U55-5 gg)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��>�[RS:Xag[RS:Xde[R"U5nTR	[R
=(d [R5nURcURcUR=p4OURnURnXBR:�=(a X2R:*$![Ra gf=f)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_moderr�r�rUr
rAr�CollectionsError�
start_timer@r�)r��parsed�target_chainr�r@r1s     �r�	is_needed�sync_archive.<locals>.is_needed�s�����$�$��.���(�(�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�6C�C4�3C4c�\>�0n0nSnUH�n[R"U5nU(dM"UR(aSnURS;dUR(dMX[
RRU5upgUT;aUnUR(aXBU'M�XAU'M� XU4$)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)	rr�rr]rr1r�splitextr�)	�filelist�	metafiles�partials�need_passphraser��pr�base�ext�suffixess	        �r�
get_metafiles�#sync_archive.<locals>.get_metafiles�s�����	������B��"�"�2�&�B����|�|�"&���w�w�1�1�R�[�[�[��G�G�,�,�R�0�	���h�&��D��:�:�%'�T�N�&(�d�O���O�3�3rc��[US5nUR5RnUR	U5 M.![a Of=fUR5 g)z%
Copy data from src_iter to filename
�wbN)�open�__next__�datarKrOr�)�src_iterr��filers    r�copy_raw�sync_archive.<locals>.copy_raw�s^���H�d�#���
��(�(�*�/�/��
�J�J�t����!�
��
��	
�
�
�s�<�
A	�A	c��>�[R"U5n[RR	U5up#UT;aUn[R
"SUR(+5nX$-nXU4$)z2
@return: (parsedresult, local_name, remote_name)
F)rr�r1rr��
get_suffixr)r�r�r�r��suffix�loc_namer�s      �r�resolve_basename�&sync_archive.<locals>.resolve_basename�sb����
�
�r�
"���G�G�$�$�R�(�	���h���D��'�'��2�;�;��?���=���R��rc���[RRU5Rn[R
"[
S5[R"U5-5 [R"[RU5 g![aVn[R"[
S5[R"U5[R"U54-5 SnAgSnAff=f)Nz1Deleting local %s (not authoritative at backend).zUnable to delete %s: %s)r	r�r�r�rr8r9r1rpr�ignore_missing�unlinkr�rVr�)r��del_namer�s   r�remove_local�"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�>^^�"SS[5m"UU4SjS[5n[R"[S5[R
"T5-5 T
"T5up#n[RRT5nU"U5n[R"[R"U55nUR(aT	"XgR5 O-[R "XgR["R$S9 UR'5 UR)[R*R-U55 g)z%
Copy remote file fn to local cache.
c��\rSrSrSrSrSrg)�2sync_archive.<locals>.copy_to_local.<locals>.Blockiz#
Data block to return from SrcIter
c��Xlgr{�r)�selfrs  r�__init__�;sync_archive.<locals>.copy_to_local.<locals>.Block.__init__s�� �	rrN)r�r�r�r��__doc__rr�r_rr�Blockrs��
�
!rrc�:>�\rSrSrSrSrUU4SjrSrSrSr	g)	�4sync_archive.<locals>.copy_to_local.<locals>.SrcIteriz/
Iterate over source and return Block of data.
c��Xlgr{�r�)rr�s  rr�=sync_archive.<locals>.copy_to_local.<locals>.SrcIter.__init__s��&�rc�d>�T"URRUR555nWR(d URR!5 ["eU$![a�n[	URS5(a4URR
n[	US5(aUR
nOSn[R"[S5[R"T5[R"U54-[RR5 SnAN�SnAff=f)Nr�zFailed to read %s: %s)r��read�
get_read_sizer�r�r�rror9r1rprr�rX�genericrr�rK)rrxr�r�rr�s    ��rr�=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�4�#�|�|�0�0��"�4��0�0�#'�9�9�D��#���N�N�1�%<�#=����R��RV�R[�R[�\]�R^�@_�#_�ad�an�an�av�av�w�w��x�s�/A%�%
D/�/B6D*�*D/c��g)Nir_�rs rr&�Bsync_archive.<locals>.copy_to_local.<locals>.SrcIter.get_read_size-s��!rc��g)Nrr_r*s r�
get_footer�?sync_archive.<locals>.copy_to_local.<locals>.SrcIter.get_footer0s��rr"N)
r�r�r�r�rrrr&r-r�)rr�s��r�SrcIterr s���
�
'�
�"
"�
rr/zCopying %s to local cache.)r�N)�objectrr8r9r1rpr	r{�get_fileobj_readrr�rr�rr�rr��sys�maxsizer��mover�r�)r�r/r�r�rem_namer�rrtrrr
s`       @��r�
copy_to_local�#sync_archive.<locals>.copy_to_locals����
	!�F�	!�	�	�f�	�>	�
�
�1�1�2�R�[�[��_�D�E�!1�"�!5���h��.�.�1�1�"�5���7�#���&�&�{�'8�'8��'B�C��
�;�;��X�x�x�(����h���s�{�{�C����
�����(�(�/�/��9�:rz;Local and Remote metadata are synchronized, no sync needed.z/Synchronizing remote metadata to local cache...r.�syncryz3Sync would copy the following from remote to local:r�z5Sync would remove the following spurious local files:N)r	r{r�r��listdirr�r�rr8r9�sortr$rHr4r?r�ryr%r*r�r1rp)r1r�r�rr6�remlist�remote_metafiles�ignored�rem_needpass�loclist�local_metafiles�local_partials�loc_needpass�
local_keys�remote_keys�
local_missing�local_spurious�keyr�rr
r�s`                  @@@r�sync_archiverH�sJ���9�H�[�24�@�
 �[�8;�v�n�n�!�!�#�G�.;�G�.D�+��|��%�%�-�-�/�G�4A�'�4J�1�O�\�
�o�*�*�,�-�J��'�,�,�.�/�K��M��N���
�j� �S��%>�9�S�>�>�� � �!1�#�!6�7�
����k�!�S�N�%:��!�!�/�#�"6�7�����
�
�1�R�S�T����������~�~��J�J�q�J�K�L��,�,�0>�q�&�0I��"�"�-�$���R� �%��v�~�~�'C�D�D����9�9�-�H�#���b�!�$�� � �"���
�
��K�L����i�i��B�K�K�� ?�@�A��
��
�
��M�N����i�i��B�K�K�� @�A�B��rc���UR(deURSR5n[R(+=(d [RR
nUR
US9 g)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)r��get_lastr	r:r4r?�check_manifests)r1�last_backup_setrKs   r�check_last_manifestrO�s\���&�&�&�&��1�1�"�5�>�>�@�O��(�(�(�I�F�,>�,>�,I�,I�L��#�#��#�>rc	�P�US;Ga�[R"5R5up[R"U5 [R
RRUR[R
R5SS5n[R"U5nWR UR"-n[$R&S-[$R(-[+S[$R(-5-nXV:aB[R"[SUSS	USS
35[RR,5 O([R."[SUSSUSS
355 [0R2"[0R45upx[;WW4V	s/sHo�S:�dM
U	PM sn	5n
U
S:a=[R"[SU
S35[RR<5 ggg![a< [R"[S5[RR5 GN�f=f![0R6a< [R"[S
5[RR85 GNf=fs sn	f)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*rlN���z!Unable to get free space on temp.r,g333333�?zTemp space has �,z  available, backup needs approx �.z	Temp has z# available, backup will use approx zUnable to get max open files.rJizMax open files of zK is too low, should be >= 1024.
Use 'ulimit -n 1024' or higher to correct.
)r�default�mkstempr1r�r�sepr*r��statvfsr�rror9rX�get_freespace_failed�f_frsize�f_bavailr	r�r�r��not_enough_freespacer=�resource�	getrlimit�
RLIMIT_NOFILE�error�get_ulimit_failedr��maxopen_too_low)rC�tempfile�tempname�tempfsrM�	freespace�	needspace�soft�hard�l�maxopens           r�check_resourcesrk�s���+�+�%�_�_�.�6�6�8���
����������!�!�(�.�.������"=�c�r�"B�C��	g��J�J�v�&�E�
�N�N�U�^�^�3�	��(�(�1�,����>�#�d�V�^�^�F[�B\�\�	�� ��N�N��O�I�a�=�0P�QZ�[\�P]�]^�_�`��
�
�2�2�
�

�H�H�Q��9�Q�-�/R�S\�]^�R_�_`�a�b�c�	`�!�+�+�H�,B�,B�C�J�D��4��,�9�,�Q�b�&�q�,�9�:���T�>��N�N��(��	�2C�D���
�
�-�-�
��=,���	g��N�N�1�@�A�3�=�=�Ce�Ce�f�	g��$�~�~�	`��N�N�1�<�=�s�}�}�?^�?^�_�	`��9s2�H�7&I�(	J#�5J#�AI
�I
�AJ �J c�n�[R"SU5 [R"S[3U5 [R"SSR[R
Vs/sHn[R"U5PM sn53U5 [R"SR[R"55U5 [R"[R=(d [RS[R3U5 [R"SU5 gs snf)z,
log Python, duplicity, and system versions
zP================================================================================z
duplicity zArgs: r-N)rr@rr*r2�argvr1rp�platform�uname�
executable�version)�	verbosity�args  r�log_startup_parmsrt�s����G�G�H�i� ��G�G�j��
�&�	�2��G�G�f�S�X�X�3�8�8�D�8�C�r�{�{�3�/�8�D�E�F�G��S��G�G�C�H�H�X�^�^�%�&�	�2��G�G�s�~�~�-����.�a����}�=�y�I��G�G�H�i� ��Es�$ D2c�0�\rSrSrSrSrSrSrSrSr	g)	�Restarti�zc
Class to aid in restart of inc or full backup.
Instance in config.restart if restart in progress.
c��SUlSUlSUlSUlSUlSUlXlURU5 gr{)r]r�r@r�rRrSr��setParms�rr�s  rr�Restart.__init__�s>����	������
����������&���
�
�k�"rc���UR(aSUlURUlO)SUlURUlURUl[	[U5S-
S5Ulg)Nr)r*r.r)r�r]r@r�r�r�r�rys  rrx�Restart.setParms�sZ������D�I�#�(�(�D�I��D�I�'�0�0�D�M�)�4�4�D�O��S��-��1�1�5��rc��[UR5nX R:wdU(aUR(Gd�URS:Xa[R"[S55 URR5 [R"[RS[R[R5 gX R-
S:�as[R"[S5URS-X RS-4-5 [URS-US-5HnURU5 M g[R"[S5X R4-5 URR5 [R"[RS[R[R5 gg)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.)r�r�r�rr8r9r�rsr1�execver2rmr2r��del_volume_info)rr��mf_len�vols    rr��Restart.checkManifest�sb���R�(�(�)���n�n�$�f������~�~��"��
�
��[���� � �'�'�)��	�	�#�(�(�1�+�s�x�x����<��.�.�(�1�,��
�
��C���~�~��)�6�>�>�A�3E�F�	G��!����!�!3�V�a�Z�@�C��&�&�s�+�A��
�
��V��
�~�~�.�/��� � �'�'�)��	�	�#�(�(�1�+�s�x�x����<�C:Hrc��URURnURUlUR=(d SUlgr)r�r�rdrRrerS)rr�r�s   rr��Restart.setLastSaveds1��
�
 �
 ����
0���,�,����,�,�+�!��r)r@r�rSrRr�r�r�r]N)
r�r�r�r�rrrxr�r�r�r_rrrvrv�s���
#�6�#=�J,rrvc�(�S[R;aA[R"[	[S55[RR5 [RSSS:Xa[R"S5 [R"5S:XaR[R"[R"55 [R"[R"55 [R "5 ["R$"[R&SS5n[(R*"5 [-[R.5 [1U5 [(R2"5 g![(R2"5 f=f)	z
Start/end here
�PYTHONOPTIMIZEa(                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
                Nr,)��z�Starting deprecation of python 3.8 support. Support for python 3.8. will finally removed with the release of 3.14.  For details see https://devguide.python.org/versions/rr.)r1r2rrorr9rX�pythonoptimize_setr2�version_inforV�geteuid�setuid�setgid�getegidr
rCr�process_command_linermr�acquire_lockfilertr^�	do_backup�release_lockfile)rCs r�mainr�s	���2�:�:�%��������

�
�M�M�,�,�
	
� ������v�%����
V�	
�
�z�z�|�q��
�	�	�"�*�*�,��
�	�	�"�*�*�,��
�����
*�
*�3�8�8�A�B�<�
8�F�	�����c�h�h�� ��&�����������s�E:�:Fc�$�[R(a%[R"[R5 O[R"5 [	U5 [
R"[R[RU5R5nUS;a[U5 US;Ga�UR5nU(dGO�UR5nUR(GaaUS;a�[U5[l[RR nUS:Xa/[R"[RR"5 O\[R"[RR$5 [R&"[RR(5 [*R,"[/SUS355 Oz[*R,"[/SUS	355 UR15 [
R"[R[RU5R5nGM�OUR35nUS
:�a9[*R,"[/S5S[R4"U535 O[*R,"[/S
55 [R(d]US;aW[R6bFU[R8[R6-
:a![*R,"[/S55 Sn[*R:"U5 [=SU5[R>l US:Xa
[CU5 GO@US:Xa
[EU5 GO-US:Xa
[GU5 GOUS:XGa[RHb�[RJ(d([*RL"U[RHS5 GO�URO[RH5n[*RP"[SU5S[*RTRVSS5 GOi[RX(d[*R:"US5 GO;[*RZ"U[RXS5 GOUS:Xa
[]U5 GOUS:Xa
[_U5 GO�US:XdUS:Xa
[aU5 GO�US:Xa
[U5 GO�US;dU5e[R>Rb(a [=SUS5[R>l2[R>Rf(d�[R>Rh(d�[=SU5[R>l [R>Rd(an[R>R@[R>Rd:wa8[*Rj"[/S5[*RlRn5 US:Xa[qU5 Oy[sU5nU(d[qU5 O[[R(d;URt(a*[=SU5[R>l [wU5 [yXa5 [RR{5 [*R|"5 [~b[�R�"[~5 gg)N)r$r&r'r(T)r)r*r�)r)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*z0Last full backup is too old, forcing full backupr.rlr+r%r$r�r�zremove-older-thanr&r'r8r,z]When using symmetric encryption, the signing passphrase must equal the encryption passphrase.)Br	�current_timer
rCrkr�CollectionsStatusr{r�r%rH�get_last_backup_chainrLr�rvr<r]r�r@r?r�rr8r9rs�get_last_full_backup_timerY�full_if_older_thanrA�PrintCollectionStatusrHr4r?rlr+rd�show_changes_in_setrM�PrintCollectionChangesInSet�get_changes_in_set_jsonr@�strr_�collection_status�file_changed� PrintCollectionFileChangedStatusr�r�r�r5r>r6r7rorX�
user_errorr2r8r�rOrKr�r�r�r2�exit)rCr1�last_full_chainr��last_full_timerQrHs       rr�r�Ss���
������F�/�/�0������F�� �1�1�&�.�.�&�BY�BY�[a�b�m�m�o�I����	�Y��
��/�/�'�=�=�?�O�"��)�2�2�4�K��"�"�"��_�,�%,�[�%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��g���%�%�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����(�0�&�0�(����&�&�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�8�
�N�N�����L�L�N��������r)Fr{)@�dataclassesrr1rnr\r2r��textwrapr�typingr�	duplicityrrrr	r
rrr
rrrrrrrrr�duplicity.errorsrr�rrHrPr\r�rrrr2r8r0rKr/rdrlrfr�r�r�r+r�r�r�rHrOrkr^rtr0rvr�r�r_rr�<module>r�s��B"�	���
����!�"����%���!���������/���$�E�P
�(+
�\W�t�2�2�2:3�z+�,
9�F3�R&�4Q�(o�047�n+�\
,� %�2�@!
�H�"S
�la�H?�"2�j!$���	!�E,�f�E,�P4 �nTr

Filemanager

Name Type Size Permission Actions
__init__.cpython-313.pyc File 398 B 0644
__main__.cpython-313.pyc File 4.74 KB 0644
argparse311.cpython-313.pyc File 98.99 KB 0644
backend.cpython-313.pyc File 32.15 KB 0644
backend_pool.cpython-313.pyc File 18.72 KB 0644
cached_ops.cpython-313.pyc File 1.09 KB 0644
cli_data.cpython-313.pyc File 32.01 KB 0644
cli_main.cpython-313.pyc File 14.13 KB 0644
cli_util.cpython-313.pyc File 22.31 KB 0644
config.cpython-313.pyc File 5.74 KB 0644
diffdir.cpython-313.pyc File 31.95 KB 0644
dup_collections.cpython-313.pyc File 63.51 KB 0644
dup_main.cpython-313.pyc File 78.6 KB 0644
dup_tarfile.cpython-313.pyc File 432 B 0644
dup_temp.cpython-313.pyc File 12.87 KB 0644
dup_time.cpython-313.pyc File 11.17 KB 0644
errors.cpython-313.pyc File 3.53 KB 0644
file_naming.cpython-313.pyc File 16.93 KB 0644
filechunkio.cpython-313.pyc File 3.83 KB 0644
globmatch.cpython-313.pyc File 6.01 KB 0644
gpg.cpython-313.pyc File 20.98 KB 0644
gpginterface.cpython-313.pyc File 25.69 KB 0644
lazy.cpython-313.pyc File 17 KB 0644
librsync.cpython-313.pyc File 11.48 KB 0644
log.cpython-313.pyc File 19.18 KB 0644
manifest.cpython-313.pyc File 23.66 KB 0644
patchdir.cpython-313.pyc File 27.63 KB 0644
path.cpython-313.pyc File 43.08 KB 0644
progress.cpython-313.pyc File 14.45 KB 0644
robust.cpython-313.pyc File 1.91 KB 0644
selection.cpython-313.pyc File 31.35 KB 0644
statistics.cpython-313.pyc File 18.78 KB 0644
tempdir.cpython-313.pyc File 12.04 KB 0644
util.cpython-313.pyc File 16.51 KB 0644
Filemanager