Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@dakaneye
Copy link
Contributor

Fixes #429

Signed-off-by: Samuel Dacanay [email protected]

@dakaneye dakaneye force-pushed the issue-429-centos-distro branch from 6ab349d to 60b89d6 Compare August 22, 2021 10:54
@github-actions
Copy link

github-actions bot commented Aug 22, 2021

Benchmark Test Results

Benchmark results from the latest changes vs base branch
name                                                   old time/op    new time/op    delta
ImagePackageCatalogers/ruby-gemspec-cataloger-2           834µs ± 1%     818µs ± 1%  -1.94%  (p=0.016 n=5+5)
ImagePackageCatalogers/python-package-cataloger-2        1.33ms ±31%    1.29ms ±23%    ~     (p=0.421 n=5+5)
ImagePackageCatalogers/javascript-package-cataloger-2     399µs ± 1%     385µs ± 1%  -3.47%  (p=0.008 n=5+5)
ImagePackageCatalogers/dpkgdb-cataloger-2                 388µs ± 2%     374µs ± 1%  -3.60%  (p=0.008 n=5+5)
ImagePackageCatalogers/rpmdb-cataloger-2                  398µs ± 2%     395µs ± 2%    ~     (p=0.421 n=5+5)
ImagePackageCatalogers/java-cataloger-2                  5.84ms ± 1%    5.68ms ± 2%  -2.77%  (p=0.016 n=5+5)
ImagePackageCatalogers/apkdb-cataloger-2                  590µs ± 0%     606µs ± 1%  +2.58%  (p=0.016 n=4+5)
ImagePackageCatalogers/go-cataloger-2                     209µs ± 1%     203µs ± 1%  -3.22%  (p=0.008 n=5+5)
ImagePackageCatalogers/rust-cataloger-2                   331µs ± 1%     326µs ± 1%  -1.45%  (p=0.032 n=5+5)

name                                                   old alloc/op   new alloc/op   delta
ImagePackageCatalogers/ruby-gemspec-cataloger-2           138kB ± 0%     138kB ± 0%    ~     (p=0.286 n=5+5)
ImagePackageCatalogers/python-package-cataloger-2         649kB ± 0%     649kB ± 0%    ~     (p=1.000 n=5+5)
ImagePackageCatalogers/javascript-package-cataloger-2     113kB ± 0%     113kB ± 0%  -0.07%  (p=0.032 n=5+5)
ImagePackageCatalogers/dpkgdb-cataloger-2                 126kB ± 0%     126kB ± 0%    ~     (p=0.190 n=5+4)
ImagePackageCatalogers/rpmdb-cataloger-2                  138kB ± 0%     138kB ± 0%  +0.00%  (p=0.016 n=5+4)
ImagePackageCatalogers/java-cataloger-2                  1.99MB ± 0%    1.99MB ± 0%    ~     (p=0.841 n=5+5)
ImagePackageCatalogers/apkdb-cataloger-2                 1.16MB ± 0%    1.16MB ± 0%  +0.00%  (p=0.032 n=5+5)
ImagePackageCatalogers/go-cataloger-2                    55.5kB ± 0%    55.5kB ± 0%    ~     (p=0.206 n=5+5)
ImagePackageCatalogers/rust-cataloger-2                   109kB ± 0%     109kB ± 0%  -0.01%  (p=0.008 n=5+5)

name                                                   old allocs/op  new allocs/op  delta
ImagePackageCatalogers/ruby-gemspec-cataloger-2           2.12k ± 0%     2.12k ± 0%    ~     (all equal)
ImagePackageCatalogers/python-package-cataloger-2         6.45k ± 0%     6.45k ± 0%    ~     (p=0.968 n=5+4)
ImagePackageCatalogers/javascript-package-cataloger-2     1.92k ± 0%     1.92k ± 0%    ~     (all equal)
ImagePackageCatalogers/dpkgdb-cataloger-2                 2.39k ± 0%     2.39k ± 0%    ~     (all equal)
ImagePackageCatalogers/rpmdb-cataloger-2                  3.19k ± 0%     3.19k ± 0%    ~     (all equal)
ImagePackageCatalogers/java-cataloger-2                   23.7k ± 0%     23.7k ± 0%    ~     (p=0.794 n=5+5)
ImagePackageCatalogers/apkdb-cataloger-2                  1.91k ± 0%     1.91k ± 0%    ~     (all equal)
ImagePackageCatalogers/go-cataloger-2                     1.44k ± 0%     1.44k ± 0%    ~     (all equal)
ImagePackageCatalogers/rust-cataloger-2                   2.81k ± 0%     2.81k ± 0%    ~     (all equal)

}

// example CPE: cpe:/o:centos:linux:6:GA
var systemReleaseCpeMatcher = regexp.MustCompile(`cpe:\/o:(.*?):.*?:(.*?):.*?$`)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a good approach, however, syft already has CPE parsing built in that we can leverage https://github.com/anchore/syft/blob/main/syft/pkg/cpe.go#L12 --can we switch to using this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@wagoodman Just tried that, but it creates an import cycle :(. Unless i'm doing something horribly wrong?

Copy link
Contributor

Choose a reason for hiding this comment

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

nope, you are not doing anything wrong --it looks like pkg depends on distro to support pURLs. This hints at a refactor that we can do later, either striving for pkg to not depend on distro (medium lift-ish) or migrating cpe out of pkg (small lift). We can defer that for now.

Can you leave a comment in the code that points out we should use the CPE parser once it is importable? (no code change requested at this point 👍 )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

comment added!

Copy link
Contributor

@wagoodman wagoodman left a comment

Choose a reason for hiding this comment

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

looks good, we can come back and refactor this to use the existing CPE code when there is no longer a cycle (there are multiple hints to migrate CPE related things to a separate package)

…release files for information

Signed-off-by: Samuel Dacanay <[email protected]>
@dakaneye dakaneye force-pushed the issue-429-centos-distro branch from 60b89d6 to b05748d Compare September 3, 2021 14:58
@dakaneye dakaneye merged commit 0799fd9 into main Sep 3, 2021
@dakaneye dakaneye deleted the issue-429-centos-distro branch September 3, 2021 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Distro not detected for centos:6

2 participants