Update create-filelist and wrapper from upstream quick mirror.

Merge all the various copies of the wrapper into one copy.
Setup arguments as needed for each call.
This commit is contained in:
Kevin Fenzi 2016-07-15 20:05:53 +00:00
parent 6685841b7c
commit 03a8923c04
9 changed files with 126 additions and 198 deletions

View file

@ -63,7 +63,7 @@ def parseopts():
p.add_argument('-C', '--checksum-file', action='append', dest='checksum_files',
help='Include checksums of all instances of the specified file.')
p.add_argument('-s', '--skip', action='store_true',
help='Skip the --filelist file in the top directory')
help='Skip the file lists in the top directory')
p.add_argument('-S', '--skip-file', action='append', dest='skip_files',
help='Skip the specified file in the top directory.')
@ -87,6 +87,8 @@ def parseopts():
if opts.skip:
if not opts.timelist.name == '<stdout>':
opts.skip_files += [opts.timelist.name]
if not opts.filelist.name == '<stdout>':
opts.skip_files += [opts.filelist.name]
return opts
@ -114,14 +116,15 @@ def main():
# opts.timelist.write('{0}\t{1}\t{2}\n'.format(modtime, ftype, entry.path[2:]))
print('{0}\t{1}\t{2}\t{3}'.format(modtime, ftype, size, entry.path[2:]), file=opts.timelist)
if not checksums:
sys.exit(0)
print('\n[Checksums SHA1]', file=opts.timelist)
# It's OK if the checksum section is empty, but we should include it anyway
# as the client expects it.
for f in sorted(checksums):
print('{0}\t{1}'.format(sha1(f), f), file=opts.timelist)
print('\n[End]', file=opts.timelist)
if __name__ == '__main__':
main()