Previously we only checked if a file had been modified since our last
run. That didn't catch changes that were only made visible for the next
run. I.e. a file was changed on some host, ud-generate runs finds no
need to re-generate and stores timestamp X to its statefile. We rsync
that file to us and on the next ud-geneate run it finds no files
modified since X.
UUID_FORMAT = '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'
UUID_FORMAT = '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'
EmailCheck = re.compile("^([^ <>@]+@[^ ,<>@]+)(,\s*([^ <>@]+@[^ ,<>@]+))*$")
BSMTPCheck = re.compile(".*mx 0 (master)\.debian\.org\..*",re.DOTALL)
EmailCheck = re.compile("^([^ <>@]+@[^ ,<>@]+)(,\s*([^ <>@]+@[^ ,<>@]+))*$")
BSMTPCheck = re.compile(".*mx 0 (master)\.debian\.org\..*",re.DOTALL)
if mt > krmod:
krmod = mt
if mt > krmod:
krmod = mt
def getLastBuildTime(gdir):
cache_last_ldap_mod = 0
cache_last_unix_mod = 0
def getLastBuildTime(gdir):
cache_last_ldap_mod = 0
cache_last_unix_mod = 0
try:
fd = open(os.path.join(gdir, "last_update.trace"), "r")
try:
fd = open(os.path.join(gdir, "last_update.trace"), "r")
try:
cache_last_ldap_mod = cache_last_mod[0]
cache_last_unix_mod = int(cache_last_mod[1])
try:
cache_last_ldap_mod = cache_last_mod[0]
cache_last_unix_mod = int(cache_last_mod[1])
+ cache_last_run = int(cache_last_mod[2])
except IndexError, ValueError:
pass
fd.close()
except IndexError, ValueError:
pass
fd.close()
- return (cache_last_ldap_mod, cache_last_unix_mod)
+ return (cache_last_ldap_mod, cache_last_unix_mod, cache_last_run)
def ud_generate():
parser = optparse.OptionParser()
def ud_generate():
parser = optparse.OptionParser()
time_started = int(time.time())
ldap_last_mod = getLastLDAPChangeTime(l)
unix_last_mod = getLastKeyringChangeTime()
time_started = int(time.time())
ldap_last_mod = getLastLDAPChangeTime(l)
unix_last_mod = getLastKeyringChangeTime()
- cache_last_ldap_mod, cache_last_unix_mod = getLastBuildTime(generate_dir)
+ cache_last_ldap_mod, cache_last_unix_mod, last_run = getLastBuildTime(generate_dir)
- need_update = (ldap_last_mod > cache_last_ldap_mod) or (unix_last_mod > cache_last_unix_mod)
+ need_update = (ldap_last_mod > cache_last_ldap_mod) or (unix_last_mod > cache_last_unix_mod) or (time_started - last_run > MAX_UD_AGE)
if not options.force and not need_update:
fd = open(os.path.join(generate_dir, "last_update.trace"), "w")
if not options.force and not need_update:
fd = open(os.path.join(generate_dir, "last_update.trace"), "w")
- fd.write("%s\n%s\n" % (ldap_last_mod, time_started))
+ fd.write("%s\n%s\n%s\n" % (ldap_last_mod, unix_last_mod, last_run))
fd.close()
sys.exit(0)
tracefd = open(os.path.join(generate_dir, "last_update.trace"), "w")
generate_all(generate_dir, l)
fd.close()
sys.exit(0)
tracefd = open(os.path.join(generate_dir, "last_update.trace"), "w")
generate_all(generate_dir, l)
- tracefd.write("%s\n%s\n" % (ldap_last_mod, time_started))
+ tracefd.write("%s\n%s\n%s\n" % (ldap_last_mod, unix_last_mod, time_started))