summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Pipping <sebastian@pipping.org>2009-10-03 02:20:12 +0200
committerSebastian Pipping <sebastian@pipping.org>2009-10-03 02:20:12 +0200
commit58bf4f1b6958ac378a18967a9d835862219fb6ce (patch)
tree90bd317978d265a7aa45e23bfa6ab89cefd79855
parentMake "name" an element (diff)
downloadrepositories-xml-format-58bf4f1b6958ac378a18967a9d835862219fb6ce.tar.gz
repositories-xml-format-58bf4f1b6958ac378a18967a9d835862219fb6ce.tar.bz2
repositories-xml-format-58bf4f1b6958ac378a18967a9d835862219fb6ce.zip
Make gitosis.conf merge script work from a post-update git hook
-rwxr-xr-xmerge-gitosis-conf-into-repositories-xml.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/merge-gitosis-conf-into-repositories-xml.py b/merge-gitosis-conf-into-repositories-xml.py
index 06010ff..fd26102 100755
--- a/merge-gitosis-conf-into-repositories-xml.py
+++ b/merge-gitosis-conf-into-repositories-xml.py
@@ -2,6 +2,16 @@
# Copyright (C) 2009 Sebastian Pipping <sebastian@pipping.org>
# Licensed under GPL 2 or later
+import sys
+import os
+if len(sys.argv) != 1 + 2:
+ print "USAGE:\n python %s foo/gitosis.conf bar/repositories.xml" % \
+ os.path.basename(sys.argv[0])
+ sys.exit(1)
+gitosis_conf_location = sys.argv[1]
+repositories_xml_location = sys.argv[2]
+
+
import xml.etree.ElementTree as ET
from ConfigParser import ConfigParser
import re
@@ -13,9 +23,9 @@ NOT_AN_OVERLAY_MESSAGE = 'Skipping %s (not an overlay)'
gitosis_conf = ConfigParser()
-gitosis_conf.read('gitosis.conf')
+gitosis_conf.read(gitosis_conf_location)
-a = ET.parse(open('repositories.xml'))
+a = ET.parse(open(repositories_xml_location))
repositories = a.getroot()
overlays_gentoo_org_dict = dict([[e.find('name').text, e] for e in repositories])
@@ -93,7 +103,7 @@ for section_name in gitosis_conf.sections():
feed.text = uri
repo.append(feed)
- recurse_print(repo, 1)
+ # recurse_print(repo, 1)
indent(repositories)
-a.write('repositories.xml')
+a.write(repositories_xml_location)