aboutsummaryrefslogtreecommitdiffstats
path: root/mirror-regen.py
diff options
context:
space:
mode:
authorPaul Keith <javelinanddart@gmail.com>2017-05-14 19:01:58 +0200
committerTim Schumacher <timschumi2@arcor.de>2017-05-14 19:56:34 +0200
commit609748d734cdbec782d74f80f5a09dc94a7c5474 (patch)
treed07926ac61d3310471093974b92ca67a905efdef /mirror-regen.py
parent0e2aa06c47b7291239bec3de673b80097e2e3a3b (diff)
downloadmirror-609748d734cdbec782d74f80f5a09dc94a7c5474.tar.gz
mirror-609748d734cdbec782d74f80f5a09dc94a7c5474.tar.bz2
mirror-609748d734cdbec782d74f80f5a09dc94a7c5474.zip
New Python mirror-regen script
Change-Id: I7741903e830ddaf1d834e4c570e4be6887b8111d
Diffstat (limited to 'mirror-regen.py')
-rwxr-xr-xmirror-regen.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/mirror-regen.py b/mirror-regen.py
new file mode 100755
index 0000000..49f607e
--- /dev/null
+++ b/mirror-regen.py
@@ -0,0 +1,38 @@
+#!/usr/bin/python3
+
+import os
+import sys
+try:
+ from github import Github
+except ImportError:
+ print("Please install the pygithub package via pip3")
+ exit(1)
+e = os.environ.copy()
+# Environment variables for github username and api token
+try:
+ u = e["GHUSER"]
+ p = e["GHTOKEN"]
+except KeyError:
+ print("Please set the GHUSER and GHTOKEN environment variables")
+ exit(1)
+
+orgName = "LineageOS"
+org = Github(u, p).get_user(orgName)
+
+file = open("default.xml","w")
+file.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
+file.write("<manifest>\n")
+file.write("\n")
+file.write(" <remote name=\"github\"\n")
+file.write(" fetch=\"..\" />\n")
+file.write("\n")
+file.write(" <default revision=\"master\"\n")
+file.write(" remote=\"github\"\n")
+file.write(" sync-j=\"4\" />\n")
+file.write("\n")
+
+for repo in org.get_repos():
+ file.write(" <project name=\"" + repo.full_name + "\" />\n")
+
+file.write("</manifest>\n")
+file.close()