Parcourir la source

[805] Run sockcreator from source

If it is run from the source code, all programs should be run from
there.
JINMEI Tatuya il y a 13 ans
Parent
commit
d66d0cc215

+ 2 - 4
src/bin/bind10/bind10_src.py.in

@@ -44,12 +44,10 @@ import os
 # installed on the system
 # installed on the system
 if "B10_FROM_SOURCE" in os.environ:
 if "B10_FROM_SOURCE" in os.environ:
     SPECFILE_LOCATION = os.environ["B10_FROM_SOURCE"] + "/src/bin/bind10/bob.spec"
     SPECFILE_LOCATION = os.environ["B10_FROM_SOURCE"] + "/src/bin/bind10/bob.spec"
-    ADD_LIBEXEC_PATH = False
 else:
 else:
     PREFIX = "@prefix@"
     PREFIX = "@prefix@"
     DATAROOTDIR = "@datarootdir@"
     DATAROOTDIR = "@datarootdir@"
     SPECFILE_LOCATION = "@datadir@/@PACKAGE@/bob.spec".replace("${datarootdir}", DATAROOTDIR).replace("${prefix}", PREFIX)
     SPECFILE_LOCATION = "@datadir@/@PACKAGE@/bob.spec".replace("${datarootdir}", DATAROOTDIR).replace("${prefix}", PREFIX)
-    ADD_LIBEXEC_PATH = True
     
     
 import subprocess
 import subprocess
 import signal
 import signal
@@ -65,6 +63,7 @@ import pwd
 import posix
 import posix
 import copy
 import copy
 
 
+from bind10_config import LIBEXECPATH
 import isc.cc
 import isc.cc
 import isc.util.process
 import isc.util.process
 import isc.net.parse
 import isc.net.parse
@@ -151,8 +150,7 @@ class ProcessInfo:
         # on construction (self.env).
         # on construction (self.env).
         spawn_env = copy.deepcopy(os.environ)
         spawn_env = copy.deepcopy(os.environ)
         spawn_env.update(self.env)
         spawn_env.update(self.env)
-        if ADD_LIBEXEC_PATH:
-            spawn_env['PATH'] = "@@LIBEXECDIR@@:" + spawn_env['PATH']
+        spawn_env['PATH'] = LIBEXECPATH + spawn_env['PATH']
         self.process = subprocess.Popen(self.args,
         self.process = subprocess.Popen(self.args,
                                         stdin=subprocess.PIPE,
                                         stdin=subprocess.PIPE,
                                         stdout=spawn_stdout,
                                         stdout=spawn_stdout,

+ 31 - 10
src/lib/python/bind10_config.py.in

@@ -23,24 +23,37 @@ def reload():
     global DATA_PATH
     global DATA_PATH
     global PLUGIN_PATHS
     global PLUGIN_PATHS
     global PREFIX
     global PREFIX
-    global LIBEXECDIR
-    LIBEXECDIR = ("@libexecdir@/@PACKAGE@"). \
-        replace("${exec_prefix}", "@exec_prefix@"). \
-        replace("${prefix}", "@prefix@")
+    global LIBEXECPATH
     BIND10_MSGQ_SOCKET_FILE = os.path.join("@localstatedir@",
     BIND10_MSGQ_SOCKET_FILE = os.path.join("@localstatedir@",
                                            "@PACKAGE_NAME@",
                                            "@PACKAGE_NAME@",
                                            "msgq_socket").replace("${prefix}",
                                            "msgq_socket").replace("${prefix}",
                                                                   "@prefix@")
                                                                   "@prefix@")
     PREFIX = "@prefix@"
     PREFIX = "@prefix@"
 
 
-    # If B10_FROM_SOURCE is set in the environment, we use data files
-    # from a directory relative to the value of that variable, or, if defined,
-    # relative to the value of B10_FROM_SOURCE_LOCALSTATEDIR.  Otherwise
-    # we use the ones installed on the system.
+    # B10_FROM_SOURCE is set in the environment for internal tests and
+    # an experimental run without installagion.  In that case we need to
+    # specialize some configuration variables, generally so that they refer
+    # to somewhere in the source tree instead of the appropriate places
+    # after installation.
+    #
+    # DATA_PATH: used by the config manager to find configuration files.
+    #  When "FROM_SOURCE", we use data files from a directory relative to the
+    #  value of that variable, or, if defined, relative to the value of
+    #  B10_FROM_SOURCE_LOCALSTATEDIR.  Otherwise we use the ones installed on
+    #  the system.
+    # PLUGIN_PATHS: configuration modules that are not associated to specific
+    #  process
+    # LIBEXECPATH: Paths to programs invoked by the boss process
+    #  The boss process (directly or via a helper module) uses this as
+    #  the prefererred PATH before starting a child process.
+    #  When "FROM_SOURCE", it lists the directories where the programs are
+    #  built so that when BIND 10 is experimentally started on the source
+    #  tree the programs in the tree (not installed ones) will be used.
+    #
     # B10_FROM_SOURCE_LOCALSTATEDIR is specifically intended to be used for
     # B10_FROM_SOURCE_LOCALSTATEDIR is specifically intended to be used for
     # tests where we want to use variuos types of configuration within the test
     # tests where we want to use variuos types of configuration within the test
-    # environment.  (We may want to make it even more generic so that the path is
-    # passed from the boss process)
+    # environment.  (We may want to make it even more generic so that the path
+    # is passed from the boss process)
     if "B10_FROM_SOURCE" in os.environ:
     if "B10_FROM_SOURCE" in os.environ:
         if "B10_FROM_SOURCE_LOCALSTATEDIR" in os.environ:
         if "B10_FROM_SOURCE_LOCALSTATEDIR" in os.environ:
             DATA_PATH = os.environ["B10_FROM_SOURCE_LOCALSTATEDIR"]
             DATA_PATH = os.environ["B10_FROM_SOURCE_LOCALSTATEDIR"]
@@ -48,9 +61,17 @@ def reload():
             DATA_PATH = os.environ["B10_FROM_SOURCE"]
             DATA_PATH = os.environ["B10_FROM_SOURCE"]
         PLUGIN_PATHS = [os.environ["B10_FROM_SOURCE"] +
         PLUGIN_PATHS = [os.environ["B10_FROM_SOURCE"] +
                             '/src/bin/cfgmgr/plugins']
                             '/src/bin/cfgmgr/plugins']
+        programdirs = ['auth', 'cfgmgr', 'cmdctl', 'ddns', 'dhcp6', 'msgq',
+                       'resolver', 'sockcreator', 'stats', 'xfrin', 'xfrout',
+                       'zonemgr']
+        LIBEXECPATH = ':'.join(['@abs_top_builddir@/src/bin/' + p for p in
+                                programdirs])
     else:
     else:
         DATA_PATH = "@localstatedir@/@PACKAGE@".replace("${prefix}", PREFIX)
         DATA_PATH = "@localstatedir@/@PACKAGE@".replace("${prefix}", PREFIX)
         PLUGIN_PATHS = ["@prefix@/share/@PACKAGE@/config_plugins"]
         PLUGIN_PATHS = ["@prefix@/share/@PACKAGE@/config_plugins"]
+        LIBEXECPATH = ("@libexecdir@/@PACKAGE@"). \
+            replace("${exec_prefix}", "@exec_prefix@"). \
+            replace("${prefix}", "@prefix@")
     # For testing the plugins so they can find their own spec files
     # For testing the plugins so they can find their own spec files
     if "B10_TEST_PLUGIN_DIR" in os.environ:
     if "B10_TEST_PLUGIN_DIR" in os.environ:
         PLUGIN_PATHS = os.environ["B10_TEST_PLUGIN_DIR"].split(':')
         PLUGIN_PATHS = os.environ["B10_TEST_PLUGIN_DIR"].split(':')

+ 2 - 2
src/lib/python/isc/bind10/special_component.py

@@ -15,7 +15,7 @@
 
 
 from isc.bind10.component import Component, BaseComponent
 from isc.bind10.component import Component, BaseComponent
 import isc.bind10.sockcreator
 import isc.bind10.sockcreator
-from bind10_config import LIBEXECDIR
+from bind10_config import LIBEXECPATH
 import os
 import os
 import posix
 import posix
 import isc.log
 import isc.log
@@ -39,7 +39,7 @@ class SockCreator(BaseComponent):
 
 
     def _start_internal(self):
     def _start_internal(self):
         self._boss.curproc = 'b10-sockcreator'
         self._boss.curproc = 'b10-sockcreator'
-        self.__creator = isc.bind10.sockcreator.Creator(LIBEXECDIR + ':' +
+        self.__creator = isc.bind10.sockcreator.Creator(LIBEXECPATH + ':' +
                                                         os.environ['PATH'])
                                                         os.environ['PATH'])
         self._boss.register_process(self.pid(), self)
         self._boss.register_process(self.pid(), self)
         self._boss.set_creator(self.__creator)
         self._boss.set_creator(self.__creator)