From 5c4def49104ce63bf86947c2c4e13f4c754490ba Mon Sep 17 00:00:00 2001 From: Will Woods Date: Fri, 6 Mar 2009 12:07:46 -0500 Subject: Add update-mtimes, which will allow us to clean up expired/obsolete files --- server/debuginfofs-mirror | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/server/debuginfofs-mirror b/server/debuginfofs-mirror index 695cef2..154a06c 100755 --- a/server/debuginfofs-mirror +++ b/server/debuginfofs-mirror @@ -82,6 +82,8 @@ class DebuginfoFSDownloader(YumUtilBase): help="download RPMs but don't bother unpacking them") o.add_option("--keep-src", default=False, action="store_true", help="keep the contents of /usr/src/debug from each package") + #o.add_option("--update-mtimes", default=False, action="store_true", + # help="update the mtime of all files from the given repos") def setup(self): self.modify_options() @@ -139,6 +141,15 @@ def fix_perms(targetdir): for f in files: chmod_or(os.path.join(top, f), 0444) +def update_mtimes(targetdir, times=None): + '''Update the utime (mtime/atime) for all files in the given directory.''' + for top, dirs, files in os.walk(targetdir): + os.utime(top, times) + for f in files: + f = os.path.join(top, f) + if not os.path.islink(f): + os.utime(f, times) + def _unpack_rpm(rpm, targetdir, includepat=None, excludepat=None): '''Unpack the given rpm into the given directory''' if not os.path.isdir(targetdir): @@ -293,7 +304,8 @@ def main(): # Skip it if it's already unpacked if os.path.isdir(targetdir): y.logger.info("Already unpacked %s" % nevra) - os.utime(targetdir, None) + #if opt.update_mtimes: + update_mtimes(targetdir) continue # XXX does y.downloadPackages handle this for us? -- cgit