From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web08.48957.1606204864053962404 for ; Tue, 24 Nov 2020 00:01:04 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: yuwei.chen@intel.com) IronPort-SDR: 3aWbPTS9kk4WyMrIb3/6g/PPhpBcteOgh9o09ZgNcNRUanRo4jUtyz7JDiZsHKc4stVSKnlUfO vj2vbV/E1DqA== X-IronPort-AV: E=McAfee;i="6000,8403,9814"; a="171125708" X-IronPort-AV: E=Sophos;i="5.78,365,1599548400"; d="scan'208";a="171125708" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2020 00:01:03 -0800 IronPort-SDR: c3ziBTunZkMf2vQLRVdD1GPf5zmGbA7hm74yOWxdo6IOg8Ia9R3np7OjJ0rL/MsOWVAYlIGTEd 1XkLCT0PDn0w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,365,1599548400"; d="scan'208";a="327485906" Received: from yuweipc.ccr.corp.intel.com ([10.239.158.34]) by orsmga003.jf.intel.com with ESMTP; 24 Nov 2020 00:01:01 -0800 From: "Yuwei Chen" To: devel@edk2.groups.io Cc: Bob Feng , Liming Gao Subject: [PATCH 1/1] BaseTools: Collect full Header files for struct finding. Date: Tue, 24 Nov 2020 16:01:00 +0800 Message-Id: <20201124080100.1068-1-yuwei.chen@intel.com> X-Mailer: git-send-email 2.27.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Currently, only parts of the Header files can be collected which caused some struct definition can not be found. To solve this issue, Header files full collection has been added in this file to support the struct finding. Change-Id: I0a302155e155719fe0f53305cd486d8d4aa1d252 Cc: Bob Feng Cc: Liming Gao Signed-off-by: Yuwei Chen --- BaseTools/Scripts/ConvertFceToStructurePcd.py | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/BaseTools/Scripts/ConvertFceToStructurePcd.py b/BaseTools/Scripts/ConvertFceToStructurePcd.py index 89e6a727a201..aeda3ff26dfe 100644 --- a/BaseTools/Scripts/ConvertFceToStructurePcd.py +++ b/BaseTools/Scripts/ConvertFceToStructurePcd.py @@ -370,7 +370,7 @@ class PATH(object): def __init__(self,path): self.path=path self.rootdir=self.get_root_dir() - self.usefuldir=[] + self.usefuldir=set() self.lstinf = {} for path in self.rootdir: for o_root, o_dir, o_file in os.walk(os.path.join(path, "OUTPUT"), topdown=True, followlinks=False): @@ -381,7 +381,7 @@ class PATH(object): for LST in l_file: if os.path.splitext(LST)[1] == '.lst': self.lstinf[os.path.join(l_root, LST)] = os.path.join(o_root, INF) - self.usefuldir.append(path) + self.usefuldir.add(path) def get_root_dir(self): rootdir=[] @@ -410,7 +410,7 @@ class PATH(object): def header(self,struct): header={} - head_re = re.compile('typedef.*} %s;[\n]+(.*?)(?:typedef|formset)'%struct,re.M|re.S) + head_re = re.compile('typedef.*} %s;[\n]+(.*)(?:typedef|formset)'%struct,re.M|re.S) head_re2 = re.compile(r'#line[\s\d]+"(\S+h)"') for i in list(self.lstinf.keys()): with open(i,'r') as lst: @@ -421,9 +421,21 @@ class PATH(object): if head: format = head[0].replace('\\\\','/').replace('\\','/') name =format.split('/')[-1] - head = self.makefile(name).replace('\\','/') - header[struct] = head + head = self.headerfileset.get(name) + if head: + head = head.replace('\\','/') + header[struct] = head return header + @property + def headerfileset(self): + headerset = dict() + for root,dirs,files in os.walk(self.path): + for file in files: + if os.path.basename(file) == 'deps.txt': + with open(os.path.join(root,file),"r") as fr: + for line in fr.readlines(): + headerset[os.path.basename(line).strip()] = line.strip() + return headerset def makefile(self,filename): re_format = re.compile(r'DEBUG_DIR.*(?:\S+Pkg)\\(.*\\%s)'%filename) @@ -433,6 +445,7 @@ class PATH(object): dir = re_format.findall(read) if dir: return dir[0] + return None class mainprocess(object): @@ -479,7 +492,7 @@ class mainprocess(object): WARNING.append("Warning: No for struct %s"%struct) title2 = '%s%s|{0}|%s|0xFCD00000{\n \n %s\n \n%s\n}\n' % (PCD_NAME, c_name, struct, '', self.LST.package()[self.lst_dict[lstfile]]) header_list.append(title2) - else: + elif struct not in lst._ignore: struct_dict ={} print("ERROR: Struct %s can't found in lst file" %struct) ERRORMSG.append("ERROR: Struct %s can't found in lst file" %struct) -- 2.27.0.windows.1