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
path_utilities: Adjust GetContainingPackage() and Edk2Path behavior #186
Conversation
Updates `get_packages_to_build()` to return all possible packages if a file is modified outside a package. Originally, this was implemented behind a new argument with the default behavior unchanged. However, feedback indicated it would be easier to adopt without an argument and this would be acceptable behavior. This does mean some files, such as documentation files, could trigger packages to build that would have not previously built. However, the impact and frequency of this is considered minimal enough to not justify additional complexity. The change mainly focuses on files such as dependency trackers (e.g. PIP requirements, submodules), Python scripts, and other files that can impact overall build results. Requires tianocore/edk2-pytool-library#186. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Codecov ReportBase: 78.25% // Head: 78.31% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #186 +/- ##
==========================================
+ Coverage 78.25% 78.31% +0.05%
==========================================
Files 91 91
Lines 10059 10067 +8
==========================================
+ Hits 7872 7884 +12
+ Misses 2187 2183 -4
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Note: PR gates are failing due to pydocstyle in edk2-pytool-extensions (#187), unrelated to this change. |
@Javagedes and @spbrogan, are you waiting on something else to approve this one? |
@makubacki I was waiting to get my pydocstyle PR in. I've Approved, but there are comment conflicts due to my PR. Once the PR is passing the PR gates I'll merge. |
I'm also going to do a quick run of the integration checks just to make sure the change to GetContainingPackage() to return None instead of ws didn't break anything. |
@makubacki Integration tests passed; I'm ready to merge once the conflicts have been handled. |
Fixes tianocore#183, fixes tianocore#185 Updates the Edk2Path constructor with the following changes: - Avoid changing global object state during intermediary validation operations. If an exception were returned or execution is otherwise interrupted the `PackagePathList` and `WorkspacePath` will have predictable values only set once validation succeeds. - Raise a `NotADirectoryError` exception on invalid directory input. This allows the caller to implement more focused exception handling. - Update the definition of a package to be a directory with a .dec file and use that as the basis for detecting nested packages. - Update the nested package path algorithm to fix tianocore#183 and prevent exceeding ascension in the directory hierarchy beyond the maximum root directory being compared. - Minor documentation cleanup. Update GetContainingPackage() with the following changes: - Only return a containing package if a file is in a directory with a .dec file. Avoid returning directory parents outside edk2 packages. Closes tianocore#185. - Minor documentation cleanup. Updates both functions to remove superfluous logging and leave it to the caller to manage logging messages based on the context of the actions they are trying to perform. Updates unit tests to align with updated function expectations. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Allows callers to pass package paths that may not be valid directories and control whether an exception is raised with the error_on_invalid_pp Edk2Path constructor parameter. Restores behavior introduced in tianocore#113 Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Updates test_get_relative_path_when_package_path_inside_package() to instantiate an Edk2Path object to ensure it can initialize properly by not raising an exception and be used to get the relative path of a file in the workspace.
Adds a test case to verify nested packages raise an exception. This provides full test coverage of the checks in the Edk2Path constructor. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
be6ddc5
to
e4e18c7
Compare
Conflict update pushed |
Updates `get_packages_to_build()` to return all possible packages if a file is modified outside a package. Originally, this was implemented behind a new argument with the default behavior unchanged. However, feedback indicated it would be easier to adopt without an argument and this would be acceptable behavior. This does mean some files, such as documentation files, could trigger packages to build that would have not previously built. However, the impact and frequency of this is considered minimal enough to not justify additional complexity. The change mainly focuses on files such as dependency trackers (e.g. PIP requirements, submodules), Python scripts, and other files that can impact overall build results. Requires tianocore/edk2-pytool-library#186. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Updates `get_packages_to_build()` to return all possible packages if a file is modified outside a package. Originally, this was implemented behind a new argument with the default behavior unchanged. However, feedback indicated it would be easier to adopt without an argument and this would be acceptable behavior. This does mean some files, such as documentation files, could trigger packages to build that would have not previously built. However, the impact and frequency of this is considered minimal enough to not justify additional complexity. The change mainly focuses on files such as dependency trackers (e.g. PIP requirements, submodules), Python scripts, and other files that can impact overall build results. Requires tianocore/edk2-pytool-library#186. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Updates `get_packages_to_build()` to return all possible packages if a file is modified outside a package. Originally, this was implemented behind a new argument with the default behavior unchanged. However, feedback indicated it would be easier to adopt without an argument and this would be acceptable behavior. This does mean some files, such as documentation files, could trigger packages to build that would have not previously built. However, the impact and frequency of this is considered minimal enough to not justify additional complexity. The change mainly focuses on files such as dependency trackers (e.g. PIP requirements, submodules), Python scripts, and other files that can impact overall build results. Requires tianocore/edk2-pytool-library#186. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Updates `get_packages_to_build()` to return all possible packages if a file is modified outside a package. Originally, this was implemented behind a new argument with the default behavior unchanged. However, feedback indicated it would be easier to adopt without an argument and this would be acceptable behavior. This does mean some files, such as documentation files, could trigger packages to build that would have not previously built. However, the impact and frequency of this is considered minimal enough to not justify additional complexity. The change mainly focuses on files such as dependency trackers (e.g. PIP requirements, submodules), Python scripts, and other files that can impact overall build results. Requires tianocore/edk2-pytool-library#186. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Updates `get_packages_to_build()` to return all possible packages if a file is modified outside a package. Originally, this was implemented behind a new argument with the default behavior unchanged. However, feedback indicated it would be easier to adopt without an argument and this would be acceptable behavior. This does mean some files, such as documentation files, could trigger packages to build that would have not previously built. However, the impact and frequency of this is considered minimal enough to not justify additional complexity. The change mainly focuses on files such as dependency trackers (e.g. PIP requirements, submodules), Python scripts, and other files that can impact overall build results. Requires tianocore/edk2-pytool-library#186. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
path_utilities: Adjust GetContainingPackage() and Edk2Path behavior
Fixes #183, fixes #185
Updates the Edk2Path constructor with the following changes:
operations. If an exception were returned or execution is otherwise
interrupted the
PackagePathList
andWorkspacePath
will havepredictable values only set once validation succeeds.
NotADirectoryError
exception on invalid directory input.This allows the caller to implement more focused exception handling.
and use that as the basis for detecting nested packages.
exceeding ascension in the directory hierarchy beyond the maximum
root directory being compared.
Update GetContainingPackage() with the following changes:
a .dec file. Avoid returning directory parents outside edk2
packages. Closes [Bug]: Simplify GetContainingPkg() #185.
Updates both functions to remove superfluous logging and leave it to
the caller to manage logging messages based on the context of the
actions they are trying to perform.
Updates unit tests to align with updated function expectations.
Signed-off-by: Michael Kubacki michael.kubacki@microsoft.com