Changeset fa4ec51 in rtems-libbsd


Ignore:
Timestamp:
Apr 3, 2017, 1:12:18 PM (2 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5283630d2c9d40deb0183696d278e02644fe4326, bc2ba9a9cdc7381c2a4f2ae6ee303be636f31368
Children:
23d6e50
Parents:
d61f731
git-author:
Sebastian Huber <sebastian.huber@…> (04/03/17 13:12:18)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/20/17 12:59:55)
Message:

scripts: Generalize names

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • builder.py

    rd61f731 rfa4ec51  
    22#  Copyright (c) 2015-2016 Chris Johns <chrisj@rtems.org>. All rights reserved.
    33#
    4 #  Copyright (c) 2009-2015 embedded brains GmbH.  All rights reserved.
     4#  Copyright (c) 2009, 2017 embedded brains GmbH.  All rights reserved.
    55#
    66#   embedded brains GmbH
     
    4949# Global controls.
    5050#
    51 RTEMS_DIR = "."
     51LIBBSD_DIR = "."
    5252FreeBSD_DIR = "freebsd-org"
    5353verboseLevel = 0
     
    525525#
    526526class PathComposer(object):
    527     def composeFreeBSDPath(self, path):
     527    def composeOriginPath(self, path):
    528528        return path
    529529
    530     def composeRTEMSPath(self, path, prefix):
     530    def composeLibBSDPath(self, path, prefix):
    531531        return os.path.join(prefix, path)
    532532
    533533class FreeBSDPathComposer(PathComposer):
    534     def composeFreeBSDPath(self, path):
     534    def composeOriginPath(self, path):
    535535        return os.path.join(FreeBSD_DIR, path)
    536536
    537     def composeRTEMSPath(self, path, prefix):
     537    def composeLibBSDPath(self, path, prefix):
    538538        return os.path.join(prefix, 'freebsd', path)
    539539
    540540class RTEMSPathComposer(PathComposer):
    541     def composeFreeBSDPath(self, path):
     541    def composeOriginPath(self, path):
    542542        return path
    543543
    544     def composeRTEMSPath(self, path, prefix):
     544    def composeLibBSDPath(self, path, prefix):
    545545        return os.path.join(prefix, 'rtemsbsd', path)
    546546
    547 class CPUDependentPathComposer(FreeBSDPathComposer):
    548     def composeRTEMSPath(self, path, prefix):
    549         path = super(CPUDependentPathComposer, self).composeRTEMSPath(path, prefix)
     547class CPUDependentFreeBSDPathComposer(FreeBSDPathComposer):
     548    def composeLibBSDPath(self, path, prefix):
     549        path = super(CPUDependentFreeBSDPathComposer, self).composeLibBSDPath(path, prefix)
    550550        path = mapCPUDependentPath(path)
    551551        return path
    552552
    553 class TargetSourceCPUDependentPathComposer(CPUDependentPathComposer):
     553class TargetSourceCPUDependentPathComposer(CPUDependentFreeBSDPathComposer):
    554554    def __init__(self, targetCPU, sourceCPU):
    555555        self.targetCPU = targetCPU
    556556        self.sourceCPU = sourceCPU
    557557
    558     def composeRTEMSPath(self, path, prefix):
    559         path = super(TargetSourceCPUDependentPathComposer, self).composeRTEMSPath(path, prefix)
     558    def composeLibBSDPath(self, path, prefix):
     559        path = super(TargetSourceCPUDependentPathComposer, self).composeLibBSDPath(path, prefix)
    560560        path = path.replace(self.sourceCPU, self.targetCPU)
    561561        return path
     
    584584        self.path = path
    585585        self.pathComposer = pathComposer
    586         self.freebsdPath = self.pathComposer.composeFreeBSDPath(self.path)
    587         self.rtemsPath = self.pathComposer.composeRTEMSPath(self.path, RTEMS_DIR)
     586        self.originPath = self.pathComposer.composeOriginPath(self.path)
     587        self.libbsdPath = self.pathComposer.composeLibBSDPath(self.path, LIBBSD_DIR)
    588588        self.forwardConverter = forwardConverter
    589589        self.reverseConverter = reverseConverter
     
    593593        if forward:
    594594            if verbose(verboseDetail):
    595                 print("process source: %s => %s" % (self.freebsdPath, self.rtemsPath))
    596             self.forwardConverter.convert(self.freebsdPath, self.rtemsPath)
     595                print("process source: %s => %s" % (self.originPath, self.libbsdPath))
     596            self.forwardConverter.convert(self.originPath, self.libbsdPath)
    597597        else:
    598598            if verbose(verboseDetail):
    599599                print("process source: %s => %s converter:%s" % \
    600                       (self.rtemsPath, self.freebsdPath, self.reverseConverter.__class__.__name__))
    601             self.reverseConverter.convert(self.rtemsPath, self.freebsdPath)
     600                      (self.libbsdPath, self.originPath, self.reverseConverter.__class__.__name__))
     601            self.reverseConverter.convert(self.libbsdPath, self.originPath)
    602602
    603603    def getFragment(self):
    604         return self.buildSystemComposer.compose(self.pathComposer.composeRTEMSPath(self.path, ''))
     604        return self.buildSystemComposer.compose(self.pathComposer.composeLibBSDPath(self.path, ''))
    605605
    606606#
     
    639639
    640640    def addFiles(self, newFiles,
    641                  pathComposer, fromFreeBSDToRTEMSConverter, fromRTEMSToFreeBSDConverter,
     641                 pathComposer, forwardConverter, reverseConverter,
    642642                 assertFile, buildSystemComposer = BuildSystemFragmentComposer()):
    643643        files = []
    644644        for newFile in newFiles:
    645645            assertFile(newFile)
    646             files += [File(newFile, pathComposer, fromFreeBSDToRTEMSConverter,
    647                            fromRTEMSToFreeBSDConverter, buildSystemComposer)]
     646            files += [File(newFile, pathComposer, forwardConverter,
     647                           reverseConverter, buildSystemComposer)]
    648648        return files
    649649
     
    662662                                    NoConverter(), NoConverter(), assertHeaderFile)
    663663
    664     def addCPUDependentHeaderFiles(self, files):
     664    def addCPUDependentFreeBSDHeaderFiles(self, files):
    665665        self.files += self.addFiles(files,
    666                                     CPUDependentPathComposer(), FromFreeBSDToRTEMSHeaderConverter(),
     666                                    CPUDependentFreeBSDPathComposer(), FromFreeBSDToRTEMSHeaderConverter(),
    667667                                    FromRTEMSToFreeBSDHeaderConverter(), assertHeaderFile)
    668668
     
    697697                                    assertSourceFile, sourceFileFragmentComposer)
    698698
    699     def addCPUDependentSourceFiles(self, cpus, files, sourceFileFragmentComposer):
     699    def addCPUDependentFreeBSDSourceFiles(self, cpus, files, sourceFileFragmentComposer):
    700700        for cpu in cpus:
    701701            self.initCPUDependencies(cpu)
    702702            self.cpuDependentSourceFiles[cpu] += \
    703703                self.addFiles(files,
    704                               CPUDependentPathComposer(), FromFreeBSDToRTEMSSourceConverter(),
     704                              CPUDependentFreeBSDPathComposer(), FromFreeBSDToRTEMSSourceConverter(),
    705705                              FromRTEMSToFreeBSDSourceConverter(), assertSourceFile,
    706706                              sourceFileFragmentComposer)
  • freebsd-to-rtems.py

    rd61f731 rfa4ec51  
    6060    print("  -b|--buildscripts just generate the build scripts")
    6161    print("  -S|--stats        Print a statistics report")
    62     print("  -R|--reverse      default FreeBSD -> RTEMS, reverse that")
    63     print("  -r|--rtems        RTEMS Libbsd directory (default: '.')")
    64     print("  -f|--freebsd      FreeBSD SVN directory (default: 'freebsd-org')")
     62    print("  -R|--reverse      default origin -> LibBSD, reverse that")
     63    print("  -r|--rtems        LibBSD directory (default: '.')")
     64    print("  -f|--freebsd      FreeBSD origin directory (default: 'freebsd-org')")
    6565    print("  -v|--verbose      enable verbose output mode")
    6666
     
    108108            isForward = False
    109109        elif o in ("-r", "--rtems"):
    110             builder.RTEMS_DIR = a
     110            builder.LIBBSD_DIR = a
    111111        elif o in ("-f", "--freebsd"):
    112112            builder.FreeBSD_DIR = a
     
    121121print("Diff Mode Enabled:           %s" % (("no", "yes")[builder.isDiffMode]))
    122122print("Only Generate Build Scripts: %s" % (("no", "yes")[isOnlyBuildScripts]))
    123 print("RTEMS Libbsd Directory:      %s" % (builder.RTEMS_DIR))
    124 print("FreeBSD SVN Directory:       %s" % (builder.FreeBSD_DIR))
     123print("LibBSD Directory:            %s" % (builder.LIBBSD_DIR))
     124print("FreeBSD Directory:           %s" % (builder.FreeBSD_DIR))
    125125print("Direction:                   %s" % (("reverse", "forward")[isForward]))
    126126
     
    135135        sys.exit(2)
    136136
    137 # Were RTEMS and FreeBSD directories specified
    138 wasDirectorySet( "RTEMS", builder.RTEMS_DIR )
     137# Were directories specified?
     138wasDirectorySet( "LibBSD", builder.LIBBSD_DIR )
    139139wasDirectorySet( "FreeBSD", builder.FreeBSD_DIR )
    140140
    141141# Are we generating or reverting?
    142142if isForward == True:
    143     print("Forward from FreeBSD GIT into ", builder.RTEMS_DIR)
     143    print("Forward from", builder.FreeBSD_DIR, "into", builder.LIBBSD_DIR)
    144144else:
    145     print("Reverting from ", builder.RTEMS_DIR)
     145    print("Reverting from", builder.LIBBSD_DIR)
    146146    if isOnlyBuildScripts == True:
    147147        print("error: Build Script generation and Reverse are contradictory")
  • libbsd.py

    rd61f731 rfa4ec51  
    12951295        ]
    12961296    )
    1297     mod.addCPUDependentHeaderFiles(
     1297    mod.addCPUDependentFreeBSDHeaderFiles(
    12981298        [
    12991299            'sys/arm/include/cpufunc.h',
     
    22082208        ]
    22092209    )
    2210     mod.addCPUDependentHeaderFiles(
     2210    mod.addCPUDependentFreeBSDHeaderFiles(
    22112211        [
    22122212            'sys/i386/include/_bus.h',
     
    22162216        ]
    22172217    )
    2218     mod.addCPUDependentSourceFiles(
     2218    mod.addCPUDependentFreeBSDSourceFiles(
    22192219        [ 'i386' ],
    22202220        [
     
    39683968        ]
    39693969    )
    3970     mod.addCPUDependentHeaderFiles(
     3970    mod.addCPUDependentFreeBSDHeaderFiles(
    39713971        [
    39723972            'sys/i386/include/in_cksum.h',
     
    39843984        ]
    39853985    )
    3986     mod.addCPUDependentSourceFiles(
     3986    mod.addCPUDependentFreeBSDSourceFiles(
    39873987        [ 'i386' ],
    39883988        [
     
    39913991        mm.generator['source']()
    39923992    )
    3993     mod.addCPUDependentSourceFiles(
     3993    mod.addCPUDependentFreeBSDSourceFiles(
    39943994        [ 'powerpc' ],
    39953995        [
     
    39983998        mm.generator['source']()
    39993999    )
    4000     mod.addCPUDependentSourceFiles(
     4000    mod.addCPUDependentFreeBSDSourceFiles(
    40014001        [ 'sparc64' ],
    40024002        [
     
    40054005        mm.generator['source']()
    40064006    )
    4007     mod.addCPUDependentSourceFiles(
     4007    mod.addCPUDependentFreeBSDSourceFiles(
    40084008        [
    40094009            'arm', 'avr', 'bfin', 'h8300', 'lm32', 'm32c', 'm32r', 'm68k',
  • waf_generator.py

    rd61f731 rfa4ec51  
    192192
    193193    def write(self):
    194         name = os.path.join(builder.RTEMS_DIR, 'libbsd_waf.py')
     194        name = os.path.join(builder.LIBBSD_DIR, 'libbsd_waf.py')
    195195        converter = builder.Converter()
    196196        converter.convert(name, name, srcContents = self.script)
     
    208208        self.generator['freebsd-path'] = builder.FreeBSDPathComposer
    209209        self.generator['rtems-path'] = builder.RTEMSPathComposer
    210         self.generator['cpu-path'] = builder.CPUDependentPathComposer
     210        self.generator['cpu-path'] = builder.CPUDependentFreeBSDPathComposer
    211211        self.generator['target-src-cpu--path'] = builder.TargetSourceCPUDependentPathComposer
    212212
Note: See TracChangeset for help on using the changeset viewer.