summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Raghavan <ford_prefect@gentoo.org>2008-12-28 00:22:31 +0530
committerArun Raghavan <ford_prefect@gentoo.org>2008-12-28 00:22:31 +0530
commitb6056a474925b3e990530b252d586a541e5588e7 (patch)
tree462b5fd1bac8a3f3e3cd41e9e6ce76f57a7218d7
parentAdd support for gentoo-portage (diff)
downloadgard-b6056a474925b3e990530b252d586a541e5588e7.tar.gz
gard-b6056a474925b3e990530b252d586a541e5588e7.tar.bz2
gard-b6056a474925b3e990530b252d586a541e5588e7.zip
Add support for distfiles over rsync - to be tested
-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):