public StoredPackage GetPackage(PhysicalPackageMetadata metadata) { fileSystem.EnsureDirectoryExists(rootDirectory); foreach (var file in PackageFiles(metadata.PackageAndVersionSearchPattern)) { var storedPackage = GetPackage(file); if (storedPackage == null) { continue; } if (!string.Equals(storedPackage.Metadata.PackageId, metadata.PackageId, StringComparison.OrdinalIgnoreCase) || !VersionFactory.TryCreateVersion(storedPackage.Metadata.Version, out IVersion packageVersion, metadata.VersionFormat) || !packageVersion.Equals(VersionFactory.CreateVersion(metadata.Version, metadata.VersionFormat))) { continue; } if (string.IsNullOrWhiteSpace(metadata.Hash)) { return(storedPackage); } if (metadata.Hash == storedPackage.Metadata.Hash) { return(storedPackage); } } return(null); }
void FindEarlierPackages(PackageStore packageStore, PhysicalPackageMetadata packageMetadata) { Log.VerboseFormat("Finding earlier packages that have been uploaded to this Tentacle."); var nearestPackages = packageStore.GetNearestPackages(packageMetadata).ToList(); if (!nearestPackages.Any()) { Log.VerboseFormat("No earlier packages for {0} has been uploaded", packageId); } Log.VerboseFormat("Found {0} earlier {1} of {2} on this Tentacle", nearestPackages.Count, nearestPackages.Count == 1 ? "version" : "versions", packageId); foreach (var nearestPackage in nearestPackages) { Log.VerboseFormat(" - {0}: {1}", nearestPackage.Metadata.Version, nearestPackage.FullPath); Log.ServiceMessages.PackageFound( nearestPackage.Metadata.PackageId, nearestPackage.Metadata.Version, nearestPackage.Metadata.Hash, nearestPackage.Metadata.FileExtension, nearestPackage.FullPath); } }
public StoredPackage(PhysicalPackageMetadata metadata, string fullPath) { Metadata = metadata; FullPath = fullPath; }