[svn] commit: r688 - in /branches/parkinglot/src/bin: bind10/bind10.py.in cfgmgr/Makefile.am cfgmgr/b10-cfgmgr.py.in

BIND 10 source code commits bind10-changes at lists.isc.org
Sat Jan 30 02:26:22 UTC 2010


Author: jelte
Date: Sat Jan 30 02:26:22 2010
New Revision: 688

Log:
Config manager now stores its data in @localstatedir@/@package@/b10-config.db
If run from source tree, it will store it in @abs_top_srcdir@/b10-config.db
if you depend on you data in /tmp/parkinglot.db, copy that one to the correct file

Modified:
    branches/parkinglot/src/bin/bind10/bind10.py.in
    branches/parkinglot/src/bin/cfgmgr/Makefile.am
    branches/parkinglot/src/bin/cfgmgr/b10-cfgmgr.py.in

Modified: branches/parkinglot/src/bin/bind10/bind10.py.in
==============================================================================
--- branches/parkinglot/src/bin/bind10/bind10.py.in (original)
+++ branches/parkinglot/src/bin/bind10/bind10.py.in Sat Jan 30 02:26:22 2010
@@ -34,8 +34,6 @@
     DATAROOTDIR = "@datarootdir@"
     SPECFILE_LOCATION = "@datadir@/@PACKAGE@/bob.spec".replace("${datarootdir}", DATAROOTDIR).replace("${prefix}", PREFIX)
     
-
-
 # TODO: start up statistics thingy
 
 import subprocess

Modified: branches/parkinglot/src/bin/cfgmgr/Makefile.am
==============================================================================
--- branches/parkinglot/src/bin/cfgmgr/Makefile.am (original)
+++ branches/parkinglot/src/bin/cfgmgr/Makefile.am Sat Jan 30 02:26:22 2010
@@ -4,6 +4,9 @@
 
 CLEANFILES = b10-cfgmgr.py
 
+b10_cfgmgrdir = @localstatedir@/@PACKAGE@
+b10_cfgmgr_DATA = 
+
 # TODO: does this need $$(DESTDIR) also?
 # this is done here since configure.ac AC_OUTPUT doesn't expand exec_prefix
 b10-cfgmgr: b10-cfgmgr.py

Modified: branches/parkinglot/src/bin/cfgmgr/b10-cfgmgr.py.in
==============================================================================
--- branches/parkinglot/src/bin/cfgmgr/b10-cfgmgr.py.in (original)
+++ branches/parkinglot/src/bin/cfgmgr/b10-cfgmgr.py.in Sat Jan 30 02:26:22 2010
@@ -9,10 +9,20 @@
 import os
 from ISC.CC import data
 
+# If B10_FROM_SOURCE is set in the environment, we use data files
+# from a directory relative to that, otherwise we use the ones
+# installed on the system
+if "B10_FROM_SOURCE" in os.environ:
+    DATA_PATH = os.environ["B10_FROM_SOURCE"]
+else:
+    PREFIX = "@prefix@"
+    DATA_PATH = "@localstatedir@/@PACKAGE@".replace("${prefix}", PREFIX)
+    
+
 class ConfigManagerData:
     CONFIG_VERSION = 1
-    DB_FILENAME = "/tmp/parkinglot.db"
-    
+    DB_FILENAME = DATA_PATH  + "/b10-config.db"
+
     def __init__(self):
         self.data = {}
         self.data['version'] = ConfigManagerData.CONFIG_VERSION
@@ -24,7 +34,7 @@
     def read_from_file():
         config = ConfigManagerData()
         try:
-            file = open(ConfigManagerData.DB_FILENAME, 'r')
+            file = open(self.DB_FILENAME, 'r')
             file_config = ast.literal_eval(file.read())
             if 'version' in file_config and \
                 file_config['version'] == ConfigManagerData.CONFIG_VERSION:




More information about the bind10-changes mailing list