public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] BaseTools/BuildReport: fix report for platforms/arches without struct PCDs
@ 2019-02-05 11:22 Laszlo Ersek
  2019-02-05 16:58 ` Vladimir Olovyannikov
  0 siblings, 1 reply; 4+ messages in thread
From: Laszlo Ersek @ 2019-02-05 11:22 UTC (permalink / raw)
  To: edk2-devel; +Cc: Bob Feng, Liming Gao, Vladimir Olovyannikov, Yonghong Zhu

The goal of commit 97c8f5b9e7d3 ("BaseTools:StructurePCD value display
incorrect in "Not used" section.", 2019-02-02) was to display the full
contents of such structure PCDs in the build report that were set in the
platform DSC or the FDF, but not used in any module INFs. The listings
would appear in the

  PCDs not used by modules or in conditional directives

section of the build report.

Commit 97c8f5b9e7d3 assumed that any (platform, architecture) combination
would have a (possibly empty) set of structure PCD (and so the set of the
structure PCDs could be filtered for set-but-unused ones).

This is not the case: in "DscBuildData.py", in method
UpdateStructuredPcds(), if "S_pcd_set" remains an empty OrderedDict(),
then it is not added to "GlobalData.gStructurePcd" *at all*, for the
current (platform, architecture) combination.

As a result, when the PCD report tries to fetch the set of structure PCDs
for the current (platform, architecture), "GlobalData.gStructurePcd" does
not return an empty OrderedDict(); instead, it raises a KeyError. Fix it
by defaulting to an empty OrderedDict(), with the get() method.

Reported-by: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1513
Fixes: 97c8f5b9e7d3136b6051a05cf056ce5ca9e79893
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---

Notes:
    Repo:   https://github.com/lersek/edk2.git
    Branch: report_without_struct_pcds

 BaseTools/Source/Python/build/BuildReport.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py
index e457660fcef3..0b98d62cb6aa 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -780,7 +780,7 @@ class PcdReport(object):
             # Collect the PCD defined in DSC/FDF file, but not used in module
             #
             UnusedPcdFullList = []
-            StructPcdDict = GlobalData.gStructurePcd[self.Arch]
+            StructPcdDict = GlobalData.gStructurePcd.get(self.Arch, collections.OrderedDict())
             for Name, Guid in StructPcdDict:
                 if (Name, Guid) not in Pa.Platform.Pcds:
                     Pcd = StructPcdDict[(Name, Guid)]
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] BaseTools/BuildReport: fix report for platforms/arches without struct PCDs
  2019-02-05 11:22 [PATCH] BaseTools/BuildReport: fix report for platforms/arches without struct PCDs Laszlo Ersek
@ 2019-02-05 16:58 ` Vladimir Olovyannikov
  2019-02-06 23:08   ` FW: " Carsey, Jaben
  0 siblings, 1 reply; 4+ messages in thread
From: Vladimir Olovyannikov @ 2019-02-05 16:58 UTC (permalink / raw)
  To: Laszlo Ersek, edk2-devel; +Cc: Bob Feng, Liming Gao, Yonghong Zhu

Laszlo,
Thanks a lot for the prompt fix. Works now.

Tested-by: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>

-----Original Message-----
From: Laszlo Ersek [mailto:lersek@redhat.com]
Sent: Tuesday, February 5, 2019 3:22 AM
To: edk2-devel@lists.01.org
Cc: Bob Feng; Liming Gao; Vladimir Olovyannikov; Yonghong Zhu
Subject: [PATCH] BaseTools/BuildReport: fix report for platforms/arches
without struct PCDs

The goal of commit 97c8f5b9e7d3 ("BaseTools:StructurePCD value display
incorrect in "Not used" section.", 2019-02-02) was to display the full
contents of such structure PCDs in the build report that were set in the
platform DSC or the FDF, but not used in any module INFs. The listings
would appear in the

  PCDs not used by modules or in conditional directives

section of the build report.

Commit 97c8f5b9e7d3 assumed that any (platform, architecture) combination
would have a (possibly empty) set of structure PCD (and so the set of the
structure PCDs could be filtered for set-but-unused ones).

This is not the case: in "DscBuildData.py", in method
UpdateStructuredPcds(), if "S_pcd_set" remains an empty OrderedDict(),
then it is not added to "GlobalData.gStructurePcd" *at all*, for the
current (platform, architecture) combination.

As a result, when the PCD report tries to fetch the set of structure PCDs
for the current (platform, architecture), "GlobalData.gStructurePcd" does
not return an empty OrderedDict(); instead, it raises a KeyError. Fix it
by defaulting to an empty OrderedDict(), with the get() method.

Reported-by: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1513
Fixes: 97c8f5b9e7d3136b6051a05cf056ce5ca9e79893
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---

Notes:
    Repo:   https://github.com/lersek/edk2.git
    Branch: report_without_struct_pcds

 BaseTools/Source/Python/build/BuildReport.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/build/BuildReport.py
b/BaseTools/Source/Python/build/BuildReport.py
index e457660fcef3..0b98d62cb6aa 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -780,7 +780,7 @@ class PcdReport(object):
             # Collect the PCD defined in DSC/FDF file, but not used in
module
             #
             UnusedPcdFullList = []
-            StructPcdDict = GlobalData.gStructurePcd[self.Arch]
+            StructPcdDict = GlobalData.gStructurePcd.get(self.Arch,
collections.OrderedDict())
             for Name, Guid in StructPcdDict:
                 if (Name, Guid) not in Pa.Platform.Pcds:
                     Pcd = StructPcdDict[(Name, Guid)]
-- 
2.19.1.3.g30247aa5d201


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* FW: [PATCH] BaseTools/BuildReport: fix report for platforms/arches without struct PCDs
  2019-02-05 16:58 ` Vladimir Olovyannikov
@ 2019-02-06 23:08   ` Carsey, Jaben
  2019-02-07 13:27     ` Laszlo Ersek
  0 siblings, 1 reply; 4+ messages in thread
From: Carsey, Jaben @ 2019-02-06 23:08 UTC (permalink / raw)
  To: 'Vladimir Olovyannikov', Laszlo Ersek,
	edk2-devel@lists.01.org

I sent this earlier, but failed the mailing list part.

Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
And pushed.

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Vladimir Olovyannikov via edk2-devel
> Sent: Tuesday, February 05, 2019 8:58 AM
> To: Laszlo Ersek <lersek@redhat.com>; edk2-devel@lists.01.org
> Cc: Gao, Liming <liming.gao@intel.com>
> Subject: Re: [edk2] [PATCH] BaseTools/BuildReport: fix report for
> platforms/arches without struct PCDs
> 
> Laszlo,
> Thanks a lot for the prompt fix. Works now.
> 
> Tested-by: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
> 
> -----Original Message-----
> From: Laszlo Ersek [mailto:lersek@redhat.com]
> Sent: Tuesday, February 5, 2019 3:22 AM
> To: edk2-devel@lists.01.org
> Cc: Bob Feng; Liming Gao; Vladimir Olovyannikov; Yonghong Zhu
> Subject: [PATCH] BaseTools/BuildReport: fix report for platforms/arches
> without struct PCDs
> 
> The goal of commit 97c8f5b9e7d3 ("BaseTools:StructurePCD value display
> incorrect in "Not used" section.", 2019-02-02) was to display the full
> contents of such structure PCDs in the build report that were set in the
> platform DSC or the FDF, but not used in any module INFs. The listings
> would appear in the
> 
>   PCDs not used by modules or in conditional directives
> 
> section of the build report.
> 
> Commit 97c8f5b9e7d3 assumed that any (platform, architecture)
> combination
> would have a (possibly empty) set of structure PCD (and so the set of the
> structure PCDs could be filtered for set-but-unused ones).
> 
> This is not the case: in "DscBuildData.py", in method
> UpdateStructuredPcds(), if "S_pcd_set" remains an empty OrderedDict(),
> then it is not added to "GlobalData.gStructurePcd" *at all*, for the
> current (platform, architecture) combination.
> 
> As a result, when the PCD report tries to fetch the set of structure PCDs
> for the current (platform, architecture), "GlobalData.gStructurePcd" does
> not return an empty OrderedDict(); instead, it raises a KeyError. Fix it
> by defaulting to an empty OrderedDict(), with the get() method.
> 
> Reported-by: Vladimir Olovyannikov
> <vladimir.olovyannikov@broadcom.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1513
> Fixes: 97c8f5b9e7d3136b6051a05cf056ce5ca9e79893
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
> Cc: Yonghong Zhu <yonghong.zhu@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
> 
> Notes:
>     Repo:   https://github.com/lersek/edk2.git
>     Branch: report_without_struct_pcds
> 
>  BaseTools/Source/Python/build/BuildReport.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Source/Python/build/BuildReport.py
> b/BaseTools/Source/Python/build/BuildReport.py
> index e457660fcef3..0b98d62cb6aa 100644
> --- a/BaseTools/Source/Python/build/BuildReport.py
> +++ b/BaseTools/Source/Python/build/BuildReport.py
> @@ -780,7 +780,7 @@ class PcdReport(object):
>              # Collect the PCD defined in DSC/FDF file, but not used in
> module
>              #
>              UnusedPcdFullList = []
> -            StructPcdDict = GlobalData.gStructurePcd[self.Arch]
> +            StructPcdDict = GlobalData.gStructurePcd.get(self.Arch,
> collections.OrderedDict())
>              for Name, Guid in StructPcdDict:
>                  if (Name, Guid) not in Pa.Platform.Pcds:
>                      Pcd = StructPcdDict[(Name, Guid)]
> --
> 2.19.1.3.g30247aa5d201
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: FW: [PATCH] BaseTools/BuildReport: fix report for platforms/arches without struct PCDs
  2019-02-06 23:08   ` FW: " Carsey, Jaben
@ 2019-02-07 13:27     ` Laszlo Ersek
  0 siblings, 0 replies; 4+ messages in thread
From: Laszlo Ersek @ 2019-02-07 13:27 UTC (permalink / raw)
  To: Carsey, Jaben, 'Vladimir Olovyannikov',
	edk2-devel@lists.01.org

On 02/07/19 00:08, Carsey, Jaben wrote:
> I sent this earlier, but failed the mailing list part.
> 
> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
> And pushed.

Thanks! This is commit 963517211cae1ad38984821061ad7982c448f934 now.

Laszlo


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-02-07 13:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-05 11:22 [PATCH] BaseTools/BuildReport: fix report for platforms/arches without struct PCDs Laszlo Ersek
2019-02-05 16:58 ` Vladimir Olovyannikov
2019-02-06 23:08   ` FW: " Carsey, Jaben
2019-02-07 13:27     ` Laszlo Ersek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox