From d5e67b45fe1b39e58c9b6dbe8bd2b17ae2292950 Mon Sep 17 00:00:00 2001 From: Kevin Fenzi Date: Wed, 22 Jun 2016 21:51:06 +0000 Subject: [PATCH] Some server side improvements for quick-mirror --- files/scripts/create-filelist | 16 ++++++++++------ files/scripts/update-fullfiletimelist | 2 +- roles/bodhi2/backend/files/update-fullfilelist | 2 +- roles/releng/files/update-fullfilelist | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/files/scripts/create-filelist b/files/scripts/create-filelist index 836cc7663c..adf8104c61 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 == '': + opts.skip_files += [opts.timelist.name] return opts diff --git a/files/scripts/update-fullfiletimelist b/files/scripts/update-fullfiletimelist index 0bd2191b2f..44de5f2121 100755 --- a/files/scripts/update-fullfiletimelist +++ b/files/scripts/update-fullfiletimelist @@ -14,7 +14,7 @@ fi CREATE=/usr/local/bin/create-filelist # A single lockfile for everything we're modifying -LOCKFILE=.lock.create-filelist +LOCKFILE=/srv/.lock.create-filelist # The directory where all of the modules live TOPD=/srv/pub diff --git a/roles/bodhi2/backend/files/update-fullfilelist b/roles/bodhi2/backend/files/update-fullfilelist index 65e4ef4924..83614c1a28 100755 --- a/roles/bodhi2/backend/files/update-fullfilelist +++ b/roles/bodhi2/backend/files/update-fullfilelist @@ -14,7 +14,7 @@ fi CREATE=/usr/local/bin/create-filelist # A single lockfile for everything we're modifying -LOCKFILE=.lock.create-filelist +LOCKFILE=/srv/.lock.create-filelist # The directory where all of the modules live TOPD=/pub diff --git a/roles/releng/files/update-fullfilelist b/roles/releng/files/update-fullfilelist index 65e4ef4924..83614c1a28 100755 --- a/roles/releng/files/update-fullfilelist +++ b/roles/releng/files/update-fullfilelist @@ -14,7 +14,7 @@ fi CREATE=/usr/local/bin/create-filelist # A single lockfile for everything we're modifying -LOCKFILE=.lock.create-filelist +LOCKFILE=/srv/.lock.create-filelist # The directory where all of the modules live TOPD=/pub