summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWill Woods <wwoods@redhat.com>2009-03-06 12:07:46 -0500
committerWill Woods <wwoods@redhat.com>2009-03-06 12:07:46 -0500
commit5c4def49104ce63bf86947c2c4e13f4c754490ba (patch)
treefc94f2fa1c4595abc224770cbb1bc7b789707a15
parentd938a25d2b98780e4744fc9ce26f91a14598e640 (diff)
downloaddebuginfofs-5c4def49104ce63bf86947c2c4e13f4c754490ba.zip
debuginfofs-5c4def49104ce63bf86947c2c4e13f4c754490ba.tar.gz
debuginfofs-5c4def49104ce63bf86947c2c4e13f4c754490ba.tar.xz
Add update-mtimes, which will allow us to clean up expired/obsolete files
-rwxr-xr-xserver/debuginfofs-mirror14
1 files changed, 13 insertions, 1 deletions
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?