Ejemplo n.º 1
0
def create_ado_mapping(sysdefconfig, adomappingfile, adoqualitymappingfile, builddrive, adoqualitydirs):
    """ Creates ado mapping and ado quality mapping files """
    input = open(sysdefconfig, 'r')
    output = open(adomappingfile, 'w')
    outputquality = open(adoqualitymappingfile, 'w')
    components = {}
    for sysdef in input.readlines():
        sysdef = sysdef.strip()
        if len(sysdef) > 0:
            print "Checking %s" % sysdef
            os.path.dirname(sysdef)
            location = ido.get_sysdef_location(sysdef)
            if location != None:
                sysdef = os.path.dirname(sysdef).replace('\\','/').replace(':','\\:')
                component = os.path.normpath(os.path.join(builddrive, os.environ['EPOCROOT'], location)).replace('\\','/').replace(':','\\:')
                print "%s=%s\n" % (sysdef, component)
                output.write("%s=%s\n" % (sysdef, component))
                
                if adoqualitydirs == None:
                    outputquality.write("%s=%s\n" % (sysdef, component))
                else:
                    for dir in adoqualitydirs.split(','):
                        if os.path.normpath(dir) == os.path.normpath(os.path.join(builddrive, os.environ['EPOCROOT'], location)):
                            outputquality.write("%s=%s\n" % (sysdef, component))
    outputquality.close()
    output.close()
    input.close()
Ejemplo n.º 2
0
 def test_ido_sysdef_invalid(self):
     """ Verifying get_sysdef_location method with invalid sysdef"""
     (fd, filename) = mkstemp()
     os.write(fd,'Test sysdef file')
     os.close(fd)
     location = ido.get_sysdef_location(filename); 
     os.unlink(filename)
     assert location == None
Ejemplo n.º 3
0
 def test_create_ado_mapping_adoqualitydirs(self):
     """Verifiying create_ado_mapping (with valid adoqualitydirs) method"""
     (sysdefFileDes, sysdefConfig) = tempfile.mkstemp()
     (adoFileDes, adoMappingFile) = tempfile.mkstemp()
     (adoqtyFileDes, adoQualityMappingFile) = tempfile.mkstemp()
     buildDrive = tempfile.gettempdir()
     testSysdefFile = os.path.join(os.environ["TEST_DATA"], "data", "packageiad", "layers.sysdef.xml")
     location = ido.get_sysdef_location(testSysdefFile)
     adoQualityDirs = os.path.normpath(os.path.join(buildDrive, os.environ["EPOCROOT"], location))
     os.write(sysdefFileDes, testSysdefFile)
     os.close(sysdefFileDes)
     idoprep.create_ado_mapping(sysdefConfig, adoMappingFile, adoQualityMappingFile, buildDrive, adoQualityDirs)
     os.unlink(sysdefConfig)
     os.close(adoFileDes)
     os.close(adoqtyFileDes)
     adoFile = open(adoMappingFile, "r")
     adoMappingFileContents = adoFile.readlines()
     adoFile.close()
     adoQtyFile = open(adoQualityMappingFile, "r")
     adoQualityMappingFileContents = adoQtyFile.readlines()
     adoQtyFile.close()
     os.unlink(adoMappingFile)
     os.unlink(adoQualityMappingFile)
     assert len(adoMappingFileContents) >= 1 and len(adoQualityMappingFileContents) >= 1
Ejemplo n.º 4
0
 def test_ido_sysdef_valid(self):
     """ Verifying get_sysdef_location method with valid sysdef"""
     test_sysdef_file = os.path.join(os.environ['TEST_DATA'], 'data', 'packageiad', 'layers.sysdef.xml')
     location = ido.get_sysdef_location(test_sysdef_file); 
     assert location != None