]> xenbits.xensource.com Git - people/larsk/xenproject-org-gitdm.git/commitdiff
Add option to get the configuration files from a given base directory
authorTiago Vignatti <tiago.vignatti@nokia.com>
Wed, 30 Jun 2010 17:13:21 +0000 (20:13 +0300)
committerTiago Vignatti <tiago.vignatti@nokia.com>
Wed, 30 Jun 2010 17:13:21 +0000 (20:13 +0300)
Instead boringly be replicating the directory base name where gitdm is
installed and write it on each option inside the configuration file, just send
it through the command line.

Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
ConfigFile.py
README
gitdm

index 1ac2508a1950657f281f7cbdeb18c6e87228425f..1fc8823c062d4b20f086489519e1a766b18a5b95 100644 (file)
@@ -95,7 +95,8 @@ def ReadGroupMap (fname, employer):
 #
 # Read an overall config file.
 #
-def ConfigFile (name):
+
+def ConfigFile (name, confdir):
     try:
         file = open (name, 'r')
     except IOError:
@@ -106,13 +107,13 @@ def ConfigFile (name):
         if len (sline) < 2:
             croak ('Funky config line: "%s"' % (line))
         if sline[0] == 'EmailAliases':
-            ReadEmailAliases (sline[1])
+            ReadEmailAliases (confdir + sline[1])
         elif sline[0] == 'EmailMap':
-            ReadEmailEmployers (sline[1])
+            ReadEmailEmployers (confdir + sline[1])
         elif sline[0] == 'GroupMap':
             if len (sline) != 3:
                 croak ('Funky group map line "%s"' % (line))
-            ReadGroupMap (sline[1], sline[2])
+            ReadGroupMap (confdir + sline[1], sline[2])
         else:
             croak ('Unrecognized config line: "%s"' % (line))
         line = ReadConfigLine (file)
diff --git a/README b/README
index 7f5d0b2761e85310f1a6a6917b5c133cfba74956..9a3b03fb4ee52711c2a79cba794e62e73576ff31 100644 (file)
--- a/README
+++ b/README
@@ -26,6 +26,8 @@ be:
        -a      If a patch contains signoff lines from both Andrew Morton 
                and Linus Torvalds, omit Linus's.
 
+       -b dir  Specify the base directory to fetch the configuration files.
+
        -c file Specify the name of the gitdm configuration file.  
                By default, "./gitdm.config" is used.
 
diff --git a/gitdm b/gitdm
index 6ecf9840606f02c18693190f22ad3e54386dff80..93ac0fc546b6cc1feb2b2b4e109d4971d8804fb3 100755 (executable)
--- a/gitdm
+++ b/gitdm
@@ -35,10 +35,13 @@ CSVFile = None
 AkpmOverLt = 0
 DumpDB = 0
 CFName = 'gitdm.config'
+DirName = ''
+
 #
 # Options:
 #
 # -a           Andrew Morton's signoffs shadow Linus's
+# -b dir       Specify the base directory to fetch the configuration files
 # -c cfile     Specify a configuration file
 # -d           Output individual developer stats
 # -D           Output date statistics
@@ -54,12 +57,14 @@ CFName = 'gitdm.config'
 def ParseOpts ():
     global MapUnknown, DevReports
     global DateStats, AuthorSOBs, FileFilter, AkpmOverLt, DumpDB
-    global CFName, CSVFile
+    global CFName, CSVFile, DirName
 
-    opts, rest = getopt.getopt (sys.argv[1:], 'adc:Dh:l:o:r:sux:z')
+    opts, rest = getopt.getopt (sys.argv[1:], 'ab:dc:Dh:l:o:r:sux:z')
     for opt in opts:
         if opt[0] == '-a':
             AkpmOverLt = 1
+        elif opt[0] == '-b':
+            DirName = opt[1]
         elif opt[0] == '-c':
             CFName = opt[1]
         elif opt[0] == '-d':
@@ -302,7 +307,7 @@ ParseOpts ()
 #
 # Read the config files.
 #
-ConfigFile.ConfigFile (CFName)
+ConfigFile.ConfigFile (CFName, DirName)
 
 #
 # Let's pre-seed the database with a couple of hackers