Skip to content

Commit

Permalink
feat: split apk out of alpine
Browse files Browse the repository at this point in the history
Refs: #923
Signed-off-by: Johan Bergström <[email protected]>
  • Loading branch information
jbergstroem committed Sep 24, 2023
1 parent c5ea100 commit 5afebb5
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

Check warning on line 15 in alpine/ecosystem.go

View check run for this annotation

Codecov / codecov/patch

alpine/ecosystem.go#L15

Added line #L15 was not covered by tests
},
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 }

Check warning on line 34 in apk/scanner.go

View check run for this annotation

Codecov / codecov/patch

apk/scanner.go#L34

Added line #L34 was not covered by tests

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

Check warning on line 37 in apk/scanner.go

View check run for this annotation

Codecov / codecov/patch

apk/scanner.go#L37

Added line #L37 was not covered by tests

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

Check warning on line 40 in apk/scanner.go

View check run for this annotation

Codecov / codecov/patch

apk/scanner.go#L40

Added line #L40 was not covered by tests

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 5afebb5

Please sign in to comment.