Exemple #1
0
 public void DownloadPackage(string fastPath, string location, BootstrapRequest request)
 {
     if (request == null) {
         throw new ArgumentNullException("request");
     }
     request.Debug("Calling 'Bootstrap::DownloadPackage'");
 }
Exemple #2
0
        private bool InstallPackageReference(Package provider, string fastPath, BootstrapRequest request, SoftwareIdentity[] packages)
        {
            IHostApi installRequest = request;

            if (packages[0].Provider.Name.EqualsIgnoreCase("PSModule") && !request.ProviderServices.IsElevated)
            {
                // if we're not elevated, we want powershellget to install to the user scope

                installRequest = new object[] {
                    new {
                        GetOptionKeys   = new Func <IEnumerable <string> >(() => request.OptionKeys.ConcatSingleItem("Scope")),
                        GetOptionValues = new Func <string, IEnumerable <string> >((key) => {
                            if (key != null && key.EqualsIgnoreCase("Scope"))
                            {
                                return("CurrentUser".SingleItemAsEnumerable());
                            }
                            return(request.GetOptionValues(key));
                        })
                    }
                    , installRequest
                }.As <IHostApi>();
            }

            var installing = packages[0].Provider.InstallPackage(packages[0], installRequest);

            SoftwareIdentity lastPackage = null;

            foreach (var i in installing)
            {
                lastPackage = i;
                // should we echo each package back as it comes back?
                request.YieldSoftwareIdentity(i.FastPackageReference, i.Name, i.Version, i.VersionScheme, i.Summary, i.Source, i.SearchKey, i.FullPath, i.PackageFilename);

                if (request.IsCanceled)
                {
                    installing.Cancel();
                }
            }

            if (!request.IsCanceled && lastPackage != null)
            {
                if (provider.Name.EqualsIgnoreCase("PSModule"))
                {
                    // special case. PSModules we can just ask the PowerShell provider to pick it up
                    // rather than try to scan for it.
                    PackageManagementService.TryLoadProviderViaMetaProvider("PowerShell", lastPackage.FullPath, request);
                    request.YieldFromSwidtag(provider, fastPath);
                    return(true);
                }

                // looks like it installed ok.
                request.YieldFromSwidtag(provider, fastPath);

                // rescan providers
                PackageManagementService.LoadProviders(request.As <IRequest>());
                return(true);
            }
            return(false);
        }
Exemple #3
0
 public void DownloadPackage(string fastPath, string location, BootstrapRequest request)
 {
     if (request == null)
     {
         throw new ArgumentNullException("request");
     }
     request.Debug("Calling 'Bootstrap::DownloadPackage'");
 }
Exemple #4
0
        public void FindPackage(string name, string requiredVersion, string minimumVersion, string maximumVersion, int id, BootstrapRequest request)
        {
            if (request == null) {
                throw new ArgumentNullException("request");
            }

            request.Debug("Calling 'Bootstrap::FindPackage'");

            if (name != null && name.EqualsIgnoreCase("PackageManagement")) {
                // they are looking for PackageManagement itself.
                // future todo: let PackageManagement update itself.
                return;
            }

            // are they are looking for a specific provider?
            if (string.IsNullOrWhiteSpace(name)) {
                // no, return all providers that match the range.
                if (request.GetOptionValue("AllVersions").IsTrue()) {
                    foreach (var p in request.Providers.Distinct(PackageEqualityComparer)) {
                        FindPackage(p.Name, null, "0.0", null, 0, request);
                    }
                    return;
                }

                if (request.Providers.Distinct(PackageEqualityComparer).Any(p => !request.YieldFromSwidtag(p, requiredVersion, minimumVersion, maximumVersion, name))) {
                    // if there is a problem, exit.
                    return;
                }
            } else {
                // return just the one they asked for.

                // asked for a specific version?
                if (!string.IsNullOrWhiteSpace(requiredVersion)) {
                    request.YieldFromSwidtag(request.GetProvider(name, requiredVersion), name);
                    return;
                }

                if (request.GetOptionValue("AllVersions").IsTrue() && string.IsNullOrWhiteSpace(minimumVersion)) {
                    minimumVersion = "0.0";
                }

                // asked for a version range?
                if (!string.IsNullOrWhiteSpace(minimumVersion) || !string.IsNullOrEmpty(maximumVersion)) {
                    if (request.GetProvider(name, minimumVersion, maximumVersion).Distinct(PackageEqualityComparer).Any(provider => !request.YieldFromSwidtag(provider, name))) {
                        // if there is a problem, exit.
                        return;
                    }
                    return;
                }

                // just return by name
                request.YieldFromSwidtag(request.GetProvider(name), name);
            }

            // return any matches in the name
        }
Exemple #5
0
 public void InitializeProvider(BootstrapRequest request)
 {
     // we should go find out what's available once here just to make sure that
     // we have a list
     try {
         request.Debug("Initialize Bootstrapper");
         PackageManagementService.BootstrappableProviderNames = request.Providers.Select(provider => provider.Name).ToArray();
     } catch (Exception e) {
         e.Dump();
     }
 }
Exemple #6
0
        public void GetFeatures(BootstrapRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }

            request.Debug("Calling 'Bootstrap::GetFeatures'");
            foreach (var feature in _features)
            {
                request.Yield(feature);
            }
        }
Exemple #7
0
        private bool InstallPackageFile(Package provider, string fastPath, BootstrapRequest request)
        {
            // we can download and verify this package and get the core to install it.
            var file = request.DownloadAndValidateFile(provider.Name, provider._swidtag.Links.Where(each => each.Relationship == Iso19770_2.Relationship.InstallationMedia));

            if (file != null)
            {
                // we have a valid file.
                // run the installer
                if (request.ProviderServices.Install(file, "", request))
                {
                    // it installed ok!
                    request.YieldFromSwidtag(provider, fastPath);
                    PackageManagementService.LoadProviders(request.As <IRequest>());
                    return(true);
                }
                request.Warning(Constants.Messages.FailedProviderBootstrap, fastPath);
            }
            return(false);
        }
Exemple #8
0
        public void GetDynamicOptions(string category, BootstrapRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }

            request.Debug("Calling 'Bootstrap::GetDynamicOptions ({0})'", category);

            switch ((category ?? string.Empty).ToLowerInvariant())
            {
            case "package":
                break;

            case "source":
                break;

            case "install":
                request.YieldDynamicOption("DestinationPath", "Folder", false);
                break;
            }
        }
Exemple #9
0
        public void GetDynamicOptions(string category, BootstrapRequest request)
        {
            if (request == null) {
                throw new ArgumentNullException("request");
            }

            request.Debug("Calling 'Bootstrap::GetDynamicOptions ({0})'", category);

            switch ((category ?? string.Empty).ToLowerInvariant()) {
                case "package":
                    break;

                case "source":
                    break;

                case "install":
                    request.YieldDynamicOption("DestinationPath", "Folder", false);
                    break;
            }
        }
Exemple #10
0
        public void GetInstalledPackages(string name, string requiredVersion, string minimumVersion, string maximumVersion, BootstrapRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }

            request.Debug("Calling '{0}::GetInstalledPackages' '{1}','{2}','{3}','{4}'", PackageProviderName, name, requiredVersion, minimumVersion, maximumVersion);
            // return all the dynamic package providers as packages

            foreach (var provider in PackageManagementService.DynamicProviders)
            {
                // for each package manager, match it's name and version with the swidtag from the remote feed
                var p = request.GetProvider(provider.Name, provider.Version);
                if (p == null)
                {
                    request.Debug("Dynamic provider '{0}' from '{1}' is not listed in a bootstrap feed.", provider.Name, provider.ProviderPath);
                    // we didn't find it. It's possible that the provider is listed elsewhere.
                    // well, we'll return as much info as we have.
                    continue;
                }
                request.YieldFromSwidtag(p, requiredVersion, minimumVersion, maximumVersion, name);
            }
        }
Exemple #11
0
 internal Package(BootstrapRequest request, IEnumerable <Uri> mirrors)
     : base(request, mirrors)
 {
 }
Exemple #12
0
 internal Swid(BootstrapRequest request, Swidtag swidtag)
 {
     _request = request;
     _swidtag = swidtag;
 }
Exemple #13
0
 internal Feed(BootstrapRequest request, Swidtag swidtag)
     : base(request, swidtag)
 {
 }
Exemple #14
0
        private bool InstallPackageReference(Package provider, string fastPath, BootstrapRequest request, SoftwareIdentity[] packages)
        {
            IHostApi installRequest = request;
            if (packages[0].Provider.Name.EqualsIgnoreCase("PSModule") && !request.ProviderServices.IsElevated) {
                // if we're not elevated, we want powershellget to install to the user scope

                installRequest = new object[] {
                    new {
                        GetOptionKeys = new Func<IEnumerable<string>>(() => request.OptionKeys.ConcatSingleItem("Scope")),
                        GetOptionValues = new Func<string, IEnumerable<string>>((key) => {
                            if (key != null && key.EqualsIgnoreCase("Scope")) {
                                return "CurrentUser".SingleItemAsEnumerable();
                            }
                            return request.GetOptionValues(key);
                        })
                    }
                    , installRequest
                }.As<IHostApi>();
            }

            var installing = packages[0].Provider.InstallPackage(packages[0], installRequest);

            SoftwareIdentity lastPackage = null;

            foreach (var i in installing) {
                lastPackage = i;
                // should we echo each package back as it comes back?
                request.YieldSoftwareIdentity(i.FastPackageReference, i.Name, i.Version, i.VersionScheme, i.Summary, i.Source, i.SearchKey, i.FullPath, i.PackageFilename);

                if (request.IsCanceled) {
                    installing.Cancel();
                }
            }

            if (!request.IsCanceled && lastPackage != null) {
                if (provider.Name.EqualsIgnoreCase("PSModule")) {
                    // special case. PSModules we can just ask the PowerShell provider to pick it up
                    // rather than try to scan for it.
                    PackageManagementService.TryLoadProviderViaMetaProvider("PowerShell", lastPackage.FullPath, request);
                    request.YieldFromSwidtag(provider, fastPath);
                    return true;
                }

                // looks like it installed ok.
                request.YieldFromSwidtag(provider, fastPath);

                // rescan providers
                PackageManagementService.LoadProviders(request.As<IRequest>());
                return true;
            }
            return false;
        }
Exemple #15
0
        private bool InstallProviderFromInstaller(Package provider, Link link, string fastPath, BootstrapRequest request)
        {
            switch (link.MediaType)
            {
            case Iso19770_2.MediaType.MsiPackage:
            case Iso19770_2.MediaType.MsuPackage:
                return(InstallPackageFile(provider, fastPath, request));

            case Iso19770_2.MediaType.PackageReference:
                // let the core figure out how to install this package
                var packages = PackageManagementService.FindPackageByCanonicalId(link.HRef.AbsoluteUri, request).ToArray();
                switch (packages.Length)
                {
                case 0:
                    request.Warning("Unable to resolve package reference '{0}'", link.HRef);
                    return(false);

                case 1:
                    return(InstallPackageReference(provider, fastPath, request, packages));

                default:
                    request.Warning("Package Reference '{0}' resolves to {1} packages.", packages.Length);
                    return(false);
                }

            default:
                request.Warning("Provider '{0}' with link '{1}' has unknown media type '{2}'.", provider.Name, link.HRef, link.MediaType);
                return(false);
            }
        }
Exemple #16
0
        private bool InstallAssemblyProvider(Package provider, Link link, string fastPath, BootstrapRequest request)
        {
            if (!Directory.Exists(request.DestinationPath)) {
                request.Error(ErrorCategory.InvalidOperation, fastPath, Constants.Messages.DestinationPathNotSet);
                return false;
            }

            var targetFilename = link.Attributes[Iso19770_2.Discovery.TargetFilename];

            if (string.IsNullOrWhiteSpace(targetFilename)) {
                request.Error(ErrorCategory.InvalidOperation, fastPath, Constants.Messages.InvalidFilename);
                return false;
            }

            targetFilename = Path.GetFileName(targetFilename);
            var targetFile = Path.Combine(request.DestinationPath, targetFilename);

            // download the file
            var file = request.DownloadAndValidateFile(provider.Name, provider._swidtag.Links.Where(each => each.Relationship == Iso19770_2.Relationship.InstallationMedia));
            if (file != null) {
                // looks good! let's keep it
                if (File.Exists(targetFile)) {
                    request.Debug("Removing old file '{0}'", targetFile);
                    targetFile.TryHardToDelete();
                }

                // is that file still there?
                if (File.Exists(targetFile)) {
                    request.Error(ErrorCategory.InvalidOperation, fastPath, Constants.Messages.UnableToRemoveFile, targetFile);
                    return false;
                }

                request.Debug("Copying file '{0}' to '{1}'", file, targetFile);
                File.Copy(file, targetFile);
                if (File.Exists(targetFile)) {
                    // since we only installed a single assembly, we can just ask to load that specific assembly.
                    if (PackageManagementService.TryToLoadProviderAssembly(targetFile, request)) {
                        // looks good to me.
                        request.YieldFromSwidtag(provider, fastPath);
                        return true;
                    }
                }
            }
            if (file != null) {
                file.TryHardToDelete();
            }
            return false;
        }
Exemple #17
0
 public void InitializeProvider(BootstrapRequest request)
 {
     // we should go find out what's available once here just to make sure that
     // we have a list
     try {
         request.Debug("Initialize Bootstrapper");
         PackageManagementService.BootstrappableProviderNames = request.Providers.Select(provider => provider.Name).ToArray();
     } catch (Exception e) {
         e.Dump();
     }
 }
Exemple #18
0
        public void GetFeatures(BootstrapRequest request)
        {
            if (request == null) {
                throw new ArgumentNullException("request");
            }

            request.Debug("Calling 'Bootstrap::GetFeatures'");
            foreach (var feature in _features) {
                request.Yield(feature);
            }
        }
Exemple #19
0
        private bool InstallAssemblyProvider(Package provider, Link link, string fastPath, BootstrapRequest request)
        {
            if (!Directory.Exists(request.DestinationPath))
            {
                request.Error(ErrorCategory.InvalidOperation, fastPath, Constants.Messages.DestinationPathNotSet);
                return(false);
            }

            var targetFilename = link.Attributes[Iso19770_2.Discovery.TargetFilename];

            if (string.IsNullOrWhiteSpace(targetFilename))
            {
                request.Error(ErrorCategory.InvalidOperation, fastPath, Constants.Messages.InvalidFilename);
                return(false);
            }

            targetFilename = Path.GetFileName(targetFilename);
            var targetFile = Path.Combine(request.DestinationPath, targetFilename);

            // download the file
            var file = request.DownloadAndValidateFile(provider.Name, provider._swidtag.Links.Where(each => each.Relationship == Iso19770_2.Relationship.InstallationMedia));

            if (file != null)
            {
                // looks good! let's keep it
                if (File.Exists(targetFile))
                {
                    request.Debug("Removing old file '{0}'", targetFile);
                    targetFile.TryHardToDelete();
                }

                // is that file still there?
                if (File.Exists(targetFile))
                {
                    request.Error(ErrorCategory.InvalidOperation, fastPath, Constants.Messages.UnableToRemoveFile, targetFile);
                    return(false);
                }

                request.Debug("Copying file '{0}' to '{1}'", file, targetFile);
                File.Copy(file, targetFile);
                if (File.Exists(targetFile))
                {
                    // since we only installed a single assembly, we can just ask to load that specific assembly.
                    if (PackageManagementService.TryToLoadProviderAssembly(targetFile, request))
                    {
                        // looks good to me.
                        request.YieldFromSwidtag(provider, fastPath);
                        return(true);
                    }
                }
            }
            if (file != null)
            {
                file.TryHardToDelete();
            }
            return(false);
        }
Exemple #20
0
        public void InstallPackage(string fastPath, BootstrapRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }
            // ensure that mandatory parameters are present.
            request.Debug("Calling 'Bootstrap::InstallPackage'");
            var triedAndFailed = false;

            // verify the package integrity (ie, check if it's digitally signed before installing)

            var provider = request.GetProvider(new Uri(fastPath));

            if (provider == null || !provider.IsValid)
            {
                request.Error(ErrorCategory.InvalidData, fastPath, Constants.Messages.UnableToResolvePackage, fastPath);
                return;
            }

            // group the links along 'artifact' lines
            var artifacts = provider._swidtag.Links.Where(link => link.Relationship == Iso19770_2.Relationship.InstallationMedia).GroupBy(link => link.Artifact);

            // try one artifact set at a time.
            foreach (var artifact in artifacts)
            {
                // first time we succeed, we're good to go.
                foreach (var link in artifact)
                {
                    switch (link.Attributes[Iso19770_2.Discovery.Type])
                    {
                    case "assembly":
                        if (InstallAssemblyProvider(provider, link, fastPath, request))
                        {
                            return;
                        }
                        triedAndFailed = true;
                        continue;

                    default:
                        if (InstallProviderFromInstaller(provider, link, fastPath, request))
                        {
                            return;
                        }
                        triedAndFailed = true;
                        continue;
                    }
                }
            }

            if (triedAndFailed)
            {
                // we tried installing something and it didn't go well.
                request.Error(ErrorCategory.InvalidOperation, fastPath, Constants.Messages.FailedProviderBootstrap, fastPath);
            }
            else
            {
                // we didn't even find a link to bootstrap.
                request.Error(ErrorCategory.InvalidOperation, fastPath, "Provider {0} missing installationmedia to install.", fastPath);
            }
        }
Exemple #21
0
        public void GetInstalledPackages(string name, string requiredVersion, string minimumVersion, string maximumVersion, BootstrapRequest request)
        {
            if (request == null) {
                throw new ArgumentNullException("request");
            }

            request.Debug("Calling '{0}::GetInstalledPackages' '{1}','{2}','{3}','{4}'", PackageProviderName, name, requiredVersion, minimumVersion, maximumVersion);
            // return all the dynamic package providers as packages

            foreach (var provider in PackageManagementService.DynamicProviders) {
                // for each package manager, match it's name and version with the swidtag from the remote feed
                var p = request.GetProvider(provider.Name, provider.Version);
                if (p == null) {
                    request.Debug("Dynamic provider '{0}' from '{1}' is not listed in a bootstrap feed.", provider.Name, provider.ProviderPath);
                    // we didn't find it. It's possible that the provider is listed elsewhere.
                    // well, we'll return as much info as we have.
                    continue;
                }
                request.YieldFromSwidtag(p, requiredVersion, minimumVersion, maximumVersion, name);
            }
        }
Exemple #22
0
 internal Package(BootstrapRequest request, Swidtag swidtag)
     : base(request, swidtag)
 {
 }
Exemple #23
0
        public void InstallPackage(string fastPath, BootstrapRequest request)
        {
            if (request == null) {
                throw new ArgumentNullException("request");
            }
            // ensure that mandatory parameters are present.
            request.Debug("Calling 'Bootstrap::InstallPackage'");
            var triedAndFailed = false;

            // verify the package integrity (ie, check if it's digitally signed before installing)

            var provider = request.GetProvider(new Uri(fastPath));
            if (provider == null || !provider.IsValid) {
                request.Error(ErrorCategory.InvalidData, fastPath, Constants.Messages.UnableToResolvePackage, fastPath);
                return;
            }

            // group the links along 'artifact' lines
            var artifacts = provider._swidtag.Links.Where(link => link.Relationship == Iso19770_2.Relationship.InstallationMedia).GroupBy(link => link.Artifact);

            // try one artifact set at a time.
            foreach (var artifact in artifacts) {
                // first time we succeed, we're good to go.
                foreach (var link in artifact) {
                    switch (link.Attributes[Iso19770_2.Discovery.Type]) {
                        case "assembly":
                            if (InstallAssemblyProvider(provider, link, fastPath, request)) {
                                return;
                            }
                            triedAndFailed = true;
                            continue;

                        default:
                            if (InstallProviderFromInstaller(provider, link, fastPath, request)) {
                                return;
                            }
                            triedAndFailed = true;
                            continue;
                    }
                }
            }

            if (triedAndFailed) {
                // we tried installing something and it didn't go well.
                request.Error(ErrorCategory.InvalidOperation, fastPath, Constants.Messages.FailedProviderBootstrap, fastPath);
            } else {
                // we didn't even find a link to bootstrap.
                request.Error(ErrorCategory.InvalidOperation, fastPath, "Provider {0} missing installationmedia to install.", fastPath);
            }
        }
Exemple #24
0
 internal Package(BootstrapRequest request, IEnumerable<Link> mirrors)
     : base(request, mirrors)
 {
 }
Exemple #25
0
 private bool InstallPackageFile(Package provider, string fastPath, BootstrapRequest request)
 {
     // we can download and verify this package and get the core to install it.
     var file = request.DownloadAndValidateFile(provider.Name, provider._swidtag.Links.Where(each => each.Relationship == Iso19770_2.Relationship.InstallationMedia));
     if (file != null) {
         // we have a valid file.
         // run the installer
         if (request.ProviderServices.Install(file, "", request)) {
             // it installed ok!
             request.YieldFromSwidtag(provider, fastPath);
             PackageManagementService.LoadProviders(request.As<IRequest>());
             return true;
         }
         request.Warning(Constants.Messages.FailedProviderBootstrap, fastPath);
     }
     return false;
 }
Exemple #26
0
 internal Swid(BootstrapRequest request, Swidtag swidtag)
 {
     _request = request;
     _swidtag = swidtag;
 }
Exemple #27
0
        private bool InstallProviderFromInstaller(Package provider, Link link, string fastPath, BootstrapRequest request)
        {
            switch (link.MediaType) {
                case Iso19770_2.MediaType.MsiPackage:
                case Iso19770_2.MediaType.MsuPackage:
                    return InstallPackageFile(provider, fastPath, request);

                case Iso19770_2.MediaType.PackageReference:
                    // let the core figure out how to install this package
                    var packages = PackageManagementService.FindPackageByCanonicalId(link.HRef.AbsoluteUri, request).ToArray();
                    switch (packages.Length) {
                        case 0:
                            request.Warning("Unable to resolve package reference '{0}'", link.HRef);
                            return false;

                        case 1:
                            return InstallPackageReference(provider, fastPath, request, packages);

                        default:
                            request.Warning("Package Reference '{0}' resolves to {1} packages.", packages.Length);
                            return false;
                    }

                default:
                    request.Warning("Provider '{0}' with link '{1}' has unknown media type '{2}'.", provider.Name, link.HRef, link.MediaType);
                    return false;
            }
        }
Exemple #28
0
 internal Swid(BootstrapRequest request, IEnumerable<Uri> mirrors)
 {
     _request = request;
     _swidtag = DownloadSwidtag(mirrors);
 }
Exemple #29
0
 internal Feed(BootstrapRequest request, Swidtag swidtag)
     : base(request, swidtag)
 {
 }
Exemple #30
0
 internal Feed(BootstrapRequest request, IEnumerable <Link> mirrors)
     : base(request, mirrors)
 {
 }
Exemple #31
0
 internal Swid(BootstrapRequest request, IEnumerable <Uri> mirrors)
 {
     _request = request;
     _swidtag = DownloadSwidtag(mirrors);
 }
Exemple #32
0
 internal Package(BootstrapRequest request, Swidtag swidtag)
     : base(request, swidtag)
 {
 }
Exemple #33
0
 internal Feed(BootstrapRequest request, IEnumerable<Uri> mirrors)
     : base(request, mirrors)
 {
 }
Exemple #34
0
        public void FindPackage(string name, string requiredVersion, string minimumVersion, string maximumVersion, int id, BootstrapRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }

            request.Debug("Calling 'Bootstrap::FindPackage'");

            if (name != null && name.EqualsIgnoreCase("PackageManagement"))
            {
                // they are looking for PackageManagement itself.
                // future todo: let PackageManagement update itself.
                return;
            }

            // are they are looking for a specific provider?
            if (string.IsNullOrWhiteSpace(name))
            {
                // no, return all providers that match the range.
                if (request.GetOptionValue("AllVersions").IsTrue())
                {
                    foreach (var p in request.Providers.Distinct(PackageEqualityComparer))
                    {
                        FindPackage(p.Name, null, "0.0", null, 0, request);
                    }
                    return;
                }

                if (request.Providers.Distinct(PackageEqualityComparer).Any(p => !request.YieldFromSwidtag(p, requiredVersion, minimumVersion, maximumVersion, name)))
                {
                    // if there is a problem, exit.
                    return;
                }
            }
            else
            {
                // return just the one they asked for.

                // asked for a specific version?
                if (!string.IsNullOrWhiteSpace(requiredVersion))
                {
                    request.YieldFromSwidtag(request.GetProvider(name, requiredVersion), name);
                    return;
                }

                if (request.GetOptionValue("AllVersions").IsTrue() && string.IsNullOrWhiteSpace(minimumVersion))
                {
                    minimumVersion = "0.0";
                }

                // asked for a version range?
                if (!string.IsNullOrWhiteSpace(minimumVersion) || !string.IsNullOrEmpty(maximumVersion))
                {
                    if (request.GetProvider(name, minimumVersion, maximumVersion).Distinct(PackageEqualityComparer).Any(provider => !request.YieldFromSwidtag(provider, name)))
                    {
                        // if there is a problem, exit.
                        return;
                    }
                    return;
                }

                // just return by name
                request.YieldFromSwidtag(request.GetProvider(name), name);
            }

            // return any matches in the name
        }