[sysadmin-bin] enable doap cache
- From: Olav Vitters <ovitters src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin] enable doap cache
- Date: Tue, 20 Jan 2015 21:11:42 +0000 (UTC)
commit fa06327c2587ff4fdf068e2cb4350828f1eabc06
Author: Olav Vitters <olav vitters nl>
Date: Tue Jan 20 22:11:38 2015 +0100
enable doap cache
ftpadmin | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/ftpadmin b/ftpadmin
index f94c88e..3665b00 100755
--- a/ftpadmin
+++ b/ftpadmin
@@ -314,7 +314,7 @@ class DOAP(BasicInfo):
self.jsonfile = self.DOAP_CACHE
self._init_doap()
- def _init_doap(self):
+ def _init_doap(self, force_refresh=False):
# Get module maintainer data from DOAP file in Git
# Note: some data is still in MAINTAINERS files. These are converted
@@ -335,7 +335,7 @@ class DOAP(BasicInfo):
j = json.load(open(self.jsonfile, 'rb'))
json_ver = j[0]
if json_ver == self.JSONVERSION:
- json_ver, etag, last_modified, UID_TO_MODULES, TARBALL_TO_MODULE, info = j
+ json_ver, etag, last_modified, info, TARBALL_TO_MODULE, UID_TO_MODULES = j
if not len(info):
force_refresh=True
elif json_ver > self.JSONVERSION:
@@ -356,14 +356,16 @@ class DOAP(BasicInfo):
# Always need to check if there's any newer information
url_handle = urllib2.urlopen(req)
except urllib2.HTTPError, e:
- if e.code == '304':
+ if e.code == 304:
pass
elif force_refresh:
print >>sys.stderr, "ERROR: Cannot read DOAP file and no old copy available"
else:
+ print e.code
print >>sys.stderr, "WARNING: Cannot retrieve DOAP file; using old copy"
else:
- etag, last_modified, UID_TO_MODULES, TARBALL_TO_MODULE, info = self._parse_url_handle(url_handle)
+ etag, last_modified, info, TARBALL_TO_MODULE, UID_TO_MODULES = self._parse_url_handle(url_handle)
+ changed = True
self.etag = etag
self.last_modified = last_modified
@@ -440,7 +442,7 @@ class DOAP(BasicInfo):
val = node.find_properties((self.NS_DOAP, prop))
if val: MODULE_INFO[modname][prop] = list(val)
- return (etag, last_modified, UID_TO_MODULES, TARBALL_TO_MODULE, MODULE_INFO)
+ return (etag, last_modified, MODULE_INFO, TARBALL_TO_MODULE, UID_TO_MODULES)
def write_json(self):
# Want to overwrite any existing file and change the owner
@@ -924,7 +926,7 @@ class ModuleInfo(DirectoryInfo):
return self.doap.info.get(self._reponame, {}).get(needle, default)
def get_bz_product_from_doap(self):
- for bz in self.get_from_doap('bug-database'):
+ for bz in self.get_from_doap('bug-database', []):
url = urlparse.urlparse(bz)
if url.netloc == 'bugzilla.gnome.org':
d = urlparse.parse_qs(url.query)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]