public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Chiu, Chasel" <chasel.chiu@intel.com>
To: devel@edk2.groups.io
Cc: 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>
Subject: [PATCH] IntelFsp2Pkg/GenCfgOpt.py: Incremental build with UPD in sub DSC.
Date: Tue,  8 Dec 2020 10:15:53 +0800	[thread overview]
Message-ID: <20201208021553.1348-1-chasel.chiu@intel.com> (raw)

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3107

Current script only compares main DSC and output file datetime
to determine if re-generation required or not.
When UPD defined in sub DSC and was modified current script cannot
detect and will not re-generate output files which caused incremental
build issue.

Since UPD can be defined in any sub DSC the script has been updated
to compare all DSC datetime with output files to determine re-generation
is needed or not.

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 | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/IntelFsp2Pkg/Tools/GenCfgOpt.py b/IntelFsp2Pkg/Tools/GenCfgOpt.py
index af7e14a10a..a0b8bba81e 100644
--- a/IntelFsp2Pkg/Tools/GenCfgOpt.py
+++ b/IntelFsp2Pkg/Tools/GenCfgOpt.py
@@ -313,6 +313,7 @@ EndList
         self._DscFile     = ''
         self._FvDir       = ''
         self._MapVer      = 0
+        self._DscTime     = 0
 
     def ParseMacros (self, MacroDefStr):
         # ['-DABC=1', '-D', 'CFG_DEBUG=1', '-D', 'CFG_OUTDIR=Build']
@@ -423,6 +424,9 @@ EndList
         self._DscFile     = DscFile
         self._FvDir       = FvDir
 
+        # Initial DSC time is parent DSC time.
+        self._DscTime     = os.path.getmtime(DscFile)
+
         IsDefSect       = False
         IsPcdSect       = False
         IsUpdSect       = False
@@ -530,6 +534,12 @@ EndList
                                         if IncludeDsc == None:
                                             print("ERROR: Cannot open file '%s'" % IncludeFilePath)
                                             raise SystemExit
+
+                                        # Update DscTime when newer DSC time found.
+                                        CurrentDscTime = os.path.getmtime(os.path.realpath(IncludeDsc.name))
+                                        if CurrentDscTime > self._DscTime:
+                                            self._DscTime = CurrentDscTime
+
                                         NewDscLines = IncludeDsc.readlines()
                                         IncludeDsc.close()
                                         DscLines = NewDscLines + DscLines
@@ -815,9 +825,8 @@ EndList
         if not os.path.exists(OutPutFile):
             NoFileChange = False
         else:
-            DscTime = os.path.getmtime(self._DscFile)
             OutputTime = os.path.getmtime(OutPutFile)
-            if DscTime > OutputTime:
+            if self._DscTime > OutputTime:
                 NoFileChange = False
         return NoFileChange
 
-- 
2.28.0.windows.1


             reply	other threads:[~2020-12-08  2:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-08  2:15 Chiu, Chasel [this message]
2020-12-08  3:28 ` [edk2-devel] [PATCH] IntelFsp2Pkg/GenCfgOpt.py: Incremental build with UPD in sub DSC Yuwei Chen
2020-12-09 10:13 ` Nate DeSimone
2020-12-09 11:37 ` Zeng, Star

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201208021553.1348-1-chasel.chiu@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox