[sysadmin-bin: 5/6] Update gitlab-operations.py to not hardcode mainline branch name



commit bfc14d3fedce55deb2c65920a02cfde1455a1026
Author: Michael Gratton <mike vee net>
Date:   Fri Apr 5 12:28:41 2019 +1100

    Update gitlab-operations.py to not hardcode mainline branch name

 gitlab/gitlab-operations.py | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/gitlab/gitlab-operations.py b/gitlab/gitlab-operations.py
index dbe3a5b..dc9a326 100755
--- a/gitlab/gitlab-operations.py
+++ b/gitlab/gitlab-operations.py
@@ -92,10 +92,15 @@ for project in projects:
     project_name = project.attributes['path']
     uids = []
 
+    doap_url = 'https://gitlab.gnome.org/GNOME/%s/raw/%s/%s.doap'
+    branch_name = project.attributes.get('default_branch')
+    if not branch_name:
+        branch_name = 'master'
+    nodes = ''
     try:
-        nodes = semi_rdf.read_rdf('https://gitlab.gnome.org/GNOME/%s/raw/master/%s.doap' % (project_name, 
project_name))
+        nodes = semi_rdf.read_rdf(doap_url % (project_name, branch_name, project_name))
     except SAXParseException:
-        nodes = ''
+        print 'Failed to download DOAP for %s: %s' % (project_name, e)
 
     for node in nodes:
       if node.name != (DOAP, "Project"):
@@ -112,11 +117,11 @@ for project in projects:
         uid = str(uid)
         uids.append(uid)
 
-        maints[project_name] = uids
+        maints[project_name] = (project, uids)
 
 for project in maints:
-    proj = gl.projects.get('GNOME/%s' % project)
-    for user in maints[project]:
+    proj, uids = maints[project]
+    for user in uids:
         if user in gnomeusers_dict:
             userid = gnomeusers_dict[user]
             try:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]