Skip to content

Commit c42fd5b

Browse files
committed
postgres: add handling for Package changes
Signed-off-by: Hank Donnay <hdonnay@redhat.com> Change-Id: I4e247878b27dc39096aa9379f33c3ed16a6a6964
1 parent bc6ebd9 commit c42fd5b

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

datastore/postgres/querybuilder.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111

1212
"github.com/quay/claircore"
1313
"github.com/quay/claircore/datastore"
14+
"github.com/quay/claircore/internal/wart"
1415
"github.com/quay/claircore/libvuln/driver"
1516
)
1617

@@ -26,15 +27,15 @@ func buildGetQuery(record *claircore.IndexRecord, opts *datastore.GetOpts) (stri
2627
}
2728
packageQuery := goqu.And(
2829
goqu.Ex{"package_name": record.Package.Name},
29-
goqu.Ex{"package_kind": record.Package.Kind},
30+
goqu.Ex{"package_kind": wart.StringFromPackageKind(record.Package.Kind)},
3031
)
3132
exps = append(exps, packageQuery)
3233

3334
// If the package has a source, convert the first expression to an OR.
3435
if record.Package.Source.Name != "" {
3536
sourcePackageQuery := goqu.And(
3637
goqu.Ex{"package_name": record.Package.Source.Name},
37-
goqu.Ex{"package_kind": record.Package.Source.Kind},
38+
goqu.Ex{"package_kind": wart.StringFromPackageKind(record.Package.Source.Kind)},
3839
)
3940
or := goqu.Or(
4041
packageQuery,

datastore/postgres/updatevulnerabilities.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717

1818
"github.com/quay/claircore"
1919
"github.com/quay/claircore/datastore"
20+
"github.com/quay/claircore/internal/wart"
2021
"github.com/quay/claircore/libvuln/driver"
2122
)
2223

@@ -329,7 +330,7 @@ func md5Vuln(v *claircore.Vulnerability) (string, []byte) {
329330
b.WriteString(v.Package.Version)
330331
b.WriteString(v.Package.Module)
331332
b.WriteString(v.Package.Arch)
332-
b.WriteString(v.Package.Kind)
333+
b.WriteString(wart.StringFromPackageKind(v.Package.Kind))
333334
}
334335
if v.Dist != nil {
335336
b.WriteString(v.Dist.DID)

0 commit comments

Comments
 (0)