Skip to content
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

enable pc #1522

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 22 additions & 20 deletions pkg/sca/sca.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,10 @@ func generateSharedObjectNameDeps(ctx context.Context, hdl SCAHandle, generated
return nil
}

// TODO(kaniini): Turn this feature on once enough of Wolfi is built with provider data.
var generateRuntimePkgConfigDeps = false
// TODO(xnox): Note remove this feature flag, once successful
// note this can generate depends on pc: files that do not exist in
// wolfi, however package install tests will catch that in presubmit
var generateRuntimePkgConfigDeps = true

// generatePkgConfigDeps generates a list of provided pkg-config package names and versions,
// as well as dependency relationships.
Expand Down Expand Up @@ -437,28 +439,28 @@ func generatePkgConfigDeps(ctx context.Context, hdl SCAHandle, generated *config
if isInDir(path, []string{"lib/pkgconfig/", "usr/lib/pkgconfig/", "lib64/pkgconfig/", "usr/lib64/pkgconfig/"}) {
log.Infof(" found pkg-config %s for %s", pcName, path)
generated.Provides = append(generated.Provides, fmt.Sprintf("pc:%s=%s", pcName, hdl.Version()))
} else {
log.Infof(" found vendored pkg-config %s for %s", pcName, path)
generated.Vendored = append(generated.Vendored, fmt.Sprintf("pc:%s=%s", pcName, hdl.Version()))
}

if generateRuntimePkgConfigDeps {
// TODO(kaniini): Capture version relationships here too. In practice, this does not matter
// so much though for us.
for _, dep := range pkg.Requires {
log.Infof(" found pkg-config dependency (requires) %s for %s", dep.Identifier, path)
generated.Runtime = append(generated.Runtime, fmt.Sprintf("pc:%s", dep.Identifier))
}
if generateRuntimePkgConfigDeps {
// TODO(kaniini): Capture version relationships here too. In practice, this does not matter
// so much though for us.
for _, dep := range pkg.Requires {
log.Infof(" found pkg-config dependency (requires) %s for %s", dep.Identifier, path)
generated.Runtime = append(generated.Runtime, fmt.Sprintf("pc:%s", dep.Identifier))
}

for _, dep := range pkg.RequiresPrivate {
log.Infof(" found pkg-config dependency (requires private) %s for %s", dep.Identifier, path)
generated.Runtime = append(generated.Runtime, fmt.Sprintf("pc:%s", dep.Identifier))
}
for _, dep := range pkg.RequiresPrivate {
log.Infof(" found pkg-config dependency (requires private) %s for %s", dep.Identifier, path)
generated.Runtime = append(generated.Runtime, fmt.Sprintf("pc:%s", dep.Identifier))
}

for _, dep := range pkg.RequiresInternal {
log.Infof(" found pkg-config dependency (requires internal) %s for %s", dep.Identifier, path)
generated.Runtime = append(generated.Runtime, fmt.Sprintf("pc:%s", dep.Identifier))
for _, dep := range pkg.RequiresInternal {
log.Infof(" found pkg-config dependency (requires internal) %s for %s", dep.Identifier, path)
generated.Runtime = append(generated.Runtime, fmt.Sprintf("pc:%s", dep.Identifier))
}
}
} else {
log.Infof(" found vendored pkg-config %s for %s", pcName, path)
generated.Vendored = append(generated.Vendored, fmt.Sprintf("pc:%s=%s", pcName, hdl.Version()))
}

return nil
Expand Down
Loading