Skip to content

Commit

Permalink
feat: split apk out of alpine
Browse files Browse the repository at this point in the history
Refs: quay#923
  • Loading branch information
jbergstroem committed Sep 24, 2023
1 parent c5ea100 commit 9d9a425
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
3 changes: 2 additions & 1 deletion alpine/ecosystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package alpine
import (
"context"

"github.com/quay/claircore/apk"
"github.com/quay/claircore/indexer"
"github.com/quay/claircore/linux"
)
Expand All @@ -11,7 +12,7 @@ import (
func NewEcosystem(ctx context.Context) *indexer.Ecosystem {
return &indexer.Ecosystem{
PackageScanners: func(ctx context.Context) ([]indexer.PackageScanner, error) {
return []indexer.PackageScanner{&Scanner{}}, nil
return []indexer.PackageScanner{&apk.Scanner{}}, nil
},
DistributionScanners: func(ctx context.Context) ([]indexer.DistributionScanner, error) {
return []indexer.DistributionScanner{&DistributionScanner{}}, nil
Expand Down
18 changes: 9 additions & 9 deletions alpine/packagescanner.go → apk/scanner.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package alpine
package apk

import (
"bytes"
Expand All @@ -15,9 +15,9 @@ import (
)

const (
pkgName = `apk`
pkgVersion = `v0.0.1`
pkgKind = `package`
name = "apk"
version = "v0.0.1"
kind = "package"
)

var (
Expand All @@ -31,13 +31,13 @@ var (
type Scanner struct{}

// Name implements indexer.VersionedScanner.
func (*Scanner) Name() string { return pkgName }
func (*Scanner) Name() string { return name }

// Version implements indexer.VersionedScanner.
func (*Scanner) Version() string { return pkgVersion }
func (*Scanner) Version() string { return version }

// Kind implements indexer.VersionedScanner.
func (*Scanner) Kind() string { return pkgKind }
func (*Scanner) Kind() string { return kind }

const installedFile = "lib/apk/db/installed"

Expand All @@ -52,8 +52,8 @@ func (*Scanner) Scan(ctx context.Context, layer *claircore.Layer) ([]*claircore.
defer trace.StartRegion(ctx, "Scanner.Scan").End()
trace.Log(ctx, "layer", layer.Hash.String())
ctx = zlog.ContextWithValues(ctx,
"component", "alpine/Scanner.Scan",
"version", pkgVersion,
"component", "apk/Scanner.Scan",
"version", version,
"layer", layer.Hash.String())

zlog.Debug(ctx).Msg("start")
Expand Down
2 changes: 1 addition & 1 deletion alpine/packagescanner_test.go → apk/scanner_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package alpine
package apk

import (
"context"
Expand Down

0 comments on commit 9d9a425

Please sign in to comment.