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
@@ -5,6 +5,7 @@ type FileKind string

const (
FileKindWhiteout = FileKind("whiteout")
FileKindRPM = FileKind("rpm")
Copy link
Member

Choose a reason for hiding this comment

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

So every file's "kind" is effectively the component that noticed it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I suppose in theory any filescanner can create any FileKind and any Resolver can be interested in any FileType or perhaps multiple in the future, so the name is kind of arbitrary. Do you think the kind could be better named?

@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 54.31034% with 106 lines in your changes are missing coverage. Please review.

Project coverage is 56.33%. Comparing base (4c5aa9e) to head (d8445b3).
Report is 5 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 0.00% 3 Missing and 1 partial ⚠️
rpm/ecosystem.go 0.00% 3 Missing ⚠️
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   56.24%   56.33%   +0.08%     
==========================================
  Files         266      268       +2     
  Lines       16838    16939     +101     
==========================================
+ Hits         9471     9542      +71     
- Misses       6402     6421      +19     
- Partials      965      976      +11     

☔ 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
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 <joseph.crosland@gmail.com>
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 <joseph.crosland@gmail.com>
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 <joseph.crosland@gmail.com>
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.

None yet

2 participants