Browse Source

install bob.spec

bind10.py now uses the specfile at the install targets location, unless the environment variable B10_SPECFILE_PATH is set, in which case that path is used

run_bind10.sh sets that variable


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/parkinglot@667 e5f2f494-b856-4b98-b285-d166d9295462
Jelte Jansen 15 years ago
parent
commit
75d25449e5
3 changed files with 22 additions and 2 deletions
  1. 3 0
      src/bin/bind10/Makefile.am
  2. 16 2
      src/bin/bind10/bind10.py.in
  3. 3 0
      src/bin/bind10/run_bind10.sh.in

+ 3 - 0
src/bin/bind10/Makefile.am

@@ -1,6 +1,9 @@
 bin_SCRIPTS = bind10
 CLEANFILES = bind10.py
 
+bind10dir = $(DESTDIR)$(pkgdatadir)
+bind10_DATA = bob.spec
+
 # TODO: does this need $$(DESTDIR) also?
 # this is done here since configure.ac AC_OUTPUT doesn't expand exec_prefix
 bind10: bind10.py

+ 16 - 2
src/bin/bind10/bind10.py.in

@@ -1,6 +1,7 @@
 #!@PYTHON@
 
 import sys; sys.path.append ('@@PYTHONPATH@@')
+import os
 
 """\
 This file implements the Boss of Bind (BoB, or bob) program.
@@ -23,6 +24,18 @@ signal handling outside of that class, in the code running for
 __main__.
 """
 
+# If B10_SPECFILE_PATH is set in the environment, we use the specification
+# file there, instead of the installed one (for instance when we run
+# from the source tree)
+if "B10_SPECFILE_PATH" in os.environ:
+    SPECFILE_LOCATION = os.environ["B10_SPECFILE_PATH"] + "bob.spec"
+else:
+    PREFIX = "@prefix@"
+    DATAROOTDIR = "@datarootdir@"
+    SPECFILE_LOCATION = "@datadir@/@PACKAGE@/bob.spec".replace("${datarootdir}", DATAROOTDIR).replace("${prefix}", PREFIX)
+    
+
+
 # TODO: start up statistics thingy
 
 import subprocess
@@ -56,7 +69,8 @@ class ProcessInfo:
             spawn_stdout = None
         spawn_env = self.env
         spawn_env['PATH'] = os.environ['PATH']
-        spawn_env['PYTHON_EXEC'] = os.environ['PYTHON_EXEC']
+        if 'PYTHON_EXEC' in os.environ:
+            spawn_env['PYTHON_EXEC'] = os.environ['PYTHON_EXEC']
         self.process = subprocess.Popen(self.args,
                                         stdin=subprocess.PIPE,
                                         stdout=spawn_stdout,
@@ -172,7 +186,7 @@ class BoB:
         time.sleep(1)
         if self.verbose:
             print("[XX] starting ccsession")
-        self.ccs = isc.config.CCSession("bob.spec", self.config_handler, self.command_handler)
+        self.ccs = isc.config.CCSession(SPECFILE_LOCATION, self.config_handler, self.command_handler)
         if self.verbose:
             print("[XX] ccsession started")
 

+ 3 - 0
src/bin/bind10/run_bind10.sh.in

@@ -11,6 +11,9 @@ export PATH
 PYTHONPATH=@abs_top_srcdir@/src/lib/cc/python:@abs_top_srcdir@/src/lib/config/python
 export PYTHONPATH
 
+B10_SPECFILE_PATH=@abs_srcdir@
+export B10_SPECFILE_PATH
+
 cd ${BIND10_PATH}
 exec ${PYTHON_EXEC} -O bind10 $*