-
Notifications
You must be signed in to change notification settings - Fork 86
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: consult dnf database for repository information #869
base: main
Are you sure you want to change the base?
Conversation
5acce04
to
5a9d76e
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #869 +/- ##
==========================================
- Coverage 55.39% 55.23% -0.17%
==========================================
Files 282 283 +1
Lines 17836 17923 +87
==========================================
+ Hits 9881 9899 +18
- Misses 6923 6990 +67
- Partials 1032 1034 +2 ☔ View full report in Codecov by Sentry. |
rpm/dnf.go
Outdated
if fi, err := fs.Stat(sys, `root/buildinfo/content_manifests`); errors.Is(err, nil) && fi.IsDir() { | ||
// This is a RHEL layer, skip. | ||
return nil, nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Update this to check the files for a marker value and continue if found.
Should look for from_dnf_hint
key in the yaml files.
See also: containerbuildsystem/atomic-reactor#2140
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Punting on this unless we determine it's needed.
I created rpm-software-management/rpm#3505 related to this |
10b07ff
to
e59f165
Compare
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
Using these should give us a nice "todo" list when the time comes. Signed-off-by: Hank Donnay <hdonnay@redhat.com>
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
This adds two helpers: one to discover repoids, and one to annotate a stream of Packages. Signed-off-by: Hank Donnay <hdonnay@redhat.com>
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
made it through most of the files, but I'll need to come back to this another time. Would you mind making more commits and then squashing things at the end so it's easier to see the diffs after each round? Thanks
// outside of the Red Hat build system's builder's context. See [CLAIRDEV-45] | ||
// for more information. | ||
// | ||
// [CLAIRDEV-45]: https://issues.redhat.com/browse/CLAIRDEV-45 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ticket specifically calls out OSBS. What about Konflux? Should we update the ticket to mention Konflux, or is this not true for Konflux?
"github.com/quay/claircore/internal/rpm" | ||
"github.com/quay/zlog" | ||
_ "modernc.org/sqlite" // register the sqlite driver |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just sanity checking here
"github.com/quay/claircore/internal/rpm"
is in the same module, so I expected to see this in the last block
Wrap(context.Context, iter.Seq[claircore.Package]) (iter.Seq[claircore.Package], func() error) | ||
} | ||
|
||
// Identity is an [Annotator] who's [Annotator.Wrap] method does nothing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: whose
var Identity Annotator | ||
|
||
func init() { | ||
Identity = ident{} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curious why not just var Identity = ident{}
?
return nil | ||
} | ||
|
||
// NewAnnotator holds book-keeping for producing multiple independent mapping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where the convention of doing something like NewAnnotator
instead of newAnnotator
for the godoc confuses me because now we have two of these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, but I don't know the tables well enough to verify this is definitely the right query
continue | ||
default: | ||
final = fmt.Errorf("internal/dnf: database error: %w", err) | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still getting used to iterators in Go. It's ok to have a path where we don't yield?
switch n { | ||
case `Packages`: | ||
db.kind = kindBDB | ||
if ok, err := testpath(p, bdb.CheckMagic); !ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
confirming we want to ignore true, err != nil
?
blobs, dbErr := db.All(ctx) | ||
seq, parseErr := parseBlob(ctx, blobs) | ||
defer func() { | ||
final = errors.Join(err, parseErr(), dbErr(), db.Close()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just confirming we want to close the DB here?
// | ||
// [yara]: https://github.com/VirusTotal/yara | ||
pat := []string{ | ||
`^.*/[^/]+\.jar$`, // Jar files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is copied over, but I'm wondering if we should extend this to the other file extensions we support like WAR, EAR, etc?
These changes make the
rhel
machinery consult both therpm
anddnf
databases when possible.See-also: #809