[sysadmin-bin: 93/168] Write out a flat repositories.txt along with repositories.cgit
- From: Andrea Veri <av src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin: 93/168] Write out a flat repositories.txt along with repositories.cgit
- Date: Thu, 24 May 2012 19:59:16 +0000 (UTC)
commit 985885c9f9a63d036369c95b4287c42dea2b4383
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Wed Apr 22 20:11:41 2009 -0400
Write out a flat repositories.txt along with repositories.cgit
Write a list of repositories out in a form suitable for serving
up of HTTP for automated use. (Just has the repository name for right
now, maybe replace with JSON or XML later, if we need something more
sophisticated.)
find-cgit-repos | 25 +++++++++++++++++--------
update-cgit | 1 +
2 files changed, 18 insertions(+), 8 deletions(-)
---
diff --git a/find-cgit-repos b/find-cgit-repos
index a51391a..b296ccf 100755
--- a/find-cgit-repos
+++ b/find-cgit-repos
@@ -3,6 +3,7 @@
# This script should be run with the output written to /git/cgit.repositories, which
# is included from /etc/cgitrc
+from optparse import OptionParser
import os
import re
@@ -29,7 +30,7 @@ for group in grouplist:
def sort_repos(a, b):
return cmp(a[1].lower(), b[1].lower())
-def list_repos (paths):
+def list_repos (paths, flat=False):
for path in paths:
if not os.path.isdir(path):
continue
@@ -64,11 +65,19 @@ def list_repos (paths):
for group in grouplist:
for repo in sorted(groups[group], sort_repos):
- print 'repo.group=%s' % group
- print 'repo.url=%s' % repo[0]
- print 'repo.name=%s' % repo[1]
- print 'repo.desc=%s' % repo[2]
- print 'repo.path=%s' % repo[3]
- print
+ if flat:
+ print repo[0]
+ else:
+ print 'repo.group=%s' % group
+ print 'repo.url=%s' % repo[0]
+ print 'repo.name=%s' % repo[1]
+ print 'repo.desc=%s' % repo[2]
+ print 'repo.path=%s' % repo[3]
+ print
-list_repos (('/git', '/git/preview'))
+parser = OptionParser()
+parser.add_option('', "--flat", action='store_true',
+ help="Produce a flat text file")
+options, args = parser.parse_args()
+
+list_repos (('/git', '/git/preview'), flat=options.flat)
diff --git a/update-cgit b/update-cgit
index c0544d2..9130d6b 100755
--- a/update-cgit
+++ b/update-cgit
@@ -14,4 +14,5 @@ fi
echo -n "Updating the cgit repository list... "
$BINDIR/find-cgit-repos > /git/cgit.repositories
+$BINDIR/find-cgit-repos --flat > /git/repositories.txt
echo "done"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]