From nobody Sun Feb 8 21:42:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+41337+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+41337+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1558708833; cv=none; d=zoho.com; s=zohoarc; b=hzTrl+SWp9yJsQs4jpdJKAxtACKKXPX9sLK84yWqOa4SHO9PghdoSQdsb5lmKdOZVxHVlD6OkXgfuWRvMQ2GWi69dL9E47bOI+cYx9EjSoSQy9dZRfWxkQcxKA7uhcHSkRbXh7ak2qv3puxLB+FTW2d4PT9MVRftJ1LFQTrUmUA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558708833; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=qcKW0FfdKzZZPvFK3UfYaB89/aKSyPEpY1y/E4qfDLM=; b=XiYZ+ISNZnpIwtIyQLrKfl6gKvYFzQQHDiHBSoDVx64Lsgxbif1PqSa4d7t8/6qdVxuIoRPpDc2IZokVcAKM1m9tz4oZt8AIikNGZyNhVjXKg1dslEjwVCHzrLJW3OukBbzryBSIxKmaM8wTRY9btQ2wZGa79bY/t7EsEJayU14= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+41337+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 155870883340381.0097865538437; Fri, 24 May 2019 07:40:33 -0700 (PDT) Return-Path: X-Received: from mga11.intel.com (mga11.intel.com []) by groups.io with SMTP; Fri, 24 May 2019 07:40:32 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP; 24 May 2019 07:40:31 -0700 X-ExtLoop1: 1 X-Received: from rodrigu3-desk.amr.corp.intel.com ([10.7.163.75]) by orsmga008.jf.intel.com with ESMTP; 24 May 2019 07:40:31 -0700 From: "Christian Rodriguez" To: devel@edk2.groups.io Cc: Bob Feng , Liming Gao , Yonghong Zhu Subject: [edk2-devel] [Patch V3 1/2] BaseTools: Add a checking for Sources section in INF file [Part 1/2] Date: Fri, 24 May 2019 07:40:26 -0700 Message-Id: <20190524144027.9552-2-christian.rodriguez@intel.com> In-Reply-To: <20190524144027.9552-1-christian.rodriguez@intel.com> References: <20190524144027.9552-1-christian.rodriguez@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,christian.rodriguez@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1558708832; bh=FR/LTa1vf/SjSOHMhIJ8nh9wIeanRlg9wF0LQcodweQ=; h=Cc:Date:From:Reply-To:Subject:To; b=I49f7fsLB88PiMIjsvwbeTM8PT9X6AEzKrSzqK8Q3OOs4+nR3sgcevRpnfAbG/hTzHK RGowvTA+lnn6xgB7KvN0FuKb4aAQ57ohlE/4denTvzcY63+VE/VB4SygVVhX2ZGnJEy/m OhNWRQ5yjmklr87i29ZYIiZp2vWBdhuL1x8= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1804 In V3: Seperate checker and hashing into individual patches In V2: Enable check for all builds, move conditional to hash invalidation In the Edk2 INF spec 3.9, it states, All HII Unicode format files must be listed in [Sources] section. Add a check to see if [Sources] section lists all the "source" type files of a module. Performance impact should be minimal with this patch since information is already being fetched for Makefile purposes. All other information is already cached in memory. No extra IO time is needed. Part 1 is checker only. Signed-off-by: Christian Rodriguez Cc: Bob Feng Cc: Liming Gao Cc: Yonghong Zhu --- BaseTools/Source/Python/AutoGen/GenMake.py | 38 ++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/= Python/AutoGen/GenMake.py index 0e0f9fd9b0..5c992d7c26 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -905,6 +905,44 @@ cleanlib: ForceIncludedFile, self._AutoGenObject.IncludePathList + = self._AutoGenObject.BuildOptionIncPathList ) + + # Check if header files are listed in metafile + # Get a list of unique module header source files from MetaFile + headerFilesInMetaFileSet =3D set() + for aFile in self._AutoGenObject.SourceFileList: + aFileName =3D str(aFile) + if not aFileName.endswith('.h'): + continue + headerFilesInMetaFileSet.add(aFileName.lower()) + + # Get a list of unique module autogen files + localAutoGenFileSet =3D set() + for aFile in self._AutoGenObject.AutoGenFileList: + localAutoGenFileSet.add(str(aFile).lower()) + + # Get a list of unique module dependency header files + # Exclude autogen files and files not in the source directory + headerFileDependencySet =3D set() + localSourceDir =3D str(self._AutoGenObject.SourceDir).lower() + for Dependency in FileDependencyDict.values(): + for aFile in Dependency: + aFileName =3D str(aFile).lower() + if not aFileName.endswith('.h'): + continue + if aFileName in localAutoGenFileSet: + continue + if localSourceDir not in aFileName: + continue + headerFileDependencySet.add(aFileName) + + # Check if a module dependency header file is missing from the mod= ule's MetaFile + for aFile in headerFileDependencySet: + if aFile in headerFilesInMetaFileSet: + continue + EdkLogger.warn("build","Module MetaFile [Sources] is missing l= ocal header!", + ExtraData =3D "Local Header: " + aFile + " not fou= nd in " + self._AutoGenObject.MetaFile.Path + ) + DepSet =3D None for File,Dependency in FileDependencyDict.items(): if not Dependency: --=20 2.19.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#41337): https://edk2.groups.io/g/devel/message/41337 Mute This Topic: https://groups.io/mt/31745161/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sun Feb 8 21:42:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+41338+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+41338+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1558708834; cv=none; d=zoho.com; s=zohoarc; b=lT1WPXJcazy0MRbisJCL5/vEB+VfmjZ+4TOQSbqPU5Q3H9Rusl1sHaNtCxANFgje34XIF86GTEdCKy/Yg6S25tnTLVwKsm0P3q8m5zQJf3ijbArdbZvqnLPcOCSLnOge0+arD/MUc4anHoML843TvTrtDS0r+zxJlpUHUyk4XpY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558708834; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=F7bxjaHt9Rbt+r36Ts6WKzlHx5hNo2cpK9LBvE83bzg=; b=WgHm29PcDohTNdfVKSZOEUCvTDaaxWFRvhohQa9M7CHVq0gg3pGhpppmH4xZ7EnrdWXWpJqTY6ClwTkU40OWmRAz49vui2FxbHiH+T22IArgBujc8hDRDPfgo0IFz3MNpEfEvdQRJe7beIM0xRQxY0SJkM/uQveFZ/Hz9KUd9P0= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+41338+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1558708834414197.49164469419316; Fri, 24 May 2019 07:40:34 -0700 (PDT) Return-Path: X-Received: from mga11.intel.com (mga11.intel.com []) by groups.io with SMTP; Fri, 24 May 2019 07:40:33 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP; 24 May 2019 07:40:33 -0700 X-ExtLoop1: 1 X-Received: from rodrigu3-desk.amr.corp.intel.com ([10.7.163.75]) by orsmga008.jf.intel.com with ESMTP; 24 May 2019 07:40:33 -0700 From: "Christian Rodriguez" To: devel@edk2.groups.io Cc: Bob Feng , Liming Gao , Yonghong Zhu Subject: [edk2-devel] [Patch V3 2/2] BaseTools: Add a checking for Sources section in INF file [Part 2/2] Date: Fri, 24 May 2019 07:40:27 -0700 Message-Id: <20190524144027.9552-3-christian.rodriguez@intel.com> In-Reply-To: <20190524144027.9552-1-christian.rodriguez@intel.com> References: <20190524144027.9552-1-christian.rodriguez@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,christian.rodriguez@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1558708834; bh=RIon0qxTV6eUvcmu9bRv1Wc1v+P4xJ9c9R4ktHQU+RY=; h=Cc:Date:From:Reply-To:Subject:To; b=cjYMeneDa/WZG3REOKAZPcjAI7m0LF6A+lrWGmLftoaeNFC2IUaOscK/SyjzFo9CgW2 HQIRky7YvH9sARJ2Krz7VDgvOmWBztBd2asTYFOdXfOUazt7QWja7nPpW3DejrMlpPUi7 nOzmMX/4G1Pj8Y5FgjMsX6iYUrNBuh9qbTE= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1804 In V3: Seperate checker and hashing into individual patches In V2: Enable check for all builds, move conditional to hash invalidation In the Edk2 INF spec 3.9, it states, All HII Unicode format files must be listed in [Sources] section. Add a check to see if [Sources] section lists all the "source" type files of a module. Performance impact should be minimal with this patch since information is already being fetched for Makefile purposes. All other information is already cached in memory. No extra IO time is needed. Part 2 is hashing update. Signed-off-by: Christian Rodriguez Cc: Bob Feng Cc: Liming Gao Cc: Yonghong Zhu --- BaseTools/Source/Python/AutoGen/AutoGen.py | 6 +- BaseTools/Source/Python/AutoGen/GenMake.py | 6 ++ BaseTools/Source/Python/Common/GlobalData.py | 3 +- BaseTools/Source/Python/build/build.py | 65 ++++++++++++-------- 4 files changed, 53 insertions(+), 27 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index a843f294b9..0bc27fb2b3 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -3989,7 +3989,8 @@ class ModuleAutoGen(AutoGen): for LibraryAutoGen in self.LibraryAutoGenList: LibraryAutoGen.CreateMakeFile() =20 - if self.CanSkip(): + # Don't enable if hash feature enabled, CanSkip uses timestamps to= determine build skipping + if not GlobalData.gUseHashCache and self.CanSkip(): return =20 if len(self.CustomMakefile) =3D=3D 0: @@ -4032,7 +4033,8 @@ class ModuleAutoGen(AutoGen): for LibraryAutoGen in self.LibraryAutoGenList: LibraryAutoGen.CreateCodeFile() =20 - if self.CanSkip(): + # Don't enable if hash feature enabled, CanSkip uses timestamps to= determine build skipping + if not GlobalData.gUseHashCache and self.CanSkip(): return =20 AutoGenList =3D [] diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/= Python/AutoGen/GenMake.py index 5c992d7c26..212ca0fa7f 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -935,10 +935,16 @@ cleanlib: continue headerFileDependencySet.add(aFileName) =20 + # Ensure that gModuleBuildTracking has been initialized per archit= ecture + if self._AutoGenObject.Arch not in GlobalData.gModuleBuildTracking: + GlobalData.gModuleBuildTracking[self._AutoGenObject.Arch] =3D = dict() + # Check if a module dependency header file is missing from the mod= ule's MetaFile for aFile in headerFileDependencySet: if aFile in headerFilesInMetaFileSet: continue + if GlobalData.gUseHashCache: + GlobalData.gModuleBuildTracking[self._AutoGenObject.Arch][= self._AutoGenObject] =3D 'FAIL_METAFILE' EdkLogger.warn("build","Module MetaFile [Sources] is missing l= ocal header!", ExtraData =3D "Local Header: " + aFile + " not fou= nd in " + self._AutoGenObject.MetaFile.Path ) diff --git a/BaseTools/Source/Python/Common/GlobalData.py b/BaseTools/Sourc= e/Python/Common/GlobalData.py index 95e28a988f..bd45a43728 100644 --- a/BaseTools/Source/Python/Common/GlobalData.py +++ b/BaseTools/Source/Python/Common/GlobalData.py @@ -110,7 +110,8 @@ gEnableGenfdsMultiThread =3D False gSikpAutoGenCache =3D set() =20 # Dictionary for tracking Module build status as success or failure -# False -> Fail : True -> Success +# Top Dict: Key: Arch Type Value: Dictionary +# Second Dict: Key: AutoGen Obj Value: 'SUCCESS'\'FAIL'\'FAIL_METAFILE' gModuleBuildTracking =3D dict() =20 # Dictionary of booleans that dictate whether a module or diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Pyth= on/build/build.py index 80ceb98310..0855d4561c 100644 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -625,8 +625,16 @@ class BuildTask: BuildTask._ErrorFlag.set() BuildTask._ErrorMessage =3D "%s broken\n %s [%s]" % \ (threading.currentThread().getName()= , Command, WorkingDir) - if self.BuildItem.BuildObject in GlobalData.gModuleBuildTracking a= nd not BuildTask._ErrorFlag.isSet(): - GlobalData.gModuleBuildTracking[self.BuildItem.BuildObject] = =3D True + + # Set the value used by hash invalidation flow in GlobalData.gModu= leBuildTracking to 'SUCCESS' + # If Module or Lib is being tracked, it did not fail header check = test, and built successfully + if (self.BuildItem.BuildObject.Arch in GlobalData.gModuleBuildTrac= king and + self.BuildItem.BuildObject in GlobalData.gModuleBuildTracking[s= elf.BuildItem.BuildObject.Arch] and + GlobalData.gModuleBuildTracking[self.BuildItem.BuildObject.Arch= ][self.BuildItem.BuildObject] !=3D 'FAIL_METAFILE' and + not BuildTask._ErrorFlag.isSet() + ): + GlobalData.gModuleBuildTracking[self.BuildItem.BuildObject.Arc= h][self.BuildItem.BuildObject] =3D 'SUCCESS' + # indicate there's a thread is available for another build task BuildTask._RunningQueueLock.acquire() BuildTask._RunningQueue.pop(self.BuildItem) @@ -1154,27 +1162,30 @@ class Build(): # # def invalidateHash(self): - # GlobalData.gModuleBuildTracking contains only modules that canno= t be skipped by hash - for moduleAutoGenObj in GlobalData.gModuleBuildTracking.keys(): - # False =3D=3D FAIL : True =3D=3D Success - # Skip invalidating for Successful module builds - if GlobalData.gModuleBuildTracking[moduleAutoGenObj] =3D=3D Tr= ue: - continue + # Only for hashing feature + if not GlobalData.gUseHashCache: + return + + # GlobalData.gModuleBuildTracking contains only modules or libs th= at cannot be skipped by hash + for moduleAutoGenObjArch in GlobalData.gModuleBuildTracking.keys(): + for moduleAutoGenObj in GlobalData.gModuleBuildTracking[module= AutoGenObjArch].keys(): + # Skip invalidating for Successful Module/Lib builds + if GlobalData.gModuleBuildTracking[moduleAutoGenObjArch][m= oduleAutoGenObj] =3D=3D 'SUCCESS': + continue =20 - # The module failed to build or failed to start building, from= this point on + # The module failed to build, failed to start building, or= failed the header check test from this point on =20 - # Remove .hash from build - if GlobalData.gUseHashCache: - ModuleHashFile =3D path.join(moduleAutoGenObj.BuildDir, mo= duleAutoGenObj.Name + ".hash") + # Remove .hash from build + ModuleHashFile =3D os.path.join(moduleAutoGenObj.BuildDir,= moduleAutoGenObj.Name + ".hash") if os.path.exists(ModuleHashFile): os.remove(ModuleHashFile) =20 - # Remove .hash file from cache - if GlobalData.gBinCacheDest: - FileDir =3D path.join(GlobalData.gBinCacheDest, moduleAuto= GenObj.Arch, moduleAutoGenObj.SourceDir, moduleAutoGenObj.MetaFile.BaseName) - HashFile =3D path.join(FileDir, moduleAutoGenObj.Name + '.= hash') - if os.path.exists(HashFile): - os.remove(HashFile) + # Remove .hash file from cache + if GlobalData.gBinCacheDest: + FileDir =3D os.path.join(GlobalData.gBinCacheDest, mod= uleAutoGenObj.Arch, moduleAutoGenObj.SourceDir, moduleAutoGenObj.MetaFile.B= aseName) + HashFile =3D os.path.join(FileDir, moduleAutoGenObj.Na= me + '.hash') + if os.path.exists(HashFile): + os.remove(HashFile) =20 ## Build a module or platform # @@ -1825,9 +1836,11 @@ class Build(): if self.Target =3D=3D "genmake": return True self.BuildModules.append(Ma) - # Initialize all modules in tracking to False = (FAIL) - if Ma not in GlobalData.gModuleBuildTracking: - GlobalData.gModuleBuildTracking[Ma] =3D Fa= lse + # Initialize all modules in tracking to 'FAIL' + if Ma.Arch not in GlobalData.gModuleBuildTrack= ing: + GlobalData.gModuleBuildTracking[Ma.Arch] = =3D dict() + if Ma not in GlobalData.gModuleBuildTracking[M= a.Arch]: + GlobalData.gModuleBuildTracking[Ma.Arch][M= a] =3D 'FAIL' self.AutoGenTime +=3D int(round((time.time() - AutoGen= Start))) MakeStart =3D time.time() for Ma in self.BuildModules: @@ -1911,6 +1924,7 @@ class Build(): # Save MAP buffer into MAP file. # self._SaveMapFile (MapBuffer, Wa) + self.invalidateHash() =20 def _GenFfsCmd(self,ArchList): # convert dictionary of Cmd:(Inf,Arch) @@ -2009,9 +2023,11 @@ class Build(): if self.Target =3D=3D "genmake": continue self.BuildModules.append(Ma) - # Initialize all modules in tracking to False (FAI= L) - if Ma not in GlobalData.gModuleBuildTracking: - GlobalData.gModuleBuildTracking[Ma] =3D False + # Initialize all modules in tracking to 'FAIL' + if Ma.Arch not in GlobalData.gModuleBuildTracking: + GlobalData.gModuleBuildTracking[Ma.Arch] =3D d= ict() + if Ma not in GlobalData.gModuleBuildTracking[Ma.Ar= ch]: + GlobalData.gModuleBuildTracking[Ma.Arch][Ma] = =3D 'FAIL' self.Progress.Stop("done!") self.AutoGenTime +=3D int(round((time.time() - AutoGen= Start))) MakeStart =3D time.time() @@ -2099,6 +2115,7 @@ class Build(): # Save MAP buffer into MAP file. # self._SaveMapFile(MapBuffer, Wa) + self.invalidateHash() =20 ## Generate GuidedSectionTools.txt in the FV directories. # --=20 2.19.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#41338): https://edk2.groups.io/g/devel/message/41338 Mute This Topic: https://groups.io/mt/31745162/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-