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

rpm: implement an RPM filescanner to discern RPM filepaths #1320

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

crozzy
Copy link
Contributor

@crozzy crozzy commented Apr 12, 2024

Using the filepaths discovered by the RPM filescanner we can judge whether or not a language package has been installed via RPM or not.

TODO:

@crozzy crozzy force-pushed the rpm-filescanner branch 2 times, most recently from 21db95f to f1bafd3 Compare April 12, 2024 18:21
file.go Show resolved Hide resolved
@crozzy crozzy force-pushed the rpm-filescanner branch 4 times, most recently from 6e33ee1 to 217186a Compare April 16, 2024 17:13
Copy link

codecov bot commented Apr 16, 2024

Codecov Report

Attention: Patch coverage is 53.24675% with 108 lines in your changes missing coverage. Please review.

Project coverage is 55.43%. Comparing base (a3c7415) to head (0eb95e5).
Report is 7 commits behind head on main.

Files Patch % Lines
rpm/native_db.go 44.44% 56 Missing and 24 partials ⚠️
rpm/filescanner.go 59.45% 9 Missing and 6 partials ⚠️
linux/coalescer.go 20.00% 3 Missing and 1 partial ⚠️
rpm/ecosystem.go 0.00% 3 Missing ⚠️
rhel/resolver.go 92.30% 1 Missing and 1 partial ⚠️
whiteout/coalescer.go 0.00% 2 Missing ⚠️
indexer/controller/coalesce.go 0.00% 1 Missing ⚠️
rpm/packagescanner.go 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1320      +/-   ##
==========================================
+ Coverage   55.25%   55.43%   +0.18%     
==========================================
  Files         278      284       +6     
  Lines       17199    17932     +733     
==========================================
+ Hits         9503     9941     +438     
- Misses       6738     6945     +207     
- Partials      958     1046      +88     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@crozzy crozzy force-pushed the rpm-filescanner branch 6 times, most recently from a248d33 to 9faca9c Compare April 18, 2024 19:11
@crozzy crozzy requested a review from hdonnay April 18, 2024 21:12
@crozzy
Copy link
Contributor Author

crozzy commented Apr 18, 2024

I think I'll probably add some more test cases to the resolver but it'd be good to get some eyes on again.

@crozzy crozzy force-pushed the rpm-filescanner branch 4 times, most recently from 66ca82d to 74673cc Compare May 22, 2024 21:04
@crozzy crozzy marked this pull request as ready for review May 22, 2024 22:36
@crozzy crozzy requested a review from a team as a code owner May 22, 2024 22:36
@crozzy crozzy force-pushed the rpm-filescanner branch from 74673cc to d8445b3 Compare May 30, 2024 20:14
rhel/resolver.go Outdated Show resolved Hide resolved
rhel/resolver.go Outdated Show resolved Hide resolved
@crozzy crozzy force-pushed the rpm-filescanner branch 2 times, most recently from cbfd810 to fbcd81a Compare June 13, 2024 22:36
@RTann RTann self-requested a review June 25, 2024 18:55
hdonnay
hdonnay previously approved these changes Jul 9, 2024
Copy link
Member

@hdonnay hdonnay left a comment

Choose a reason for hiding this comment

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

SGTM

rpm/native_db.go Outdated Show resolved Hide resolved
rpm/packagescanner.go Outdated Show resolved Hide resolved
rpm/native_db.go Show resolved Hide resolved
rpm/native_db.go Show resolved Hide resolved
rpm/filescanner.go Outdated Show resolved Hide resolved
linux/coalescer.go Show resolved Hide resolved
rhel/resolver.go Outdated Show resolved Hide resolved
rhel/resolver.go Outdated Show resolved Hide resolved
@crozzy crozzy force-pushed the rpm-filescanner branch 3 times, most recently from 4ba2ec7 to 41d429f Compare July 10, 2024 17:04
@crozzy crozzy requested review from hdonnay and RTann July 10, 2024 17:20
linux/coalescer.go Outdated Show resolved Hide resolved
linux/coalescer.go Outdated Show resolved Hide resolved
rpm/filescanner.go Show resolved Hide resolved
rhel/resolver.go Outdated Show resolved Hide resolved
@crozzy crozzy force-pushed the rpm-filescanner branch from 41d429f to 077a085 Compare July 11, 2024 22:12
@crozzy crozzy requested a review from RTann July 11, 2024 22:12
Copy link
Contributor

@RTann RTann left a comment

Choose a reason for hiding this comment

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

few tiny things and one potentially important thing. should be good to go after this

rpm/filescanner.go Outdated Show resolved Hide resolved
rpm/filescanner.go Show resolved Hide resolved
rpm/filescanner.go Show resolved Hide resolved
linux/coalescer.go Outdated Show resolved Hide resolved
rhel/resolver.go Outdated Show resolved Hide resolved
rhel/resolver.go Outdated Show resolved Hide resolved
rhel/resolver.go Outdated Show resolved Hide resolved
@crozzy crozzy force-pushed the rpm-filescanner branch from 077a085 to 3e068d3 Compare July 18, 2024 22:36
@crozzy crozzy requested a review from RTann July 18, 2024 22:37
RTann
RTann previously approved these changes Jul 19, 2024
Copy link
Contributor

@RTann RTann left a comment

Choose a reason for hiding this comment

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

Just one nit I noticed, otherwise LGTM

rhel/resolver.go Outdated Show resolved Hide resolved
@crozzy crozzy force-pushed the rpm-filescanner branch 3 times, most recently from a9aa141 to e357ba9 Compare July 22, 2024 19:41
@crozzy crozzy requested a review from RTann July 22, 2024 19:42
crozzy added 3 commits August 21, 2024 09:34
We should be accounting for more than one file per layer and therefore
this change (from map[layer_id]claircore.File to
map[layer_id][]claircore.File) is needed.

Signed-off-by: crozzy <[email protected]>
Using the filepaths discovered by the RPM filescanner we can judge
whether or not a language package has been installed via RPM or not.

Signed-off-by: crozzy <[email protected]>
The Resolver compares file paths gleaned from RPM DBs and compares them
to a Package.Filepath to try and determine if a package needs to be
removed from an index report because its RPM counterpart has already
been included.

Signed-off-by: crozzy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants