예제 #1
0
파일: usetest.py 프로젝트: tensor5/conary
 def testTargetFlavor(self):
     use.setBuildFlagsFromFlavor(None, self.cfg.buildFlavor, error=False)
     targetFlavor = str(
         use.createFlavor(None, use.Arch._iterAll(), targetDep=True))
     assert (targetFlavor)
     flavor = str(
         use.createFlavor(None, use.Arch._iterAll(), targetDep=False))
     assert (targetFlavor.replace('target', 'is') == flavor)
예제 #2
0
def _getUseFlavor(recipe):
    """
    Returns a deps.Flavor instance that represents the Use flags
    that have been used.
    """
    if 'abstractBaseClass' in recipe.__class__.__dict__ \
            and recipe.abstractBaseClass:
        # abstract base classes shouldn't be flavored
        return deps.Flavor()
    f = use.createFlavor(recipe.name, use.Use._iterUsed(),
                         recipe.Flags._iterUsed(),
                         use.Arch._iterUsed(),
                         targetDep=recipe.isCrossCompileTool())
    if recipe.isCrossCompileTool():
        # there's no guarantee that a cross compiler tool will mention
        # anything in its flavor to automatically add the target flavor.
        # We have to do it manually.
        f.union(recipe.targetFlavor)
    return f
예제 #3
0
파일: usetest.py 프로젝트: pombr/conary
 def testArch(self):
     Arch = use.ArchCollection()
     Arch._setArchProps('LE', 'BE', 'bits32', 'bits64')
     Arch._addFlag('x86', archProps={'LE' : True, 'BE' : False, 'bits32':True, 'bits64' : False } )
     Arch.x86._addFlag('sse')
     Arch.x86._addFlag('sse2', subsumes=['sse'])
     Arch.x86._addFlag('i686', subsumes=['i586', 'i486'])
     Arch.x86._addFlag('i586', subsumes=['i486'])
     Arch.x86._addFlag('i486')
     Arch.x86._addFlag('3dnow')
     Arch.x86._addAlias('3dnow', 'threednow')
     Arch._addFlag('ppc', archProps={'LE' : False, 'BE' : True, 'bits32':False, 'bits64' : True } )
     Arch.ppc._addFlag('ppc64')
     Arch._setArch('ppc', ['ppc64'])
     assert(Arch.ppc and Arch.ppc.ppc64 and not Arch.LE and not Arch.bits32)
     assert(Arch.bits64)
     Arch._setArch('x86', ['i686'])
     assert(not Arch.ppc and not Arch.ppc.ppc64 and Arch.LE and Arch.bits32)
     assert(not Arch.bits64)
     Arch._trackUsed(True)
     bool(Arch.x86)
     bool(Arch.x86.sse2)
     bool(Arch.x86.i686)
     bool(Arch.getCurrentArch().i686)
     bool(Arch.x86.threednow)
     bool(Arch.ppc.ppc64)
     bool(Arch.BE)
     bool(Arch.LE)
     Arch._trackUsed(False)
     assert(str(use.createFlavor(None, Arch._iterUsed())) \
                == 'is: x86(~!3dnow,i486,i586,i686,~!sse2)')
     Arch._setArch('x86', ['i586'])
     Arch._resetUsed()
     Arch._trackUsed(True)
     bool(Arch.x86.i586) == True
     f = use.createFlavor(None, Arch._iterUsed())
     assert(str(f) == 'is: x86(i486,i586)')
     f = str(use.createFlavor(None, Arch.x86._iterAll()))
     assert(f.find('is: LE') == -1)
     assert(f.find('3dnow') != -1)
     #now let's try turning required off
     Arch._setArch('x86', ['i586', '3dnow', 'sse'])
     Arch._resetUsed()
     Arch._trackUsed(True)
     assert(Arch.x86.i586 == True)
     assert(Arch.x86.threednow == True)
     assert(Arch.x86.sse == True)
     assert(str(Arch.ppc.ppc64) == 'Arch.ppc.ppc64: False')
     Arch.x86.i586.setRequired(False)
     Arch.x86.threednow.setRequired(False)
     f = use.createFlavor(None, Arch._iterUsed())
     assert(str(f) == 'is: x86(~3dnow,~i486,~i586,sse)')
     #touching a any arch or subarch should turn on the trove's
     #major architecture flag
     Arch._setArch('x86', ['i586', '3dnow', 'sse'])
     Arch._resetUsed()
     Arch._trackUsed(True)
     bool(Arch.ppc)
     f = use.createFlavor(None, Arch._iterUsed())
     assert(str(f) == 'is: x86')
     Arch._setArch('x86', ['i586', '3dnow', 'sse'])
     Arch._resetUsed()
     Arch._trackUsed(True)
     bool(Arch.ppc.ppc64)
     f = use.createFlavor(None, Arch._iterUsed())
     assert(str(f) == 'is: x86')
예제 #4
0
파일: usetest.py 프로젝트: pombr/conary
 def testTargetFlavor(self):
     use.setBuildFlagsFromFlavor(None, self.cfg.buildFlavor, error=False)
     targetFlavor = str(use.createFlavor(None, use.Arch._iterAll(), targetDep=True))
     assert(targetFlavor)
     flavor = str(use.createFlavor(None, use.Arch._iterAll(), targetDep=False))
     assert(targetFlavor.replace('target', 'is') == flavor)
예제 #5
0
파일: usetest.py 프로젝트: pombr/conary
        except RuntimeError, e:
            assert(str(e) == 'alias is already set')
        else:
            raise
        try:
            Arch.x86._addAlias('3dnow', 'fourdnow')
        except RuntimeError, e:
            assert(str(e) == 'key 3dnow already has an alias')
        else:
            raise
        Arch._setArch('x86', ['i686', 'sse'])
        Use._addFlag('builddocs')
        Flags.smp = True
        assert(Flags.smp == True)
        assert(repr(Flags) == 'Flags: {smp: True}')
        f = use.createFlavor('kernel', [Arch.x86, Arch.x86.sse, Arch.x86.sse2, Use.builddocs, Flags.smp ])
        assert(f.freeze() == '1#x86:sse:~!sse2|5#use:~!builddocs:~kernel.smp') 
        use.Use._addFlag('bootstrap', required=False, value=True)
        assert(use.Use.bootstrap._toDependency().freeze() == '5#use:~bootstrap')

    def testArch(self):
        Arch = use.ArchCollection()
        Arch._setArchProps('LE', 'BE', 'bits32', 'bits64')
        Arch._addFlag('x86', archProps={'LE' : True, 'BE' : False, 'bits32':True, 'bits64' : False } )
        Arch.x86._addFlag('sse')
        Arch.x86._addFlag('sse2', subsumes=['sse'])
        Arch.x86._addFlag('i686', subsumes=['i586', 'i486'])
        Arch.x86._addFlag('i586', subsumes=['i486'])
        Arch.x86._addFlag('i486')
        Arch.x86._addFlag('3dnow')
        Arch.x86._addAlias('3dnow', 'threednow')
예제 #6
0
파일: usetest.py 프로젝트: tensor5/conary
 def testArch(self):
     Arch = use.ArchCollection()
     Arch._setArchProps('LE', 'BE', 'bits32', 'bits64')
     Arch._addFlag('x86',
                   archProps={
                       'LE': True,
                       'BE': False,
                       'bits32': True,
                       'bits64': False
                   })
     Arch.x86._addFlag('sse')
     Arch.x86._addFlag('sse2', subsumes=['sse'])
     Arch.x86._addFlag('i686', subsumes=['i586', 'i486'])
     Arch.x86._addFlag('i586', subsumes=['i486'])
     Arch.x86._addFlag('i486')
     Arch.x86._addFlag('3dnow')
     Arch.x86._addAlias('3dnow', 'threednow')
     Arch._addFlag('ppc',
                   archProps={
                       'LE': False,
                       'BE': True,
                       'bits32': False,
                       'bits64': True
                   })
     Arch.ppc._addFlag('ppc64')
     Arch._setArch('ppc', ['ppc64'])
     assert (Arch.ppc and Arch.ppc.ppc64 and not Arch.LE
             and not Arch.bits32)
     assert (Arch.bits64)
     Arch._setArch('x86', ['i686'])
     assert (not Arch.ppc and not Arch.ppc.ppc64 and Arch.LE
             and Arch.bits32)
     assert (not Arch.bits64)
     Arch._trackUsed(True)
     bool(Arch.x86)
     bool(Arch.x86.sse2)
     bool(Arch.x86.i686)
     bool(Arch.getCurrentArch().i686)
     bool(Arch.x86.threednow)
     bool(Arch.ppc.ppc64)
     bool(Arch.BE)
     bool(Arch.LE)
     Arch._trackUsed(False)
     assert(str(use.createFlavor(None, Arch._iterUsed())) \
                == 'is: x86(~!3dnow,i486,i586,i686,~!sse2)')
     Arch._setArch('x86', ['i586'])
     Arch._resetUsed()
     Arch._trackUsed(True)
     bool(Arch.x86.i586) == True
     f = use.createFlavor(None, Arch._iterUsed())
     assert (str(f) == 'is: x86(i486,i586)')
     f = str(use.createFlavor(None, Arch.x86._iterAll()))
     assert (f.find('is: LE') == -1)
     assert (f.find('3dnow') != -1)
     #now let's try turning required off
     Arch._setArch('x86', ['i586', '3dnow', 'sse'])
     Arch._resetUsed()
     Arch._trackUsed(True)
     assert (Arch.x86.i586 == True)
     assert (Arch.x86.threednow == True)
     assert (Arch.x86.sse == True)
     assert (str(Arch.ppc.ppc64) == 'Arch.ppc.ppc64: False')
     Arch.x86.i586.setRequired(False)
     Arch.x86.threednow.setRequired(False)
     f = use.createFlavor(None, Arch._iterUsed())
     assert (str(f) == 'is: x86(~3dnow,~i486,~i586,sse)')
     #touching a any arch or subarch should turn on the trove's
     #major architecture flag
     Arch._setArch('x86', ['i586', '3dnow', 'sse'])
     Arch._resetUsed()
     Arch._trackUsed(True)
     bool(Arch.ppc)
     f = use.createFlavor(None, Arch._iterUsed())
     assert (str(f) == 'is: x86')
     Arch._setArch('x86', ['i586', '3dnow', 'sse'])
     Arch._resetUsed()
     Arch._trackUsed(True)
     bool(Arch.ppc.ppc64)
     f = use.createFlavor(None, Arch._iterUsed())
     assert (str(f) == 'is: x86')
예제 #7
0
파일: usetest.py 프로젝트: tensor5/conary
            assert (str(e) == 'alias is already set')
        else:
            raise
        try:
            Arch.x86._addAlias('3dnow', 'fourdnow')
        except RuntimeError, e:
            assert (str(e) == 'key 3dnow already has an alias')
        else:
            raise
        Arch._setArch('x86', ['i686', 'sse'])
        Use._addFlag('builddocs')
        Flags.smp = True
        assert (Flags.smp == True)
        assert (repr(Flags) == 'Flags: {smp: True}')
        f = use.createFlavor(
            'kernel',
            [Arch.x86, Arch.x86.sse, Arch.x86.sse2, Use.builddocs, Flags.smp])
        assert (f.freeze() == '1#x86:sse:~!sse2|5#use:~!builddocs:~kernel.smp')
        use.Use._addFlag('bootstrap', required=False, value=True)
        assert (
            use.Use.bootstrap._toDependency().freeze() == '5#use:~bootstrap')

    def testArch(self):
        Arch = use.ArchCollection()
        Arch._setArchProps('LE', 'BE', 'bits32', 'bits64')
        Arch._addFlag('x86',
                      archProps={
                          'LE': True,
                          'BE': False,
                          'bits32': True,
                          'bits64': False