BIND 10 #1979: Make utility functions for finding common resources

BIND 10 Development do-not-reply at isc.org
Wed May 16 05:30:20 UTC 2012


#1979: Make utility functions for finding common resources
-------------------------------------+-------------------------------------
            Reporter:  muks          |                        Owner:
                Type:  enhancement   |                       Status:  new
            Priority:  medium        |                    Milestone:  New
           Component:  Unclassified  |  Tasks
           Sensitive:  0             |                     Keywords:
         Sub-Project:  DNS           |              Defect Severity:  N/A
Estimated Difficulty:  0             |  Feature Depending on Ticket:
         Total Hours:  0             |          Add Hours to Ticket:  0
                                     |                    Internal?:  0
-------------------------------------+-------------------------------------
 This bug comes from #1628. Currently, a lot of the components have code
 like this:

 {{{
 # 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:
     SPECFILE_LOCATION = os.environ["B10_FROM_SOURCE"] + os.sep + \
         "src" + os.sep + "bin" + os.sep + "ddns" + os.sep + "ddns.spec"
 else:
     PREFIX = "@prefix@"
     DATAROOTDIR = "@datarootdir@"
     SPECFILE_LOCATION = "@datadir@" + os.sep + "@PACKAGE@" + os.sep +
 "ddns.spec"
     SPECFILE_LOCATION = SPECFILE_LOCATION.replace("${datarootdir}",
 DATAROOTDIR)\
         .replace("${prefix}", PREFIX)

 SOCKET_FILE = bind10_config.DATA_PATH + '/ddns_socket'
 if "B10_FROM_BUILD" in os.environ:
     if "B10_FROM_SOURCE_LOCALSTATEDIR" in os.environ:
         SOCKET_FILE = os.environ["B10_FROM_SOURCE_LOCALSTATEDIR"] + \
             "/ddns_socket"
     else:
         SOCKET_FILE = os.environ["B10_FROM_BUILD"] + "/ddns_socket"
 }}}

 It is duplicated code, which is inconsistent in the various copies. Any
 change in our process (where we install things, or the env variable we use
 to override settings) would mean editing many files. We should ideally
 have utility functions such as one that returns a path to the spec file
 when passed the name of the component.

-- 
Ticket URL: <http://bind10.isc.org/ticket/1979>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development


More information about the bind10-tickets mailing list