os.chdir(incoming)
# Remove a file to the morgue
-def remove (file):
- if os.access(file, os.R_OK):
- dest_filename = del_dir + '/' + os.path.basename(file)
+def remove (f):
+ if os.access(f, os.R_OK):
+ dest_filename = del_dir + '/' + os.path.basename(f)
# If the destination file exists; try to find another filename to use
if os.path.exists(dest_filename):
dest_filename = daklib.utils.find_next_free(dest_filename, 10)
- daklib.utils.move(file, dest_filename, 0660)
+ daklib.utils.move(f, dest_filename, 0660)
else:
- daklib.utils.warn("skipping '%s', permission denied." % (os.path.basename(file)))
+ daklib.utils.warn("skipping '%s', permission denied." % (os.path.basename(f)))
# Removes any old files.
# [Used for Incoming/REJECT]
#
def flush_old ():
- for file in os.listdir('.'):
- if os.path.isfile(file):
- if os.stat(file)[stat.ST_MTIME] < delete_date:
+ for f in os.listdir('.'):
+ if os.path.isfile(f):
+ if os.stat(f)[stat.ST_MTIME] < delete_date:
if Options["No-Action"]:
- print "I: Would delete '%s'." % (os.path.basename(file))
+ print "I: Would delete '%s'." % (os.path.basename(f))
else:
if Options["Verbose"]:
- print "Removing '%s' (to '%s')." % (os.path.basename(file), del_dir)
- remove(file)
+ print "Removing '%s' (to '%s')." % (os.path.basename(f), del_dir)
+ remove(f)
else:
if Options["Verbose"]:
- print "Skipping, too new, '%s'." % (os.path.basename(file))
+ print "Skipping, too new, '%s'." % (os.path.basename(f))
# Removes any files which are old orphans (not associated with a valid .changes file).
# [Used for Incoming]
continue
dsc_files = {}
- for file in files.keys():
- if file.endswith(".dsc"):
+ for f in files.keys():
+ if f.endswith(".dsc"):
try:
- dsc = daklib.utils.parse_changes(file)
+ dsc = daklib.utils.parse_changes(f)
dsc_files = daklib.utils.build_file_list(dsc, is_a_dsc=1)
except:
- daklib.utils.warn("error processing '%s'; skipping it. [Got %s]" % (file, sys.exc_type))
+ daklib.utils.warn("error processing '%s'; skipping it. [Got %s]" % (f, sys.exc_type))
continue
# Ensure all the files we've seen aren't deleted
# Anthing left at this stage is not referenced by a .changes (or
# a .dsc) and should be deleted if old enough.
- for file in all_files.keys():
- if os.stat(file)[stat.ST_MTIME] < delete_date:
+ for f in all_files.keys():
+ if os.stat(f)[stat.ST_MTIME] < delete_date:
if Options["No-Action"]:
- print "I: Would delete '%s'." % (os.path.basename(file))
+ print "I: Would delete '%s'." % (os.path.basename(f))
else:
if Options["Verbose"]:
- print "Removing '%s' (to '%s')." % (os.path.basename(file), del_dir)
- remove(file)
+ print "Removing '%s' (to '%s')." % (os.path.basename(f), del_dir)
+ remove(f)
else:
if Options["Verbose"]:
- print "Skipping, too new, '%s'." % (os.path.basename(file))
+ print "Skipping, too new, '%s'." % (os.path.basename(f))
################################################################################