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

Refactor build directory purging logic #194

Merged
merged 1 commit into from
Feb 13, 2024

Conversation

IvoBrandao
Copy link
Contributor

Related Issue(s) 2463
Has Unit Tests (y/n) n
Documentation Included (y/n) n

Change Description

This commit refactors the logic for purging the build directory in the run_fbuild_cli function. It now uses a try-except block to handle PermissionError exceptions when attempting to purge the build directory.

Rationale

Fixes Bug

Testing/Review Recommendations

For the testing I did a manual test, the procedure I followed was the following one:

  1. Execute `fprime-util generate
  2. Execute fprime-util build
  3. Change a file to immutable e.g sudo chattr +i build-fprime-automatic-native/lib/Linux/libFw_Buffer.a
  4. Execute fprime-util purge
  5. The output shows which file cannot be removed as shown below.
[INFO] Purge build directory at: <path>/fprime/testv1/build-fprime-automatic-native
Purge this directory? (yes/no) [yes]: yes
Error: Permission denied while purging <path>/fprime/testprj/build-fprime-automatic-native: [Errno 1] Operation not permitted: 'libFw_Buffer.a'

Future Work

Maybe unit tests, if necessary...

@thomas-bc thomas-bc self-requested a review February 12, 2024 18:12
Copy link
Contributor

@thomas-bc thomas-bc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thank you for working on this! 🚀

@thomas-bc thomas-bc merged commit d76b216 into nasa:devel Feb 13, 2024
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants