[sysadmin-bin] slightly more intelligent tarball to module logic
- From: Olav Vitters <ovitters src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin] slightly more intelligent tarball to module logic
- Date: Tue, 20 Jan 2015 21:25:37 +0000 (UTC)
commit 914c8df5e07431f656e86a1b6768bda883622f15
Author: Olav Vitters <olav vitters nl>
Date: Tue Jan 20 22:25:32 2015 +0100
slightly more intelligent tarball to module logic
ftpadmin | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/ftpadmin b/ftpadmin
index 3665b00..7f7961d 100755
--- a/ftpadmin
+++ b/ftpadmin
@@ -314,6 +314,17 @@ class DOAP(BasicInfo):
self.jsonfile = self.DOAP_CACHE
self._init_doap()
+ def get_module(self, tarball):
+ modules = doap.tarball_to_module.get(tarball, [])
+ if not modules: modules.append(tarball)
+
+ if len(modules) == 1:
+ return list(modules)[0]
+ elif tarball in modules:
+ return tarball
+ else:
+ return sorted(modules, key=len)[0]
+
def _init_doap(self, force_refresh=False):
# Get module maintainer data from DOAP file in Git
@@ -386,7 +397,6 @@ class DOAP(BasicInfo):
headers = url_handle.info()
etag = headers.getheader("ETag")
- etag = headers.getheader("ETagsss")
last_modified = headers.getheader("Last-Modified")
nodes = semi_rdf.read_rdf(url_handle)
@@ -889,14 +899,8 @@ class ModuleInfo(DirectoryInfo):
self._maintainers = []
self._reponame = self.module
-
- modules = doap.tarball_to_module.get(self.module, [])
- if not modules: modules.append(self.module)
- if len(modules) == 1:
- self._reponame = self.module
- else:
- self._reponame = list(modules)[0]
+ self._reponame = doap.get_module(self.module)
# XXX - restrict to gnomecvs users
self._maintainers = doap.info.get(self._reponame, {}).get('maintainers', [])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]