Skip to content

Commit a01a1ce

Browse files
authored
Revert "Update packageurl-dotnet to 2.0.0-rc.2 (#1730)" (#1751)
This reverts commit aa548cd.
1 parent 562d86b commit a01a1ce

21 files changed

Lines changed: 38 additions & 56 deletions

Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<PackageVersion Include="Newtonsoft.Json.Schema" Version="4.0.1" />
2828
<PackageVersion Include="NuGet.ProjectModel" Version="7.3.0" />
2929
<PackageVersion Include="NuGet.Versioning" Version="7.3.0" />
30-
<PackageVersion Include="packageurl-dotnet" Version="2.0.0-rc.3" />
30+
<PackageVersion Include="packageurl-dotnet" Version="1.0.0" />
3131
<PackageVersion Include="Polly" Version="8.6.6" />
3232
<PackageVersion Include="SemanticVersioning" Version="2.0.2" />
3333
<PackageVersion Include="Serilog" Version="4.3.1" />

docs/creating-a-new-detector.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public class YourEcosystemComponent : TypedComponent
104104
public string Version { get; set; }
105105

106106
public override ComponentType Type => ComponentType.YourType;
107-
public override PackageUrl PackageUrl => new PackageUrl("your-type", null, this.Name, this.Version, null, null);
107+
public override PackageURL PackageUrl => new PackageURL("your-type", null, this.Name, this.Version, null, null);
108108
protected override string ComputeId() => $"{this.Name} {this.Version} - {this.Type}";
109109
}
110110
```

docs/schema/manifest.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,4 +547,4 @@
547547
"resultCode",
548548
"sourceDirectory"
549549
]
550-
}
550+
}

src/Microsoft.ComponentDetection.Contracts/TypedComponent/CargoComponent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public CargoComponent(string name, string version, string author = null, string
4444
public override ComponentType Type => ComponentType.Cargo;
4545

4646
[JsonPropertyName("packageUrl")]
47-
public override PackageUrl PackageUrl => new PackageUrl("cargo", string.Empty, this.Name, this.Version, null, string.Empty);
47+
public override PackageURL PackageUrl => new PackageURL("cargo", string.Empty, this.Name, this.Version, null, string.Empty);
4848

4949
protected override string ComputeBaseId() => $"{this.Name} {this.Version} - {this.Type}";
5050
}

src/Microsoft.ComponentDetection.Contracts/TypedComponent/ConanComponent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public ConanComponent(string name, string version, string previous, string packa
3838
public override ComponentType Type => ComponentType.Conan;
3939

4040
[JsonPropertyName("packageUrl")]
41-
public override PackageUrl PackageUrl => new PackageUrl("conan", string.Empty, this.Name, this.Version, null, string.Empty);
41+
public override PackageURL PackageUrl => new PackageURL("conan", string.Empty, this.Name, this.Version, null, string.Empty);
4242

4343
protected override string ComputeBaseId() => $"{this.Name} {this.Version} - {this.Type}";
4444
}

src/Microsoft.ComponentDetection.Contracts/TypedComponent/CppSdkComponent.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ public CppSdkComponent(string name, string version)
3939
public override ComponentType Type => ComponentType.CppSdk;
4040

4141
[JsonPropertyName("packageUrl")]
42-
public override PackageUrl PackageUrl
42+
public override PackageURL PackageUrl
4343
{
4444
get
4545
{
4646
var qualifiers = new SortedDictionary<string, string>
4747
{
4848
{ "type", "cppsdk" },
4949
};
50-
return new PackageUrl("generic", null, this.Name, this.Version, qualifiers, null);
50+
return new PackageURL("generic", null, this.Name, this.Version, qualifiers, null);
5151
}
5252
}
5353

src/Microsoft.ComponentDetection.Contracts/TypedComponent/GoComponent.cs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,34 +37,14 @@ public GoComponent()
3737

3838
// Commit should be used in place of version when available
3939
// https://github.com/package-url/purl-spec/blame/180c46d266c45aa2bd81a2038af3f78e87bb4a25/README.rst#L610
40-
// The golang purl spec requires a namespace: https://github.com/package-url/purl-spec/blob/master/types/golang-definition.json
4140
[JsonPropertyName("packageUrl")]
42-
public override PackageUrl PackageUrl
43-
{
44-
get
45-
{
46-
var version = string.IsNullOrWhiteSpace(this.Hash) ? this.Version : this.Hash;
47-
var (ns, name) = this.GetNamespaceAndName();
48-
return new PackageUrl("golang", ns, name, version, null, null);
49-
}
50-
}
41+
public override PackageURL PackageUrl => new PackageURL("golang", null, this.Name, string.IsNullOrWhiteSpace(this.Hash) ? this.Version : this.Hash, null, null);
5142

5243
[JsonIgnore]
5344
public override ComponentType Type => ComponentType.Go;
5445

5546
protected override string ComputeBaseId() => $"{this.Name} {this.Version} - {this.Type}";
5647

57-
private (string Namespace, string Name) GetNamespaceAndName()
58-
{
59-
var lastSlash = this.Name.LastIndexOf('/');
60-
if (lastSlash > 0)
61-
{
62-
return (this.Name.Substring(0, lastSlash), this.Name.Substring(lastSlash + 1));
63-
}
64-
65-
return (null, this.Name);
66-
}
67-
6848
public override bool Equals(object obj)
6949
{
7050
return obj is GoComponent otherComponent && this.Equals(otherComponent);

src/Microsoft.ComponentDetection.Contracts/TypedComponent/LinuxComponent.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public LinuxComponent(string distribution, string release, string name, string v
4646
public override ComponentType Type => ComponentType.Linux;
4747

4848
[JsonPropertyName("packageUrl")]
49-
public override PackageUrl PackageUrl
49+
public override PackageURL PackageUrl
5050
{
5151
get
5252
{
@@ -63,7 +63,7 @@ public override PackageUrl PackageUrl
6363

6464
if (packageType != null)
6565
{
66-
return new PackageUrl(packageType, this.Distribution, this.Name, this.Version, null, null);
66+
return new PackageURL(packageType, this.Distribution, this.Name, this.Version, null, null);
6767
}
6868

6969
return null;

src/Microsoft.ComponentDetection.Contracts/TypedComponent/MavenComponent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public MavenComponent()
3131
public override ComponentType Type => ComponentType.Maven;
3232

3333
[JsonPropertyName("packageUrl")]
34-
public override PackageUrl PackageUrl => new PackageUrl("maven", this.GroupId, this.ArtifactId, this.Version, null, null);
34+
public override PackageURL PackageUrl => new PackageURL("maven", this.GroupId, this.ArtifactId, this.Version, null, null);
3535

3636
protected override string ComputeBaseId() => $"{this.GroupId} {this.ArtifactId} {this.Version} - {this.Type}";
3737
}

src/Microsoft.ComponentDetection.Contracts/TypedComponent/NpmComponent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public NpmComponent(string name, string version, string hash = null, NpmAuthor a
3636
public override ComponentType Type => ComponentType.Npm;
3737

3838
[JsonPropertyName("packageUrl")]
39-
public override PackageUrl PackageUrl => new PackageUrl("npm", null, this.Name, this.Version, null, null);
39+
public override PackageURL PackageUrl => new PackageURL("npm", null, this.Name, this.Version, null, null);
4040

4141
protected override string ComputeBaseId() => $"{this.Name} {this.Version} - {this.Type}";
4242
}

0 commit comments

Comments
 (0)