[devscripts] 02/02: scripts/reproducible-check: Expire cache file after 1 day.
Chris Lamb
chris at chris-lamb.co.uk
Fri Sep 15 08:45:18 UTC 2017
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch master
in repository devscripts.
commit 6efc2514ac58f65f1f3dd08f71f8fae63b26230e
Author: Chris Lamb <lamby at debian.org>
Date: Fri Sep 15 09:44:24 2017 +0100
scripts/reproducible-check: Expire cache file after 1 day.
---
scripts/reproducible-check | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/scripts/reproducible-check b/scripts/reproducible-check
index d18acd1..ea8ac9f 100755
--- a/scripts/reproducible-check
+++ b/scripts/reproducible-check
@@ -20,6 +20,7 @@ import bz2
import apt
import sys
import json
+import time
import logging
import requests
import argparse
@@ -44,6 +45,7 @@ class ReproducibleCheck(object):
CACHE = os.path.join(xdg_cache_home, NAME, 'reproducible.json.bz2')
VERSION = 1
STATUS_URL = 'https://tests.reproducible-builds.org/debian/reproducible.json.bz2'
+ CACHE_AGE_SECONDS = 86400
@classmethod
def parse(cls):
@@ -105,9 +107,13 @@ class ReproducibleCheck(object):
def update_cache(self):
self.log.debug("Checking cache file %s ...", self.CACHE)
- if os.path.exists(self.CACHE):
- self.log.debug("Cache is up to date")
- return
+ try:
+ if os.path.getmtime(self.CACHE) >= \
+ time.time() - self.CACHE_AGE_SECONDS:
+ self.log.debug("Cache is up to date")
+ return
+ except OSError:
+ pass
self.log.info("Updating cache...")
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git
More information about the devscripts-devel
mailing list