summaryrefslogtreecommitdiffstats
path: root/files/scripts/create-filelist
diff options
context:
space:
mode:
authorKevin Fenzi <kevin@scrye.com>2016-05-28 16:46:28 +0000
committerKevin Fenzi <kevin@scrye.com>2016-05-28 16:46:28 +0000
commit09a1b3e878859bb45e1a7f0048ea4da60312a45d (patch)
treeaa0d901e833ffbc4ef03510e279843652cc72534 /files/scripts/create-filelist
parentc54d26a9f97ac9fbdc89dfb88a8fa8dfd7686b72 (diff)
downloadansible-09a1b3e878859bb45e1a7f0048ea4da60312a45d.tar.gz
ansible-09a1b3e878859bb45e1a7f0048ea4da60312a45d.tar.xz
ansible-09a1b3e878859bb45e1a7f0048ea4da60312a45d.zip
Also update create-filelist
Diffstat (limited to 'files/scripts/create-filelist')
-rwxr-xr-xfiles/scripts/create-filelist17
1 files changed, 11 insertions, 6 deletions
diff --git a/files/scripts/create-filelist b/files/scripts/create-filelist
index d1198c653..836cc7663 100755
--- a/files/scripts/create-filelist
+++ b/files/scripts/create-filelist
@@ -36,9 +36,15 @@ def sha1(fname):
return sha1.hexdigest()
-def recursedir(path='.'):
- """Just like scandir, but recursively."""
+def recursedir(path='.', skip=[]):
+ """Just like scandir, but recursively.
+
+ Will skip everything in the skip array, but only at the top level
+ directory.
+ """
for entry in scandir(path):
+ if entry.name in skip:
+ continue
if entry.is_dir(follow_symlinks=False):
for rentry in recursedir(entry.path):
yield rentry
@@ -46,6 +52,7 @@ def recursedir(path='.'):
def parseopts():
+ null = open(os.devnull, 'w')
p = argparse.ArgumentParser(
description='Generate a list of files and times, suitable for consumption by quick-fedora-mirror.')
p.add_argument('-c', '--checksum', action='store_true',
@@ -61,7 +68,7 @@ def parseopts():
p.add_argument('-t', '--timelist', type=argparse.FileType('w'), default=sys.stdout,
help='Filename of the file list with times (default: fullfiletimelist).')
- p.add_argument('-f', '--filelist', type=argparse.FileType('w'), default=sys.stdout,
+ p.add_argument('-f', '--filelist', type=argparse.FileType('w'), default=null,
help='Filename of the file list without times (default: fullfilelist).')
opts = p.parse_args()
@@ -91,11 +98,9 @@ def main():
print(file=opts.timelist)
print('[Files]', file=opts.timelist)
- for entry in recursedir():
+ for entry in recursedir(skip=opts.skip_files):
# opts.filelist.write(entry.path + '\n')
print(entry.path, file=opts.filelist)
- if entry.name in opts.skip_files:
- continue
if entry.name in opts.checksum_files:
checksums[entry.path[2:]] = True
info = entry.stat(follow_symlinks=False)