From 810b4733d04243ddf0ad915ece56eedc029d59df Mon Sep 17 00:00:00 2001 From: Benji Visser Date: Sun, 17 Sep 2023 12:21:41 -0700 Subject: [PATCH] reverse dependsOn relationship Signed-off-by: Benji Visser --- .../pkg/cataloger/dotnet/parse_dotnet_deps.go | 4 +- .../dotnet/parse_dotnet_deps_test.go | 66 +++++++++---------- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/syft/pkg/cataloger/dotnet/parse_dotnet_deps.go b/syft/pkg/cataloger/dotnet/parse_dotnet_deps.go index 6e8e3eee077..c471af5bc33 100644 --- a/syft/pkg/cataloger/dotnet/parse_dotnet_deps.go +++ b/syft/pkg/cataloger/dotnet/parse_dotnet_deps.go @@ -103,8 +103,8 @@ func parseDotnetDeps(_ file.Resolver, _ *generic.Environment, reader file.Locati continue } rel := artifact.Relationship{ - From: pkg, - To: depPkg, + From: depPkg, + To: pkg, Type: artifact.DependencyOfRelationship, } relationships = append(relationships, rel) diff --git a/syft/pkg/cataloger/dotnet/parse_dotnet_deps_test.go b/syft/pkg/cataloger/dotnet/parse_dotnet_deps_test.go index 7d4f7d748b2..1815a4439f5 100644 --- a/syft/pkg/cataloger/dotnet/parse_dotnet_deps_test.go +++ b/syft/pkg/cataloger/dotnet/parse_dotnet_deps_test.go @@ -250,101 +250,101 @@ func TestParseDotnetDeps(t *testing.T) { expectedRelationships := []artifact.Relationship{ { - From: msftDependencyInjection, - To: msftDependencyInjectionAbstractions, + From: awssdkcore, + To: testCommon, Type: artifact.DependencyOfRelationship, }, { From: msftDependencyInjection, - To: systemRuntimeCompilerServicesUnsafe, + To: msftExtensionsLogging, Type: artifact.DependencyOfRelationship, }, - { - From: msftExtensionsLogging, - To: msftDependencyInjection, + From: msftDependencyInjection, + To: rootPkg, Type: artifact.DependencyOfRelationship, }, { - From: msftExtensionsLogging, - To: msftDependencyInjectionAbstractions, + From: msftDependencyInjectionAbstractions, + To: msftDependencyInjection, Type: artifact.DependencyOfRelationship, }, { - From: msftExtensionsLogging, - To: msftLoggingAbstractions, + From: msftDependencyInjectionAbstractions, + To: msftExtensionsLogging, Type: artifact.DependencyOfRelationship, }, { - From: msftExtensionsLogging, + From: msftDependencyInjectionAbstractions, To: msftExtensionsOptions, Type: artifact.DependencyOfRelationship, }, { From: msftExtensionsLogging, - To: systemDiagnosticsDiagnosticsource, + To: rootPkg, Type: artifact.DependencyOfRelationship, }, { - From: msftExtensionsOptions, - To: msftDependencyInjectionAbstractions, + From: msftLoggingAbstractions, + To: msftExtensionsLogging, Type: artifact.DependencyOfRelationship, }, { From: msftExtensionsOptions, - To: msftExtensionsPrimitives, + To: msftExtensionsLogging, Type: artifact.DependencyOfRelationship, }, { From: msftExtensionsPrimitives, - To: systemRuntimeCompilerServicesUnsafe, + To: msftExtensionsOptions, Type: artifact.DependencyOfRelationship, }, { - From: serilogSinksConsole, - To: serilog, + From: newtonsoftJson, + To: rootPkg, Type: artifact.DependencyOfRelationship, }, { - From: systemDiagnosticsDiagnosticsource, - To: systemRuntimeCompilerServicesUnsafe, + From: serilog, + To: serilogSinksConsole, Type: artifact.DependencyOfRelationship, }, { - From: testCommon, - To: awssdkcore, + From: serilog, + To: rootPkg, Type: artifact.DependencyOfRelationship, }, { - From: rootPkg, - To: msftDependencyInjection, + From: serilogSinksConsole, + To: rootPkg, Type: artifact.DependencyOfRelationship, }, { - From: rootPkg, + From: systemDiagnosticsDiagnosticsource, To: msftExtensionsLogging, Type: artifact.DependencyOfRelationship, }, { - From: rootPkg, - To: newtonsoftJson, + From: systemRuntimeCompilerServicesUnsafe, + To: msftDependencyInjection, Type: artifact.DependencyOfRelationship, }, { - From: rootPkg, - To: serilog, + From: systemRuntimeCompilerServicesUnsafe, + To: msftExtensionsPrimitives, Type: artifact.DependencyOfRelationship, }, { - From: rootPkg, - To: serilogSinksConsole, + From: systemRuntimeCompilerServicesUnsafe, + To: systemDiagnosticsDiagnosticsource, Type: artifact.DependencyOfRelationship, }, { - From: rootPkg, - To: testCommon, + From: testCommon, + To: rootPkg, Type: artifact.DependencyOfRelationship, }, } + pkgtest.TestFileParser(t, fixture, parseDotnetDeps, expectedPkgs, expectedRelationships) }