* [PATCH] IntelFsp2Pkg/GenCfgOpt: skip unnecessarily header/BSF recreating.
@ 2020-10-01 2:11 Chiu, Chasel
2020-10-09 20:37 ` Nate DeSimone
2020-10-10 0:40 ` 回复: [edk2-devel] " gaoliming
0 siblings, 2 replies; 3+ messages in thread
From: Chiu, Chasel @ 2020-10-01 2:11 UTC (permalink / raw)
To: devel; +Cc: Chasel Chiu, Maurice Ma, Nate DeSimone, Star Zeng
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2967
When no change in FSP UPD DSC files, GenCfgOpt.py should skip
recreating UPD header and BSF files.
This patch added a check to handle this case.
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
---
IntelFsp2Pkg/Tools/GenCfgOpt.py | 60 ++++++++++++++++++++++++++++++++++++++++++------------------
1 file changed, 42 insertions(+), 18 deletions(-)
diff --git a/IntelFsp2Pkg/Tools/GenCfgOpt.py b/IntelFsp2Pkg/Tools/GenCfgOpt.py
index bcced590ce..af7e14a10a 100644
--- a/IntelFsp2Pkg/Tools/GenCfgOpt.py
+++ b/IntelFsp2Pkg/Tools/GenCfgOpt.py
@@ -810,6 +810,17 @@ EndList
SubItem['value'] = valuestr
return Error
+ def NoDscFileChange (self, OutPutFile):
+ NoFileChange = True
+ if not os.path.exists(OutPutFile):
+ NoFileChange = False
+ else:
+ DscTime = os.path.getmtime(self._DscFile)
+ OutputTime = os.path.getmtime(OutPutFile)
+ if DscTime > OutputTime:
+ NoFileChange = False
+ return NoFileChange
+
def CreateSplitUpdTxt (self, UpdTxtFile):
GuidList = ['FSP_T_UPD_TOOL_GUID','FSP_M_UPD_TOOL_GUID','FSP_S_UPD_TOOL_GUID']
SignatureList = ['0x545F', '0x4D5F','0x535F'] # _T, _M, and _S signature for FSPT, FSPM, FSPS
@@ -823,16 +834,7 @@ EndList
if UpdTxtFile == '':
UpdTxtFile = os.path.join(FvDir, self._MacroDict[GuidList[Index]] + '.txt')
- ReCreate = False
- if not os.path.exists(UpdTxtFile):
- ReCreate = True
- else:
- DscTime = os.path.getmtime(self._DscFile)
- TxtTime = os.path.getmtime(UpdTxtFile)
- if DscTime > TxtTime:
- ReCreate = True
-
- if not ReCreate:
+ if (self.NoDscFileChange (UpdTxtFile)):
# DSC has not been modified yet
# So don't have to re-generate other files
self.Error = 'No DSC file change, skip to create UPD TXT file'
@@ -1056,7 +1058,11 @@ EndList
HeaderFile = os.path.join(FvDir, HeaderFileName)
# Check if header needs to be recreated
- ReCreate = False
+ if (self.NoDscFileChange (HeaderFile)):
+ # DSC has not been modified yet
+ # So don't have to re-generate other files
+ self.Error = 'No DSC file change, skip to create UPD header file'
+ return 256
TxtBody = []
for Item in self._CfgItemList:
@@ -1382,6 +1388,12 @@ EndList
self.Error = "BSF output file '%s' is invalid" % BsfFile
return 1
+ if (self.NoDscFileChange (BsfFile)):
+ # DSC has not been modified yet
+ # So don't have to re-generate other files
+ self.Error = 'No DSC file change, skip to create UPD BSF file'
+ return 256
+
Error = 0
OptionDict = {}
BsfFd = open(BsfFile, "w")
@@ -1467,7 +1479,7 @@ EndList
def Usage():
- print ("GenCfgOpt Version 0.55")
+ print ("GenCfgOpt Version 0.56")
print ("Usage:")
print (" GenCfgOpt UPDTXT PlatformDscFile BuildFvDir [-D Macros]")
print (" GenCfgOpt HEADER PlatformDscFile BuildFvDir InputHFile [-D Macros]")
@@ -1529,13 +1541,25 @@ def Main():
print ("ERROR: %s !" % (GenCfgOpt.Error))
return Ret
elif sys.argv[1] == "HEADER":
- if GenCfgOpt.CreateHeaderFile(OutFile) != 0:
- print ("ERROR: %s !" % GenCfgOpt.Error)
- return 8
+ Ret = GenCfgOpt.CreateHeaderFile(OutFile)
+ if Ret != 0:
+ # No change is detected
+ if Ret == 256:
+ print ("INFO: %s !" % (GenCfgOpt.Error))
+ else :
+ print ("ERROR: %s !" % (GenCfgOpt.Error))
+ return 8
+ return Ret
elif sys.argv[1] == "GENBSF":
- if GenCfgOpt.GenerateBsfFile(OutFile) != 0:
- print ("ERROR: %s !" % GenCfgOpt.Error)
- return 9
+ Ret = GenCfgOpt.GenerateBsfFile(OutFile)
+ if Ret != 0:
+ # No change is detected
+ if Ret == 256:
+ print ("INFO: %s !" % (GenCfgOpt.Error))
+ else :
+ print ("ERROR: %s !" % (GenCfgOpt.Error))
+ return 9
+ return Ret
else:
if argc < 5:
Usage()
--
2.28.0.windows.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] IntelFsp2Pkg/GenCfgOpt: skip unnecessarily header/BSF recreating.
2020-10-01 2:11 [PATCH] IntelFsp2Pkg/GenCfgOpt: skip unnecessarily header/BSF recreating Chiu, Chasel
@ 2020-10-09 20:37 ` Nate DeSimone
2020-10-10 0:40 ` 回复: [edk2-devel] " gaoliming
1 sibling, 0 replies; 3+ messages in thread
From: Nate DeSimone @ 2020-10-09 20:37 UTC (permalink / raw)
To: Chiu, Chasel, devel@edk2.groups.io; +Cc: Chiu, Chasel, Ma, Maurice, Zeng, Star
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
> -----Original Message-----
> From: Chasel Chiu <chasel.chiu@intel.com>
> Sent: Wednesday, September 30, 2020 7:12 PM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel <chasel.chiu@intel.com>; Ma, Maurice
> <maurice.ma@intel.com>; Desimone, Nathaniel L
> <nathaniel.l.desimone@intel.com>; Zeng, Star <star.zeng@intel.com>
> Subject: [PATCH] IntelFsp2Pkg/GenCfgOpt: skip unnecessarily header/BSF
> recreating.
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2967
>
> When no change in FSP UPD DSC files, GenCfgOpt.py should skip recreating
> UPD header and BSF files.
> This patch added a check to handle this case.
>
> Cc: Maurice Ma <maurice.ma@intel.com>
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
> ---
> IntelFsp2Pkg/Tools/GenCfgOpt.py | 60
> ++++++++++++++++++++++++++++++++++++++++++------------------
> 1 file changed, 42 insertions(+), 18 deletions(-)
>
> diff --git a/IntelFsp2Pkg/Tools/GenCfgOpt.py
> b/IntelFsp2Pkg/Tools/GenCfgOpt.py index bcced590ce..af7e14a10a 100644
> --- a/IntelFsp2Pkg/Tools/GenCfgOpt.py
> +++ b/IntelFsp2Pkg/Tools/GenCfgOpt.py
> @@ -810,6 +810,17 @@ EndList
> SubItem['value'] = valuestr return Error + def NoDscFileChange
> (self, OutPutFile):+ NoFileChange = True+ if not
> os.path.exists(OutPutFile):+ NoFileChange = False+ else:+
> DscTime = os.path.getmtime(self._DscFile)+ OutputTime =
> os.path.getmtime(OutPutFile)+ if DscTime > OutputTime:+
> NoFileChange = False+ return NoFileChange+ def CreateSplitUpdTxt
> (self, UpdTxtFile): GuidList =
> ['FSP_T_UPD_TOOL_GUID','FSP_M_UPD_TOOL_GUID','FSP_S_UPD_TOOL_
> GUID'] SignatureList = ['0x545F', '0x4D5F','0x535F'] # _T, _M, and _S
> signature for FSPT, FSPM, FSPS@@ -823,16 +834,7 @@ EndList
> if UpdTxtFile == '': UpdTxtFile = os.path.join(FvDir,
> self._MacroDict[GuidList[Index]] + '.txt') - ReCreate = False- if not
> os.path.exists(UpdTxtFile):- ReCreate = True- else:-
> DscTime = os.path.getmtime(self._DscFile)- TxtTime =
> os.path.getmtime(UpdTxtFile)- if DscTime > TxtTime:-
> ReCreate = True-- if not ReCreate:+ if (self.NoDscFileChange
> (UpdTxtFile)): # DSC has not been modified yet # So don't
> have to re-generate other files self.Error = 'No DSC file change, skip
> to create UPD TXT file'@@ -1056,7 +1058,11 @@ EndList
> HeaderFile = os.path.join(FvDir, HeaderFileName) # Check if header
> needs to be recreated- ReCreate = False+ if (self.NoDscFileChange
> (HeaderFile)):+ # DSC has not been modified yet+ # So don't have
> to re-generate other files+ self.Error = 'No DSC file change, skip to
> create UPD header file'+ return 256 TxtBody = [] for Item in
> self._CfgItemList:@@ -1382,6 +1388,12 @@ EndList
> self.Error = "BSF output file '%s' is invalid" % BsfFile return 1 +
> if (self.NoDscFileChange (BsfFile)):+ # DSC has not been modified yet+
> # So don't have to re-generate other files+ self.Error = 'No DSC file
> change, skip to create UPD BSF file'+ return 256+ Error = 0
> OptionDict = {} BsfFd = open(BsfFile, "w")@@ -1467,7 +1479,7 @@
> EndList
> def Usage():- print ("GenCfgOpt Version 0.55")+ print ("GenCfgOpt
> Version 0.56") print ("Usage:") print (" GenCfgOpt UPDTXT
> PlatformDscFile BuildFvDir [-D Macros]") print (" GenCfgOpt
> HEADER PlatformDscFile BuildFvDir InputHFile [-D Macros]")@@ -1529,13
> +1541,25 @@ def Main():
> print ("ERROR: %s !" % (GenCfgOpt.Error)) return Ret elif
> sys.argv[1] == "HEADER":- if GenCfgOpt.CreateHeaderFile(OutFile) !=
> 0:- print ("ERROR: %s !" % GenCfgOpt.Error)- return 8+
> Ret = GenCfgOpt.CreateHeaderFile(OutFile)+ if Ret != 0:+ # No
> change is detected+ if Ret == 256:+ print ("INFO: %s !" %
> (GenCfgOpt.Error))+ else :+ print ("ERROR: %s !" %
> (GenCfgOpt.Error))+ return 8+ return Ret elif sys.argv[1]
> == "GENBSF":- if GenCfgOpt.GenerateBsfFile(OutFile) != 0:-
> print ("ERROR: %s !" % GenCfgOpt.Error)- return 9+ Ret =
> GenCfgOpt.GenerateBsfFile(OutFile)+ if Ret != 0:+ # No change
> is detected+ if Ret == 256:+ print ("INFO: %s !" %
> (GenCfgOpt.Error))+ else :+ print ("ERROR: %s !" %
> (GenCfgOpt.Error))+ return 9+ return Ret else: if
> argc < 5: Usage()--
> 2.28.0.windows.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* 回复: [edk2-devel] [PATCH] IntelFsp2Pkg/GenCfgOpt: skip unnecessarily header/BSF recreating.
2020-10-01 2:11 [PATCH] IntelFsp2Pkg/GenCfgOpt: skip unnecessarily header/BSF recreating Chiu, Chasel
2020-10-09 20:37 ` Nate DeSimone
@ 2020-10-10 0:40 ` gaoliming
1 sibling, 0 replies; 3+ messages in thread
From: gaoliming @ 2020-10-10 0:40 UTC (permalink / raw)
To: devel, chasel.chiu
Cc: 'Maurice Ma', 'Nate DeSimone',
'Star Zeng'
Chasel:
This change fixes the issue reported in BZ 2967. Reviewed-by: Liming Gao
<gaoliming@byosoft.com.cn>
Thanks
Liming
> -----邮件原件-----
> 发件人: bounce+27952+65775+4905953+8761045@groups.io
> <bounce+27952+65775+4905953+8761045@groups.io> 代表 Chiu, Chasel
> 发送时间: 2020年10月1日 10:12
> 收件人: devel@edk2.groups.io
> 抄送: Chasel Chiu <chasel.chiu@intel.com>; Maurice Ma
> <maurice.ma@intel.com>; Nate DeSimone
> <nathaniel.l.desimone@intel.com>; Star Zeng <star.zeng@intel.com>
> 主题: [edk2-devel] [PATCH] IntelFsp2Pkg/GenCfgOpt: skip unnecessarily
> header/BSF recreating.
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2967
>
> When no change in FSP UPD DSC files, GenCfgOpt.py should skip
> recreating UPD header and BSF files.
> This patch added a check to handle this case.
>
> Cc: Maurice Ma <maurice.ma@intel.com>
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
> ---
> IntelFsp2Pkg/Tools/GenCfgOpt.py | 60
> ++++++++++++++++++++++++++++++++++++++++++------------------
> 1 file changed, 42 insertions(+), 18 deletions(-)
>
> diff --git a/IntelFsp2Pkg/Tools/GenCfgOpt.py
> b/IntelFsp2Pkg/Tools/GenCfgOpt.py
> index bcced590ce..af7e14a10a 100644
> --- a/IntelFsp2Pkg/Tools/GenCfgOpt.py
> +++ b/IntelFsp2Pkg/Tools/GenCfgOpt.py
> @@ -810,6 +810,17 @@ EndList
> SubItem['value'] = valuestr
>
> return Error
>
>
>
> + def NoDscFileChange (self, OutPutFile):
>
> + NoFileChange = True
>
> + if not os.path.exists(OutPutFile):
>
> + NoFileChange = False
>
> + else:
>
> + DscTime = os.path.getmtime(self._DscFile)
>
> + OutputTime = os.path.getmtime(OutPutFile)
>
> + if DscTime > OutputTime:
>
> + NoFileChange = False
>
> + return NoFileChange
>
> +
>
> def CreateSplitUpdTxt (self, UpdTxtFile):
>
> GuidList =
> ['FSP_T_UPD_TOOL_GUID','FSP_M_UPD_TOOL_GUID','FSP_S_UPD_TOOL_G
> UID']
>
> SignatureList = ['0x545F', '0x4D5F','0x535F'] # _T, _M,
> and _S signature for FSPT, FSPM, FSPS
>
> @@ -823,16 +834,7 @@ EndList
> if UpdTxtFile == '':
>
> UpdTxtFile = os.path.join(FvDir,
> self._MacroDict[GuidList[Index]] + '.txt')
>
>
>
> - ReCreate = False
>
> - if not os.path.exists(UpdTxtFile):
>
> - ReCreate = True
>
> - else:
>
> - DscTime = os.path.getmtime(self._DscFile)
>
> - TxtTime = os.path.getmtime(UpdTxtFile)
>
> - if DscTime > TxtTime:
>
> - ReCreate = True
>
> -
>
> - if not ReCreate:
>
> + if (self.NoDscFileChange (UpdTxtFile)):
>
> # DSC has not been modified yet
>
> # So don't have to re-generate other files
>
> self.Error = 'No DSC file change, skip to create UPD TXT
> file'
>
> @@ -1056,7 +1058,11 @@ EndList
> HeaderFile = os.path.join(FvDir, HeaderFileName)
>
>
>
> # Check if header needs to be recreated
>
> - ReCreate = False
>
> + if (self.NoDscFileChange (HeaderFile)):
>
> + # DSC has not been modified yet
>
> + # So don't have to re-generate other files
>
> + self.Error = 'No DSC file change, skip to create UPD header
> file'
>
> + return 256
>
>
>
> TxtBody = []
>
> for Item in self._CfgItemList:
>
> @@ -1382,6 +1388,12 @@ EndList
> self.Error = "BSF output file '%s' is invalid" % BsfFile
>
> return 1
>
>
>
> + if (self.NoDscFileChange (BsfFile)):
>
> + # DSC has not been modified yet
>
> + # So don't have to re-generate other files
>
> + self.Error = 'No DSC file change, skip to create UPD BSF
file'
>
> + return 256
>
> +
>
> Error = 0
>
> OptionDict = {}
>
> BsfFd = open(BsfFile, "w")
>
> @@ -1467,7 +1479,7 @@ EndList
>
>
>
>
> def Usage():
>
> - print ("GenCfgOpt Version 0.55")
>
> + print ("GenCfgOpt Version 0.56")
>
> print ("Usage:")
>
> print (" GenCfgOpt UPDTXT PlatformDscFile BuildFvDir
> [-D Macros]")
>
> print (" GenCfgOpt HEADER PlatformDscFile BuildFvDir
> InputHFile [-D Macros]")
>
> @@ -1529,13 +1541,25 @@ def Main():
> print ("ERROR: %s !" % (GenCfgOpt.Error))
>
> return Ret
>
> elif sys.argv[1] == "HEADER":
>
> - if GenCfgOpt.CreateHeaderFile(OutFile) != 0:
>
> - print ("ERROR: %s !" % GenCfgOpt.Error)
>
> - return 8
>
> + Ret = GenCfgOpt.CreateHeaderFile(OutFile)
>
> + if Ret != 0:
>
> + # No change is detected
>
> + if Ret == 256:
>
> + print ("INFO: %s !" % (GenCfgOpt.Error))
>
> + else :
>
> + print ("ERROR: %s !" % (GenCfgOpt.Error))
>
> + return 8
>
> + return Ret
>
> elif sys.argv[1] == "GENBSF":
>
> - if GenCfgOpt.GenerateBsfFile(OutFile) != 0:
>
> - print ("ERROR: %s !" % GenCfgOpt.Error)
>
> - return 9
>
> + Ret = GenCfgOpt.GenerateBsfFile(OutFile)
>
> + if Ret != 0:
>
> + # No change is detected
>
> + if Ret == 256:
>
> + print ("INFO: %s !" % (GenCfgOpt.Error))
>
> + else :
>
> + print ("ERROR: %s !" % (GenCfgOpt.Error))
>
> + return 9
>
> + return Ret
>
> else:
>
> if argc < 5:
>
> Usage()
>
> --
> 2.28.0.windows.1
>
>
>
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#65775): https://edk2.groups.io/g/devel/message/65775
> Mute This Topic: https://groups.io/mt/77232193/4905953
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [gaoliming@byosoft.com.cn]
> -=-=-=-=-=-=
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-10-10 0:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-01 2:11 [PATCH] IntelFsp2Pkg/GenCfgOpt: skip unnecessarily header/BSF recreating Chiu, Chasel
2020-10-09 20:37 ` Nate DeSimone
2020-10-10 0:40 ` 回复: [edk2-devel] " gaoliming
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox