summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--check.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/check.py b/check.py
index 3c81eeb..3695f91 100644
--- a/check.py
+++ b/check.py
@@ -8,6 +8,7 @@ import re
import tempfile
import subprocess
import os
+import urlparse
class GardCheck:
# Base class which provides some helper functions
@@ -112,9 +113,23 @@ class GardCheck:
# Check distfiles mirrors
class DistfilesCheck(GardCheck):
def lag(self):
-
- path = '/distfiles/timestamp.chk'
- return self.get_lag(self.url + path)
+ scheme = urlparse.urlparse(self.url).scheme
+ if scheme == 'http' or scheme == 'ftp':
+ path = '/distfiles/timestamp.chk'
+ lag = self.get_lag(self.url + path)
+ else:
+ # XXX: to be tested!
+ file = 'timestamp.x'
+ path = 'distfiles/' + file
+
+ self.get_file_rsync(path)
+
+ url = 'file://%s/%s' % (os.path.abspath(''), file)
+ lag = self.get_lag(url)
+
+ os.remove(file)
+
+ return lag
# Check experimental mirrors
class ExperimentalCheck(GardCheck):