Beispiel #1
0
    def WriteConfigFile(self, config_site):
        # If CONFIG_SITE exists add our configuration to that, otherwise add
        # it to CONFIG: this system changed in 3.14.11.  Either way, the
        # configuration text is appended to the end of the file.
        if config_site:
            config_file = 'CONFIG_SITE'
            config_text = self.CONFIG_SITE_TEXT
        else:
            config_file = 'CONFIG'
            config_text = self.CONFIG_TEXT

        if self.cross_build:
            ARCH = configure.Architecture()
        else:
            ARCH = ''

        CHECK_RELEASE = 'YES' if self.check_release else 'NO'

        self.WriteFile(('configure', config_file),
                       config_text % dict(
                           ARCH=ARCH,
                           CHECK_RELEASE=CHECK_RELEASE,
                       ),
                       mode='a')

        if self.build_debug and configure.Architecture() == 'windows-x64':
            debug_config_file = 'CONFIG_SITE.%s.Common' % configure.Architecture(
            )
            DEBUG_ARCH = '%s-debug' % configure.Architecture()
            self.WriteFile(('configure', debug_config_file),
                           config_text % dict(
                               ARCH=DEBUG_ARCH,
                               CHECK_RELEASE=CHECK_RELEASE,
                           ),
                           mode='a')
Beispiel #2
0
    def __init__(self,
                 path,
                 ioc_name,
                 check_release=True,
                 substitute_boot=False,
                 edm_screen=False,
                 keep_files=[],
                 makefile_name='Makefile'):
        # Remember parameters
        IocWriter.__init__(self, path)  # Sets up iocRoot
        self.CreateBootFiles_win32 = self.CreateBootFiles_linux
        self.check_release = check_release
        self.substitute_boot = substitute_boot
        self.keep_files = keep_files
        self.edm_screen = edm_screen

        # We have to fudge the win32 build as although we run the builder on
        # Linux the IOC will have to be build on Windows.  This is a sign that
        # something's not quite right here...
        self.cross_build = \
            configure.Architecture() != paths.EPICS_HOST_ARCH  and \
            configure.TargetOS() != 'WIN32'

        # Create the working skeleton
        self.CreateIocNames(ioc_name)
        self.StartMakefiles(makefile_name)
        self.CreateSkeleton(makefile_name)

        # Actually generate the IOC
        self.GenerateIoc()
Beispiel #3
0
    def CreateConfigureFiles(self):
        # Create the configure directory by copying files over from EPICS
        # base.  We don't copy RELEASE because we need to rewrite it
        # completely anyway.
        template_dir = os.path.join(paths.EPICS_BASE,
                                    'templates/makeBaseApp/top/configure')
        template_files = os.listdir(template_dir)
        for file in template_files:
            if file not in ['RELEASE']:
                shutil.copyfile(os.path.join(template_dir, file),
                                os.path.join(self.iocRoot, 'configure', file))

        self.WriteConfigFile('CONFIG_SITE' in template_files)

        used_macros, modules = canonicalise_macros(
            self.macros, libversion.ModuleBase.ListModules())

        # Convert macros into text.
        releases = \
            ['# Common prefixes'] + \
            dict_to_lines(used_macros, self.macros) + \
            ['# Module definitions'] + \
            dict_to_lines(modules.keys(), modules) + \
            ['# EPICS Base appears last',
             'EPICS_BASE = %s' % paths.EPICS_BASE]

        # Write out configure/RELEASE
        self.WriteFile('configure/RELEASE', '\n'.join(releases))

        if configure.TargetOS() == 'WIN32':
            paths_dict = dict((k, v.replace('/dls_sw/', r'W:\\')) \
                for k,v in self.macros.items())
            self.WriteFile(
                'configure/RELEASE.%s.Common' % configure.Architecture(),
                self.WINDOWS_RELEASE_COMMON % paths_dict)
Beispiel #4
0
    def CreateConfigureFiles(self):
        # Create the configure directory by copying files over from EPICS
        # base.  We don't copy RELEASE because we need to rewrite it
        # completely anyway.
        template_dir = os.path.join(paths.EPICS_BASE,
                                    'templates/makeBaseApp/top/configure')
        template_files = os.listdir(template_dir)
        for file in template_files:
            if file != 'RELEASE':
                shutil.copy(os.path.join(template_dir, file),
                            os.path.join(self.iocRoot, 'configure'))

        self.WriteConfigFile('CONFIG_SITE' in template_files)

        # Write out configure/RELEASE
        releases = ['# DLS specific macros for the work and prod areas']
        releases.append('SUPPORT = %s' % paths.module_path)
        releases.append('WORK = %s' % paths.module_work_path)
        releases.append('# Module paths')
        for module in sorted(libversion.ModuleBase.ListModules()):
            ## \todo Do something sensible on check_release
            # Something like this might be a good idea --
            #             if self.check_release:
            #                 module.CheckDependencies()
            if module.MacroName() != 'EPICS_BASE':
                path = module.LibPath()
                path = path.replace(paths.module_path, '$(SUPPORT)')
                path = path.replace(paths.module_work_path, '$(WORK)')
                releases.append('%s = %s' % (module.MacroName(), path))
        releases.append('# EPICS Base appears last')
        releases.append('EPICS_BASE = %s' % paths.EPICS_BASE)
        self.WriteFile('configure/RELEASE', '\n'.join(releases))

        if configure.TargetOS() == 'WIN32':
            lines = ['# Windows specific prefixes']
            lines.append('SUPPORT = %s' %
                         paths.module_path.replace('/dls_sw/', r'W:\\'))
            lines.append('WORK = %s' %
                         paths.module_work_path.replace('/dls_sw/', r'W:\\'))
            lines.append('EPICS_BASE = %s' %
                         paths.EPICS_BASE.replace('/dls_sw/', r'W:\\'))
            self.WriteFile(
                'configure/RELEASE.%s.Common' % configure.Architecture(),
                '\n'.join(lines))
Beispiel #5
0
 def WriteConfigFile(self, config_site):
     # If CONFIG_SITE exists add our configuration to that, otherwise add
     # it to CONFIG: this system changed in 3.14.11.  Either way, the
     # configuration text is appended to the end of the file.
     if config_site:
         config_file = 'CONFIG_SITE'
         config_text = self.CONFIG_SITE_TEXT
     else:
         config_file = 'CONFIG'
         config_text = self.CONFIG_TEXT
     if self.cross_build:
         ARCH = configure.Architecture()
     else:
         ARCH = ''
     self.WriteFile(
         ('configure', config_file),
         config_text % dict(
             ARCH=ARCH, CHECK_RELEASE=self.check_release and 'YES' or 'NO'),
         mode='a')