summaryrefslogtreecommitdiffstats
path: root/files/scripts/create-filelist
diff options
context:
space:
mode:
authorKevin Fenzi <kevin@scrye.com>2016-06-22 21:51:06 +0000
committerKevin Fenzi <kevin@scrye.com>2016-06-22 21:51:06 +0000
commitd5e67b45fe1b39e58c9b6dbe8bd2b17ae2292950 (patch)
treeee04e8ce1033c8c61e2cfe2d48e9e6c0aa28b855 /files/scripts/create-filelist
parentf4b3c5e6241d5cba8d5df2f07caa93eb7e48ccb4 (diff)
downloadansible-d5e67b45fe1b39e58c9b6dbe8bd2b17ae2292950.tar.gz
ansible-d5e67b45fe1b39e58c9b6dbe8bd2b17ae2292950.tar.xz
ansible-d5e67b45fe1b39e58c9b6dbe8bd2b17ae2292950.zip
Some server side improvements for quick-mirror
Diffstat (limited to 'files/scripts/create-filelist')
-rwxr-xr-xfiles/scripts/create-filelist16
1 files changed, 10 insertions, 6 deletions
diff --git a/files/scripts/create-filelist b/files/scripts/create-filelist
index 836cc7663..adf8104c6 100755
--- a/files/scripts/create-filelist
+++ b/files/scripts/create-filelist
@@ -36,7 +36,7 @@ def sha1(fname):
return sha1.hexdigest()
-def recursedir(path='.', skip=[]):
+def recursedir(path='.', skip=[], alwaysskip=['.~tmp~']):
"""Just like scandir, but recursively.
Will skip everything in the skip array, but only at the top level
@@ -45,8 +45,11 @@ def recursedir(path='.', skip=[]):
for entry in scandir(path):
if entry.name in skip:
continue
+ if entry.name in alwaysskip:
+ continue
if entry.is_dir(follow_symlinks=False):
- for rentry in recursedir(entry.path):
+ # Don't pass skip here, because we only skip in the top level
+ for rentry in recursedir(entry.path, alwaysskip=alwaysskip):
yield rentry
yield entry
@@ -60,16 +63,16 @@ 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 fullfiletimelist in the top directory')
+ help='Skip the --filelist file in the top directory')
p.add_argument('-S', '--skip-file', action='append', dest='skip_files',
help='Skip the specified file in the top directory.')
p.add_argument('-d', '--dir', help='Directory to scan (default: .).')
p.add_argument('-t', '--timelist', type=argparse.FileType('w'), default=sys.stdout,
- help='Filename of the file list with times (default: fullfiletimelist).')
+ help='Filename of the file list with times (default: stdout).')
p.add_argument('-f', '--filelist', type=argparse.FileType('w'), default=null,
- help='Filename of the file list without times (default: fullfilelist).')
+ help='Filename of the file list without times (default: no plain file list is generated).')
opts = p.parse_args()
@@ -82,7 +85,8 @@ def parseopts():
opts.skip_files = opts.skip_files or []
if opts.skip:
- opts.skip_files += ['fullfiletimelist']
+ if not opts.timelist.name == '<stdout>':
+ opts.skip_files += [opts.timelist.name]
return opts