Yes this change is currently required to enable Policy 5 for a given package. I'm tempted to move this patch series to individual patch series so that I can merge individual changes as they are approved in a package.

We could try and set the dsc automatically as you suggested. It would be preferred to trying to get this patch series pushed through on almost all packages in edk2 :). However there are some issues I don't think we can easily work around:

1. There exist very few packages that only have one dsc in them (for various reasons, one of which is that most packages have a dsc for testing... but others such as the ArmVirtPkg have many in general)
2. The target of this Policy is to catch changes in an INF and build all packages that use the INF via the compiler plugin, however not all packages utilize the compiler plugin (such as EmulatorPkg). Using  EmulatorPkg  as an example, if Policy 5 catches that its dsc uses the changed INF, then CI will pointlessly run for  EmulatorPkg. It is pointless because  EmulatorPkg's dsc will not be compiled, so even if there is a break in the INF interface, it will not be caught for  EmulatorPkg, but all other CI will run on an unchanged package, wasting time.
3. It can cause unexpected behavior for the package developer

Let me know your thoughts!
Joey


On Mon, Jun 26, 2023 at 6:00 PM gaoliming <gaoliming@byosoft.com.cn> wrote:
Joey:
  So, this change is required for all package YAML. If yes, can PrEval be
auto set to the package dsc if only one DSC is in Package directory?

Thanks
Liming
> -----邮件原件-----
> 发件人: Joey Vagedes <joey.vagedes@gmail.com>
> 发送时间: 2023年6月27日 5:34
> 收件人: devel@edk2.groups.io
> 抄送: Abner Chang <abner.chang@amd.com>; Alexei Fedorov
> <Alexei.Fedorov@arm.com>; Ard Biesheuvel <ardb+tianocore@kernel.org>;
> Ashraf Ali S <ashraf.ali.s@intel.com>; Chasel Chiu
<chasel.chiu@intel.com>;
> Chen Gang C <gang.c.chen@intel.com>; Daniel Schaefer
> <git@danielschaefer.me>; Duggapu Chinni B <chinni.b.duggapu@intel.com>;
> Eric Dong <eric.dong@intel.com>; Gerd Hoffmann <kraxel@redhat.com>; Guo
> Dong <guo.dong@intel.com>; Guomin Jiang <guomin.jiang@intel.com>; Hao
> A Wu <hao.a.wu@intel.com>; Igor Kulchytskyy <igork@ami.com>; James Lu
> <james.lu@intel.com>; Jian J Wang <jian.j.wang@intel.com>; Jiewen Yao
> <jiewen.yao@intel.com>; Leif Lindholm <quic_llindhol@quicinc.com>; Liming
> Gao <gaoliming@byosoft.com.cn>; Maciej Rabeda
> <maciej.rabeda@linux.intel.com>; Michael D Kinney
> <michael.d.kinney@intel.com>; Michael Kubacki
> <mikuback@linux.microsoft.com>; Nate DeSimone
> <nathaniel.l.desimone@intel.com>; Nickle Wang <nicklew@nvidia.com>;
> Pierre Gondois <pierre.gondois@arm.com>; Rahul Kumar
> <rahul1.kumar@intel.com>; Ray Han Lim Ng <ray.han.lim.ng@intel.com>;
> Ray Ni <ray.ni@intel.com>; Sami Mujawar <sami.mujawar@arm.com>; Sean
> Brogan <sean.brogan@microsoft.com>; Sean Rhodes
> <sean@starlabs.systems>; Siyuan Fu <siyuan.fu@intel.com>; Star Zeng
> <star.zeng@intel.com>; Susovan Mohapatra
> <susovan.mohapatra@intel.com>; Ted Kuo <ted.kuo@intel.com>; Wei6 Xu
> <wei6.xu@intel.com>; Xiaoyu Lu <xiaoyu1.lu@intel.com>; Yi Li
> <yi1.li@intel.com>; Zhichao Gao <zhichao.gao@intel.com>; Zhiguang Liu
> <zhiguang.liu@intel.com>
> 主题: [PATCH v1 00/24] Update Edk2-pytools to latest versions
>
> Updates Edk2-pytools to the latest versions, which introduces a new Policy
> for detecting which packages must be built given a set of changes. This
policy
> is used when a library class instance INF is changed. When this occurs, it
will
> review the PrEval:DscPath provided in the CI YAML file and determine if
the
> package uses the library instance or not. If it does, it will build and
test
> the package.
>
> Due to these changes, each package must now include an entry in it's CI
> YAML
> file (PrEval:DscPath). If the package does not provide this entry, this
policy
> will be skipped, which could lead to a library instance breaking packages
> outside
> of it's parent package.
>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Ashraf Ali S <ashraf.ali.s@intel.com>
> Cc: Chasel Chiu <chasel.chiu@intel.com>
> Cc: Chen Gang C <gang.c.chen@intel.com>
> Cc: Daniel Schaefer <git@danielschaefer.me>
> Cc: Duggapu Chinni B <chinni.b.duggapu@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Guo Dong <guo.dong@intel.com>
> Cc: Guomin Jiang <guomin.jiang@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Igor Kulchytskyy <igork@ami.com>
> Cc: James Lu <james.lu@intel.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Leif Lindholm <quic_llindhol@quicinc.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Michael Kubacki <mikuback@linux.microsoft.com>
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> Cc: Nickle Wang <nicklew@nvidia.com>
> Cc: Pierre Gondois <pierre.gondois@arm.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> Cc: Ray Han Lim Ng <ray.han.lim.ng@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Sami Mujawar <sami.mujawar@arm.com>
> Cc: Sean Brogan <sean.brogan@microsoft.com>
> Cc: Sean Rhodes <sean@starlabs.systems>
> Cc: Siyuan Fu <siyuan.fu@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Cc: Susovan Mohapatra <susovan.mohapatra@intel.com>
> Cc: Ted Kuo <ted.kuo@intel.com>
> Cc: Wei6 Xu <wei6.xu@intel.com>
> Cc: Xiaoyu Lu <xiaoyu1.lu@intel.com>
> Cc: Yi Li <yi1.li@intel.com>
> Cc: Zhichao Gao <zhichao.gao@intel.com>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
>
> Joey Vagedes (24):
>   Edk2: edk2-pytools: Update to latest versions
>   UnitTestFrameworkPkg: CI: Add PrEval entry
>   UefiPayloadPkg: CI: Add PrEval entry
>   ArmPkg: CI: Add PrEval entry
>   UefiCpuPkg: CI: Add PrEval entry
>   ArmPlatformPkg: CI: Add PrEval entry
>   CryptoPkg: CI: Add PrEval entry
>   DynamicTablesPkg: CI: Add PrEval entry
>   EmbeddedPkg: CI: Add PrEval entry
>   FatPkg: CI: Add PrEval entry
>   FmpDevicePkg: CI: Add PrEval entry
>   IntelFsp2Pkg: CI: Add PrEval entry
>   CryptoPkg: CI: Add PrEval entry
>   SourceLevelDebugPkg: CI: Add PrEval entry
>   SignedCapsulePkg: CI: Add PrEval entry
>   ShellPkg: CI: Add PrEval entry
>   SecurityPkg: CI: Add PrEval entry
>   RedfishPkg: CI: Add PrEval entry
>   PrmPkg: CI: Add PrEval entry
>   PcAtChipsetPkg: CI: Add PrEval entry
>   NetworkPkg: CI: Add PrEval entry
>   MdePkg: CI: Add PrEval entry
>   MdeModulePkg: CI: Add PrEval entry
>   IntelFsp2WrapperPkg: CI: Add PrEval entry
>
>  ArmPkg/ArmPkg.ci.yaml                             | 3 +++
>  ArmPlatformPkg/ArmPlatformPkg.ci.yaml             | 3 +++
>  CryptoPkg/CryptoPkg.ci.yaml                       | 3 +++
>  DynamicTablesPkg/DynamicTablesPkg.ci.yaml         | 3 +++
>  EmbeddedPkg/EmbeddedPkg.ci.yaml                   | 3 +++
>  FatPkg/FatPkg.ci.yaml                             | 3 +++
>  FmpDevicePkg/FmpDevicePkg.ci.yaml                 | 3 +++
>  IntelFsp2Pkg/IntelFsp2Pkg.ci.yaml                 | 3 +++
>  IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.ci.yaml   | 3 +++
>  MdeModulePkg/MdeModulePkg.ci.yaml                 | 3 +++
>  MdePkg/MdePkg.ci.yaml                             | 3 +++
>  NetworkPkg/NetworkPkg.ci.yaml                     | 3 +++
>  PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml             | 3 +++
>  PrmPkg/PrmPkg.ci.yaml                             | 3 +++
>  RedfishPkg/RedfishPkg.ci.yaml                     | 3 +++
>  SecurityPkg/SecurityPkg.ci.yaml                   | 3 +++
>  ShellPkg/ShellPkg.ci.yaml                         | 3 +++
>  SignedCapsulePkg/SignedCapsulePkg.ci.yaml         | 3 +++
>  SourceLevelDebugPkg/SourceLevelDebugPkg.ci.yaml   | 3 +++
>  StandaloneMmPkg/StandaloneMmPkg.ci.yaml           | 3 +++
>  UefiCpuPkg/UefiCpuPkg.ci.yaml                     | 3 +++
>  UefiPayloadPkg/UefiPayloadPkg.ci.yaml             | 3 +++
>  UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml | 3 +++
>  pip-requirements.txt                              | 4 ++--
>  24 files changed, 71 insertions(+), 2 deletions(-)
>
> --
> 2.41.0.windows.1