diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2022-02-17 13:53:03 +0100 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2022-02-17 13:53:03 +0100 |
commit | 2823c030a44b510a4e7db883f53dc825cb4abc55 (patch) | |
tree | 65003011c039d1b23bbc4665aed441d59c10bb2a /hosts/vidhar | |
parent | 362ff67a0e958ec0d06ff223c73d57cd20310c77 (diff) | |
download | nixos-2823c030a44b510a4e7db883f53dc825cb4abc55.tar nixos-2823c030a44b510a4e7db883f53dc825cb4abc55.tar.gz nixos-2823c030a44b510a4e7db883f53dc825cb4abc55.tar.bz2 nixos-2823c030a44b510a4e7db883f53dc825cb4abc55.tar.xz nixos-2823c030a44b510a4e7db883f53dc825cb4abc55.zip |
vidhar: ...
Diffstat (limited to 'hosts/vidhar')
-rwxr-xr-x | hosts/vidhar/borg/copy.py | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/hosts/vidhar/borg/copy.py b/hosts/vidhar/borg/copy.py index e574f2e0..cbd12469 100755 --- a/hosts/vidhar/borg/copy.py +++ b/hosts/vidhar/borg/copy.py | |||
@@ -57,26 +57,27 @@ class ToSync: | |||
57 | return self | 57 | return self |
58 | 58 | ||
59 | def __next__(self): | 59 | def __next__(self): |
60 | if to_sync: | ||
61 | return self.to_sync.pop() | ||
62 | |||
60 | while True: | 63 | while True: |
61 | try: | 64 | try: |
62 | if to_sync: | ||
63 | return self.to_sync.pop() | ||
64 | |||
65 | src = read_repo(args.source) | 65 | src = read_repo(args.source) |
66 | dst = read_repo(args.target) | 66 | dst = read_repo(args.target) |
67 | self.to_sync = set() | ||
68 | for entry in src: | ||
69 | if entry['name'] not in {dst_entry['name'] for dst_entry in dst} and not entry['name'].endswith('.checkpoint'): | ||
70 | self.to_sync.add(entry) | ||
71 | |||
72 | if to_sync: | ||
73 | return self.to_sync.pop() | ||
74 | |||
75 | raise StopIteration | ||
76 | except (subprocess.CalledProcessError, json.decoder.JSONDecodeError) as err: | 67 | except (subprocess.CalledProcessError, json.decoder.JSONDecodeError) as err: |
77 | print(err, file=stderr) | 68 | print(err, file=stderr) |
78 | continue | 69 | continue |
79 | 70 | ||
71 | self.to_sync = set() | ||
72 | for entry in src: | ||
73 | if entry['name'] not in {dst_entry['name'] for dst_entry in dst} and not entry['name'].endswith('.checkpoint'): | ||
74 | self.to_sync.add(entry) | ||
75 | |||
76 | if to_sync: | ||
77 | return self.to_sync.pop() | ||
78 | |||
79 | raise StopIteration | ||
80 | |||
80 | def copy_archive(src_repo_path, dst_repo_path, entry): | 81 | def copy_archive(src_repo_path, dst_repo_path, entry): |
81 | cache_suffix = None | 82 | cache_suffix = None |
82 | with Halo(text=f'Determine archive parameters', **halo_args) as sp: | 83 | with Halo(text=f'Determine archive parameters', **halo_args) as sp: |