def genericBiosDup(statusObj, outputTopdir, logger, *args, **kargs): deps = {} packageXml = os.path.join(statusObj.tmpdir, "package.xml") # these are (int, str) tuple for sysId, reqver in common.getBiosDependencies( packageXml): deps[sysId] = reqver gotOne=False for hdr, id, ver in getHdrIdVer(statusObj.tmpdir, os.path.join(statusObj.tmpdir, "Package")): gotOne=True dest, packageIni = copyHdr(hdr, id, ver, outputTopdir, logger) if os.path.exists(os.path.join(dest, "package.xml")): os.unlink(os.path.join(dest, "package.xml")) if os.path.exists(packageXml): shutil.copy( packageXml, dest) for txt in glob.glob( "%s.[Tt][Xx][Tt]" % statusObj.file[:-len(".txt")] ): shutil.copyfile( txt, os.path.join(dest, "relnotes.txt") ) for txt in glob.glob( os.path.join(statusObj.tmpdir, os.path.basename(hdr))[:-len(".hdr")] + ".[Tt][Xx][Tt]"): shutil.copyfile( txt, os.path.join(dest, "relnotes.txt") ) #setup deps minVer = deps.get(id) requires = "" if minVer: requires = "system_bios(ven_0x1028_dev_0x%04x) >= %s" % (id, minVer) common.setIni(packageIni, "package", requires=requires) writePackageIni(dest, packageIni) return True
def copyHdr(hdr, id, ver, destTop, logger): systemName = ("system_bios_ven_0x1028_dev_0x%04x" % id).lower() biosName = ("%s_version_%s" % (systemName, ver)).lower() dest = os.path.join(destTop, biosName) common.safemkdir(dest) shutil.copyfile(hdr, os.path.join(dest, "bios.hdr")) shutil.copyfile(conf.license, os.path.join(dest, os.path.basename(conf.license))) packageIni = ConfigParser.ConfigParser() packageIni.read( os.path.join(dest, "package.ini")) if not packageIni.has_section("package"): packageIni.add_section("package") common.setIni( packageIni, "package", module = "firmware_addon_dell.dellbios", type = "BiosPackage", name = "system_bios(ven_0x1028_dev_0x%04x)" % id, safe_name = systemName, vendor_id = "0x1028", device_id = "0x%04x" % id, version = ver, vendor_version = ver, shortname = shortName.getShortname("0x1028", "0x%04x" % id), ) blacklisted = 0 if id in dell_system_id_blacklist: blacklisted = 1 if (id, ver.lower()) in dell_system_specific_bios_blacklist: blacklisted = 1 if blacklisted: common.setIni( packageIni, "package", blacklisted="1", blacklist_reason="Broken RBU implementation.", name = "BLACKLISTED_system_bios(ven_0x1028_dev_0x%04x)" % id, vendor_id = "BLACKLISTED_0x1028", device_id = "BLACKLISTED_0x%04x" % id, safe_name = "BLACKLISTED_%s" % systemName, ) common.linkLog(dest, logger) writePackageIni(dest, packageIni) return dest, packageIni