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

brp-remove-la-files: Remove symlinks, too #3311

Merged
merged 1 commit into from
Sep 19, 2024

Conversation

ffesti
Copy link
Contributor

@ffesti ffesti commented Sep 17, 2024

As we check for file contents delete symlink before looking at regular files.

Resolves: #3304

@pmatilai
Copy link
Member

A test? You don't need to create a project with .la files in it and spec and all, just write a bunch of files to a directory and run the script on that.

I'd place the invocations in a for loop over the file type - otherwise it takes some squinting to see that it's all identical except for l/f passed to -type.

As we check for file contents delete symlink before looking at regular
files.

Resolves: rpm-software-management#3304
@ffesti
Copy link
Contributor Author

ffesti commented Sep 18, 2024

Loop and test case added.

@fundawang
Copy link

what if just

find "$RPM_BUILD_ROOT" -type f,l -name '*.la'

@pmatilai
Copy link
Member

find "$RPM_BUILD_ROOT" -type f,l -name '*.la'

That's pretty much how this script started its life as, but it was discovered to remove non-libtool files too, see 432a911

Unfortunately we didn't demand test-cases for that stuff back then.

@pmatilai pmatilai merged commit 5154a58 into rpm-software-management:master Sep 19, 2024
1 check passed
@fundawang
Copy link

fundawang commented Sep 19, 2024

find "$RPM_BUILD_ROOT" -type f,l -name '*.la'

That's pretty much how this script started its life as, but it was discovered to remove non-libtool files too, see 432a911

Unfortunately we didn't demand test-cases for that stuff back then.

I mean can throw loop away:

find "$RPM_BUILD_ROOT" -type f,l -name '*.la' 2>/dev/null -print0 |
  xargs -0 grep --fixed-strings '.la - a libtool library file' --files-with-matches --null |
  xargs -0 rm --force

this is the same as current loop, but better to read. please note that -type f,l accepts more than one file type:
https://www.gnu.org/software/findutils/manual/html_node/find_html/Type.html

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.

brp-remove-la-files won't remove symlink files
3 participants