Skip to content

Commit

Permalink
Allow higher versions to satisfy the dependency (#3763)
Browse files Browse the repository at this point in the history
Rather than looking for the explicit version of the VCLibs dependency, this change allows any version greater than or equal to satisfy the installed check.

This does not resolve the fact that we are using a hardcoded version, nor that we are not checking for the same set of architectures that we would install.

Also fixes the helper script to import the dev modules directly so that it can be used even when the release modules are present in the module path.
  • Loading branch information
JohnMcPMS committed Oct 13, 2023
1 parent 85951ae commit 54d6e5b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace Microsoft.WinGet.Client.Engine.Helpers
{
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
Expand Down Expand Up @@ -254,15 +255,28 @@ private void InstallVCLibsDependencies()
{ Name, VCLibsUWPDesktop },
});

// See if the required version is installed.
// See if the minimum (or greater) version is installed.
// TODO: Pull the minimum version from the target package
// TODO: This does not check architecture of the package
Version minimumVersion = new Version(VCLibsUWPDesktopVersion);

bool isInstalled = false;
if (result != null &&
result.Count > 0)
{
foreach (dynamic psobject in result)
{
if (psobject?.Version == VCLibsUWPDesktopVersion)
string versionString = psobject?.Version?.ToString();
if (versionString == null)
{
continue;
}

Version packageVersion = new Version(versionString);

if (packageVersion >= minimumVersion)
{
this.psCmdlet.WriteDebug($"VCLibs dependency satisfied by: {psobject?.PackageFullName ?? "<null>"}");
isInstalled = true;
break;
}
Expand Down
12 changes: 6 additions & 6 deletions src/PowerShell/scripts/Initialize-LocalWinGetModules.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,16 @@ if ($BuildRoot -eq "")
$BuildRoot = "$PSScriptRoot\..\..";
}

# Add here new modules
# Modules, they should be in dependency order so that when importing we don't pick up the release modules.
[WinGetModule[]]$local:modules =
[WinGetModule]::new(
"Microsoft.WinGet.DSC",
"$PSScriptRoot\..\Microsoft.WinGet.DSC\",
$false),
[WinGetModule]::new(
"Microsoft.WinGet.Client",
"$PSScriptRoot\..\Microsoft.WinGet.Client\ModuleFiles\",
$true),
[WinGetModule]::new(
"Microsoft.WinGet.DSC",
"$PSScriptRoot\..\Microsoft.WinGet.DSC\",
$false),
[WinGetModule]::new(
"Microsoft.WinGet.Configuration",
"$PSScriptRoot\..\Microsoft.WinGet.Configuration\ModuleFiles\",
Expand Down Expand Up @@ -111,6 +111,6 @@ if (-not $SkipImportModule)
foreach($module in $modules)
{
Write-Host "Importing module $($module.Name)" -ForegroundColor Green
Import-Module $module.Name -Force
Import-Module "$moduleRootOutput\$($module.Name)\" -Force
}
}

0 comments on commit 54d6e5b

Please sign in to comment.