Skip to content
This repository has been archived by the owner on Mar 16, 2021. It is now read-only.

Commit

Permalink
Delete unused code from old Catalog2Registration (#776)
Browse files Browse the repository at this point in the history
  • Loading branch information
joelverhagen committed May 5, 2020
1 parent 91f1ac9 commit 84b0d21
Show file tree
Hide file tree
Showing 94 changed files with 73 additions and 6,695 deletions.
1 change: 0 additions & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ Invoke-BuildStep 'Creating artifacts' {
"src\Ng\Catalog2Dnx.nuspec", `
"src\Ng\Catalog2icon.nuspec", `
"src\Ng\Catalog2Monitoring.nuspec", `
"src\Ng\Catalog2Registration.nuspec", `
"src\Ng\Db2Catalog.nuspec", `
"src\Ng\Db2Monitoring.nuspec", `
"src\Ng\Monitoring2Monitoring.nuspec", `
Expand Down
84 changes: 0 additions & 84 deletions src/Catalog/FileSystemEmulatorHandler.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
using System;
using NuGet.Services.Metadata.Catalog.Helpers;

namespace NuGet.Services.Metadata.Catalog.Registration
namespace NuGet.Services.Metadata.Catalog
{
public class FlatContainerPackagePathProvider : IPackagePathProvider
public class FlatContainerPackagePathProvider
{
private readonly string _container;

Expand Down
86 changes: 0 additions & 86 deletions src/Catalog/Helpers/NuGetVersionUtility.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Linq;
using NuGet.Versioning;
using VDS.RDF;
using VDS.RDF.Query;

namespace NuGet.Services.Metadata.Catalog.Helpers
{
Expand Down Expand Up @@ -43,87 +39,5 @@ public static string GetFullVersionString(string version)

return parsedVersion.ToFullString();
}

public static bool IsVersionSemVer2(string version)
{
NuGetVersion parsedVersion;
if (!NuGetVersion.TryParse(version, out parsedVersion))
{
return false;
}

return parsedVersion.IsSemVer2;
}

public static bool IsVersionRangeSemVer2(string versionRange)
{
VersionRange parsedVersionRange;
if (!VersionRange.TryParse(versionRange, out parsedVersionRange))
{
return false;
}

if (parsedVersionRange.HasLowerBound && parsedVersionRange.MinVersion.IsSemVer2)
{
return true;
}

if (parsedVersionRange.HasUpperBound && parsedVersionRange.MaxVersion.IsSemVer2)
{
return true;
}

return false;
}

public static bool IsGraphSemVer2(string version, string resourceUri, IGraph graph)
{
// Is the package version itself SemVer 2.0.0?
if (IsVersionSemVer2(version))
{
return true;
}

if (resourceUri == null)
{
throw new ArgumentNullException(nameof(resourceUri));
}

if (graph == null)
{
throw new ArgumentNullException(nameof(graph));
}

// Is the verbatim version SemVer 2.0.0?
var parsedResourceUri = new Uri(resourceUri);
var verbatimVersion = graph.GetTriplesWithSubjectPredicate(
graph.CreateUriNode(parsedResourceUri),
graph.CreateUriNode(Schema.Predicates.VerbatimVersion)).FirstOrDefault()?.Object as ILiteralNode;
if (verbatimVersion != null && IsVersionSemVer2(verbatimVersion.Value))
{
return true;
}

// Are any of the dependency version ranges SemVer 2.0.0?
var sparql = new SparqlParameterizedString
{
CommandText = Utils.GetResource("sparql.SelectDistinctDependencyVersionRanges.rq")
};
sparql.SetUri("resourceUri", new Uri(resourceUri));
var query = sparql.ToString();

TripleStore store = new TripleStore();
store.Add(graph, true);
foreach (SparqlResult row in SparqlHelpers.Select(store, query))
{
var unparsedVersionRange = row["versionRange"].ToString();
if (IsVersionRangeSemVer2(unparsedVersionRange))
{
return true;
}
}

return false;
}
}
}
31 changes: 0 additions & 31 deletions src/Catalog/Helpers/SparqlHelpers.cs

This file was deleted.

Loading

0 comments on commit 84b0d21

Please sign in to comment.