-
Notifications
You must be signed in to change notification settings - Fork 125
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
Draft: Implement versioned provides
/depends
for shared libraries
#1871
Draft
sergiodj
wants to merge
8
commits into
chainguard-dev:main
Choose a base branch
from
sergiodj:versioned-shlib-depends-provides
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Draft: Implement versioned provides
/depends
for shared libraries
#1871
sergiodj
wants to merge
8
commits into
chainguard-dev:main
from
sergiodj:versioned-shlib-depends-provides
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
facb128
to
89fa5a5
Compare
I went through each commit and they all are clearly described and make sense to me. I've been learning golang this week, and I feel like I even understood all of the code! |
"provides" statements should be pinned to the full (sub)package version, so that we can later generate versioned "depends" for shared libraries. Fixes: chainguard-dev#1621 Signed-off-by: Sergio Durigan Junior <[email protected]>
This field stores a pointer to the current PkgResolver related to the build being analyzed. It's useful later during SCA when we will need to determine which package provides a specific shared library. PkgResolver is only applicable when there's a build context involved. This means that "melange scan" won't be able to access it. Signed-off-by: Sergio Durigan Junior <[email protected]>
InstalledPackages returns a list of all installed packages in the current build environment. This includes the package and all the subpackages being analyzed. PkgResolver returns the pointer to the PkgResolver associated with the build. Signed-off-by: Sergio Durigan Junior <[email protected]>
This function tries to determine the exact version of the package that provides a specific shared library. It does that by using PkgResolver to generate a list of packages providing said library, and then verifying which package version is installed in the build environment. Signed-off-by: Sergio Durigan Junior <[email protected]>
Whenever possible, SCA will generate versioned "depends" lines for shared libraries. Instead of: depend = so:libz.so.1 we shall see: depend = so:libz.so.1=1.3.1-r6 Signed-off-by: Sergio Durigan Junior <[email protected]>
…rovides Signed-off-by: Sergio Durigan Junior <[email protected]>
For now these don't do anything. Signed-off-by: Sergio Durigan Junior <[email protected]>
7ab97e3
to
d596bfe
Compare
We need the latest APKO to build melange. Signed-off-by: Sergio Durigan Junior <[email protected]>
d596bfe
to
9627d68
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements versioned
provides
/depends
for shared libraries.I've had to plumb some things around to make everything work, so I'd love to have another pair of eyes go through the changes to double check I didn't mess anything up.
The implementation for versioned
provides
is somewhat simple: we already have the package version being analyzed during SCA, and we just need to use it when generating theprovides = so:...
line.Versioned
depends
is more involved. The general idea (kudos to @jonjohnsonjr for the invaluable input!) is the following:PkgResolver
from apko. We do that duringbuildGuest
, where we can access the currentAPK
being built. ThisPkgResolver
becomes an attribute of theBuild
struct.PkgResolver
intoSCAHandle
so that we can access it during SCA.PkgResolver
to return the list of packages that satisfy the queryso:<ShlibName>
.provides
for the shared library. If it doesn't, then we can't (yet) use versioneddepends
.The idea is that the algorithm works with and without versioned
provides
for shared libraries, so that we won't need to rebuild the whole archive after deploying it.This code requires the changes implemented in chainguard-dev/apko@620f808.
Functional Changes
Notes:
SCA Changes
Notes: