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

path_utilities: Adjust GetContainingPackage() and Edk2Path behavior #186

Merged
merged 8 commits into from Nov 9, 2022

Commits on Nov 9, 2022

  1. path_utilities: Adjust GetContainingPackage() and Edk2Path behavior

    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>
    makubacki committed Nov 9, 2022
    Configuration menu
    Copy the full SHA
    f24102e View commit details
    Browse the repository at this point in the history
  2. PR Update: Add back PR tianocore#113 support

    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>
    makubacki committed Nov 9, 2022
    Configuration menu
    Copy the full SHA
    a98108b View commit details
    Browse the repository at this point in the history
  3. PR Update: Instantiate Edk2Path object in test case

    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.
    makubacki committed Nov 9, 2022
    Configuration menu
    Copy the full SHA
    1ec4d03 View commit details
    Browse the repository at this point in the history
  4. PR Update: Add a nested package test case

    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>
    makubacki committed Nov 9, 2022
    Configuration menu
    Copy the full SHA
    a11f8ee View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    f880856 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    86da9dd View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    e4e18c7 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    4d3bc4d View commit details
    Browse the repository at this point in the history