[Blends-commit] [Git][blends-team/website][master] 2 commits: Avoid failures for empty list

Andreas Tille gitlab at salsa.debian.org
Mon Mar 12 11:14:47 UTC 2018


Andreas Tille pushed to branch master at Debian Blends Team / website


Commits:
460575c3 by Andreas Tille at 2018-03-12T11:25:52+01:00
Avoid failures for empty list

- - - - -
17f7b6d4 by Andreas Tille at 2018-03-12T12:13:44+01:00
Use python3-gitlab to fetch machine readable data from salsa: 1st step - get relevant blends groups

- - - - -


2 changed files:

- misc/machine_readable/fetch-machine-readable_salsa
- + misc/machine_readable/fetch-machine-readable_salsa.py


Changes:

=====================================
misc/machine_readable/fetch-machine-readable_salsa
=====================================
--- a/misc/machine_readable/fetch-machine-readable_salsa
+++ b/misc/machine_readable/fetch-machine-readable_salsa
@@ -47,11 +47,13 @@ list_salsa_projects () {
   TOTAL_PAGES=$(grep ^X-Total-Pages: $HEADERS_FILE)
   TOTAL_PAGES=${TOTAL_PAGES#*: }
 
-  while [ $PAGENO -lt $TOTAL_PAGES ]
-  do
-    PAGENO=$((PAGENO+1))
-    get_one_page
-  done
+  if [ "$TOTAL_PAGES" != "" ] ; then
+    while [ $PAGENO -lt $TOTAL_PAGES ]
+    do
+      PAGENO=$((PAGENO+1))
+      get_one_page
+    done
+  fi
 }
 
 mkdir -p $TARGETDIR


=====================================
misc/machine_readable/fetch-machine-readable_salsa.py
=====================================
--- /dev/null
+++ b/misc/machine_readable/fetch-machine-readable_salsa.py
@@ -0,0 +1,46 @@
+#!/usr/bin/python3
+
+import gitlab
+import os
+
+PER_PAGE=99
+
+BLENDSGROUPS=[ 'Debian 3D Printing Team'
+             , 'Debian Accessibility Team'
+             , 'Debian Astro Team'
+             , 'Debian Edu Packaging Team'
+             , 'Debian Electronics'
+             , 'Debian Games'
+             , 'Debian GIS Project'
+             , 'Debian Hamradio Maintainers'
+             , 'Debian IoT'
+             , 'Debian Med'
+             , 'Debian Multimedia Team'
+             , 'Debian PhotoTools Team'
+             , 'Debian R Packages Maintainers'
+             , 'Debian Science Team'
+             , 'Debichem'
+             ]
+
+def get_blends_groups():
+    blends_groups=[]
+    groups = gl.groups.list(all=True)
+    for group in groups:
+        # print(group.attributes['name'])
+        if group.attributes['name'] in BLENDSGROUPS:
+            blends_groups.append(group.attributes)
+    return blends_groups
+
+# SALSA_TOKEN=os.environ['SALSA_TOKEN']
+
+gl = gitlab.Gitlab("https://salsa.debian.org") # , private_token=SALSA_TOKEN) # anonymous access is fine
+
+blends_groups = get_blends_groups()
+for group in blends_groups:
+    print(group['name'], group['id'], group['path'], group['description'], group['full_name'])
+
+
+#for project in git.getall(git.getprojects):
+#    print(project['name'], project['path_with_namespace'], project['id'])
+    # getrawfile(project['id'], 'master', 'debian/changelog')
+    # getfile(project['id'], 'debian/changelog', 'master')
\ No newline at end of file



View it on GitLab: https://salsa.debian.org/blends-team/website/compare/abda6e492c7e8dafa9ceceffbe52c53e969e8d45...17f7b6d41dc62857080f8f857524749abe09e0ad

---
View it on GitLab: https://salsa.debian.org/blends-team/website/compare/abda6e492c7e8dafa9ceceffbe52c53e969e8d45...17f7b6d41dc62857080f8f857524749abe09e0ad
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/blends-commit/attachments/20180312/ecbdd24e/attachment-0001.html>


More information about the Blends-commit mailing list