142 | 142 |
from_dir, to_dir = obtain_dirs_for_stream(router, options.stream_name)
|
143 | 143 |
|
144 | 144 |
active = False
|
145 | |
if options.skip_until:
|
146 | |
print("Skipping until", options.skip_until)
|
|
145 |
if options.continue_from:
|
|
146 |
print("Continuing from", options.continue_from)
|
147 | 147 |
else:
|
148 | 148 |
active = True
|
149 | 149 |
|
150 | |
manifest = "/tmp/manifest.lst"
|
151 | |
if not os.path.isfile(manifest):
|
152 | |
print("Cannot read", manifest)
|
153 | |
print("Collecting manifest")
|
154 | |
with open(manifest, "w") as f:
|
|
150 |
if not options.manifest:
|
|
151 |
# TODO get tmpdir for system
|
|
152 |
manifest_filename = "/tmp/ellsync-manifest-{}.lst".format(options.stream_name)
|
|
153 |
else:
|
|
154 |
manifest_filename = options.manifest
|
|
155 |
if not os.path.isfile(manifest_filename):
|
|
156 |
print("Cannot read {}, creating it".format(manifest_filename))
|
|
157 |
with open(manifest_filename, "w") as f:
|
155 | 158 |
traverse_directories(f, from_dir)
|
156 | 159 |
|
157 | |
print("Traversing manifest")
|
158 | |
|
159 | |
with open(manifest, "r") as f:
|
|
160 |
print("Traversing manifest {}".format(manifest_filename))
|
|
161 |
|
|
162 |
with open(manifest_filename, "r") as f:
|
160 | 163 |
for line in f:
|
161 | 164 |
path = line.strip()
|
162 | |
if path == options.skip_until:
|
|
165 |
|
|
166 |
if not active and path == options.continue_from:
|
|
167 |
print("Found {}, resuming verify".format(options.continue_from))
|
163 | 168 |
active = True
|
164 | |
|
|
169 |
if not active:
|
|
170 |
continue
|
165 | 171 |
if os.path.isdir(path):
|
166 | |
continue
|
167 | |
if not active:
|
168 | |
print("skipping ", path)
|
169 | 172 |
continue
|
170 | 173 |
|
171 | 174 |
# execute diff --brief --new-file "$F" "$TARGET$F"
|
|
217 | 220 |
parser_verify.add_argument('stream_name', metavar='STREAM', type=str,
|
218 | 221 |
help='Name of stream (or stream:subdirectory) to verify across'
|
219 | 222 |
)
|
220 | |
parser_verify.add_argument('--skip-until', default=None, type=str,
|
221 | |
help='If given, do not start verification until (i.e. continue verification at) this filename'
|
|
223 |
parser_verify.add_argument('--manifest', metavar='FILENAME', default=None, type=str,
|
|
224 |
help='Specify the name of the manifest file to use. If not given, a name derived from '
|
|
225 |
'the name of the stream will be used. If the file does not exist, it will be created.'
|
|
226 |
)
|
|
227 |
parser_verify.add_argument('--continue-from', metavar='FILENAME', default=None, type=str,
|
|
228 |
help='If given, skip over filenames in the manifest until seeing this filename'
|
222 | 229 |
)
|
223 | 230 |
parser_verify.set_defaults(func=verify)
|
224 | 231 |
|