Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REBASE&FF] Multiple table / parser updates #423

Merged
merged 6 commits into from
Nov 1, 2023

Conversation

Javagedes
Copy link
Contributor

@Javagedes Javagedes commented Oct 3, 2023

Contains multiple commits to improve instanced_table, instanced_inf_table, and dsc_parser.

Commit 1: inf_table.py: resolve dot-dot paths in source files

Updates inf_table.py to resolve dot-dot paths in source files before inserting it into the database to ensure the path is a valid edk2 package path relative path. Source files in the database are now edk2 package relative rather than inf relative.

Commit 2: instanced_inf_table.py: Filter on TARGET_ARCH

The dsc_parser is architecture agnostic and resolves the dsc file for all architectures it supports. This means the instanced_inf_table must filter the results to only the architectures specified by the Settings file.

Commit 3: dsc_parser.py: use SUPPORTED_ARCHITECTURES

The dsc_parser relied on TARGET_ARCH when creating scoped libraries and components, but it should rely on SUPPORTED_ARCHITECTURES which provides information true to the DSC.

Commit 4: inf parsing: Add support for scoped source files

Adds additional parsing to the inf_parser to support scoped source files
which can be retrieved via the function get_sources(arch_list), which
will return all sources used for a given arch(s). Re-writes the logic
that does the same for scoped libraries to make it more extensible, but
no user facing changes.

Updates instanced_inf_table to use the new function to get the sources.

Commit 5: inf_parser: Add ReplaceVariable support

Previously, the INF parser did not support detecting DEFINE variables or
replacing $(variable) with the value of the variable, similar to other
parsers. This change adds support for this feature, and assocaited tests
to ensure it works as expected.

@Javagedes Javagedes force-pushed the parser-updates branch 2 times, most recently from ff4f297 to 95c44ae Compare October 3, 2023 17:19
@codecov
Copy link

codecov bot commented Oct 3, 2023

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (53ad955) 80.99% compared to head (d17af12) 81.13%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #423      +/-   ##
==========================================
+ Coverage   80.99%   81.13%   +0.14%     
==========================================
  Files          57       57              
  Lines        7286     7338      +52     
==========================================
+ Hits         5901     5954      +53     
+ Misses       1385     1384       -1     
Files Coverage Δ
edk2toollib/uefi/edk2/parsers/dsc_parser.py 89.32% <100.00%> (-0.04%) ⬇️
edk2toollib/uefi/edk2/parsers/inf_parser.py 95.00% <100.00%> (+4.39%) ⬆️
edk2toollib/database/tables/inf_table.py 98.38% <90.00%> (-1.62%) ⬇️
edk2toollib/database/tables/instanced_inf_table.py 98.06% <92.85%> (-0.54%) ⬇️
edk2toollib/database/tables/package_table.py 87.09% <50.00%> (-5.50%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Javagedes Javagedes self-assigned this Oct 5, 2023
@Javagedes Javagedes added the enhancement New feature or request label Oct 5, 2023
@Javagedes Javagedes added this to the 0.18.3 milestone Oct 5, 2023
@Javagedes Javagedes modified the milestones: 0.19.1, 0.19.2, 0.19.3 Oct 23, 2023
@Javagedes Javagedes modified the milestones: 0.19.3, 0.19.4 Oct 26, 2023
@Javagedes Javagedes force-pushed the parser-updates branch 4 times, most recently from e799eda to 2cf5b37 Compare November 1, 2023 23:33
Resolves paths containing ".." in source files before inserting into the
database to get the correct relative path from a package (or ws root).
The dsc_parser does not filter on arch, so we need to do it in the
instanced_inf_table to ensure we are not filling the instanced_inf table
with architecture entries that are not relevant to the current build.
to properly scope components to a specific architecture when they fell
under a common section, the parser relied on TARGET_ARCH being provided
as a InputVar via SetInputVars().  This came with two problems: (1) It
was not garunteed that TARGET_ARCH would be provided, which would result
in the component registered for any scope and (2) it limited the results
to particular architecture rather than the actual supported
architecture per the DSC.

This commit changes the parser to use the SUPPORTED_ARCHITECTURES define
as set in the DSC itself, which is a required DEFINE per the DSC
specification.
Adds additional parsing to the inf_parser to support scoped source files
which can be retrieved via the function get_sources(arch_list), which
will return all sources used for a given arch(s). Re-writes the logic
that does the same for scoped libraries to make it more extensible, but
no user facing changes.

Updates instanced_inf_table to use the new function to get the sources.
Previously, the INF parser did not support detecting DEFINE variables or
replacing $(variable) with the value of the variable, similar to other
parsers. This change adds support for this feature, and assocaited tests
to ensure it works as expected.
Attempts to retrive the repository name from the url associated with
either the origin or the first remote if the origin does not exist. If
that fails, it will continue to resort to BASE.
@Javagedes Javagedes merged commit 8f21464 into tianocore:master Nov 1, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants