Skip to content

Commit

Permalink
Merge pull request #1676 from EyeCantCU/ruby-base
Browse files Browse the repository at this point in the history
fix(sca): Generate dependency for ruby-*-base instead of ruby-*
  • Loading branch information
EyeCantCU authored Dec 6, 2024
2 parents ca737ad + 9a674bc commit b5d4d74
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions pkg/sca/sca.go
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ func generatePythonDeps(ctx context.Context, hdl SCAHandle, generated *config.De
return nil
}

// generateRubyDeps generates a ruby-X.Y dependency for packages which ship
// generateRubyDeps generates a ruby-X.Y-base dependency for packages which ship
// Ruby gems.
func generateRubyDeps(ctx context.Context, hdl SCAHandle, generated *config.Dependencies) error {
log := clog.FromContext(ctx)
Expand Down Expand Up @@ -590,8 +590,8 @@ func generateRubyDeps(ctx context.Context, hdl SCAHandle, generated *config.Depe
}
}

log.Infof(" found ruby gem, generating ruby-%s dependency", rubyGemVer)
generated.Runtime = append(generated.Runtime, fmt.Sprintf("ruby-%s", rubyGemVer))
log.Infof(" found ruby gem, generating ruby-%s-base dependency", rubyGemVer)
generated.Runtime = append(generated.Runtime, fmt.Sprintf("ruby-%s-base", rubyGemVer))

return nil
}
Expand Down Expand Up @@ -669,7 +669,7 @@ func sonameLibver(soname string) string {
func getShbang(fp io.Reader) (string, error) {
// python3 and sh are symlinks and generateCmdProviders currently only considers
// regular files. Since nothing will fulfill such a depend, do not generate one.
ignores := map[string]bool{"python3": true, "python": true, "sh": true, "awk": true}
ignores := map[string]bool{"python3": true, "python": true, "ruby": true, "sh": true, "awk": true}

buf := make([]byte, 80)
blen, err := io.ReadFull(fp, buf)
Expand Down
2 changes: 1 addition & 1 deletion pkg/sca/sca_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func TestRubySca(t *testing.T) {
t.Fatal(err)
}

want := config.Dependencies{Runtime: []string{"ruby-3.2"}}
want := config.Dependencies{Runtime: []string{"ruby-3.2-base"}}

if diff := cmp.Diff(want, got); diff != "" {
t.Errorf("Analyze(): (-want, +got):\n%s", diff)
Expand Down

0 comments on commit b5d4d74

Please sign in to comment.