Fix greedy regex in BR removal, alignment detection, and subdirectory license matching#14
Open
Shrey-N wants to merge 7 commits intohroncok:mainfrom
Open
Fix greedy regex in BR removal, alignment detection, and subdirectory license matching#14Shrey-N wants to merge 7 commits intohroncok:mainfrom
Shrey-N wants to merge 7 commits intohroncok:mainfrom
Conversation
Owner
|
I'm not sure about the lice se fix. That would only work if the macros are called from within a subdirectory. Can we detect that? |
Contributor
Author
|
Point we can detect that by scanning the |
Contributor
Author
|
I updated license detection to be context aware by scanning for Also now includes fixes for:
|
Refactor macro handling by introducing _find_macro_end function to improve readability and maintainability.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR addresses edge case bugs discovered:
Fix greedy regex in
remove_setuptools_br:richregex\({setuptools}\s+.+\)was too greedy. It could swallow subsequent parenthesis blocks, unintentionally deleting other dependencies on the sameBuildRequiresline..+with[^)]+to ensure the match stops at the very next closing parenthesis.Fix empty tag handling in
alignment_of:tag_reregex required a non space character (\S) at the end of the line.alignment_offailed on tags with trailing spaces but no value (e.g.,Name: \n), causing messy specfile formatting during substitutions like%py_provides.\Srequirement, allowing the alignment logic to capture spacing for empty tags.Improve
%licensedetection for files in subdirectories (add_pyproject_files):fnmatchlogic originally matched against the entiretokenpath. If an RPM utilized something like%license XwhyZ-3.2.1/LICENSE, it would fail the glob match againstLICEN[CS]E*and wouldn't append the-lflag to%pyproject_save_files.token.split("/")[-1](the basename of the file), correctly identifying licenses inside standard subdirectories.