Skip to content

Commit fedb38c

Browse files
committed
backport: recognize Pinget no-applicable upgrades
Upstream-Commit: c683fa7 Upstream-PR: Devolutions#5244
1 parent 8b86761 commit fedb38c

3 files changed

Lines changed: 30 additions & 1 deletion

File tree

maintenance/backports.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ backports:
3333
class: backend
3434
reason: Propagates non-terminating PowerShell 5.x module errors through the operation exit code while respecting caller-owned error variables.
3535

36+
- commit: c683fa77961b1cdf72a41599f5a91ab5699db8e6
37+
upstream_pr: 5244
38+
status: applied-semantic
39+
class: backend
40+
reason: Treats Pinget's no-applicable-upgrade message as not applicable even when the process exits with code zero, preserving Classic's existing retry and phantom-suppression guards.
41+
3642
- commit: 21116375c8299d1db38a3c3b4c2eb7e18bc97c4e
3743
upstream_pr: 5072
3844
status: applied

src/UniGetUI.PackageEngine.Managers.WinGet/Helpers/WinGetPkgOperationHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,9 @@ operation is OperationType.Uninstall
288288
// non-zero with "No applicable installer found" in its output (#4998).
289289
bool pingetReportedNotApplicable =
290290
((WinGet)Manager).SelectedCliToolKind is WinGetCliToolKind.BundledPinget
291-
&& returnCode != 0
292291
&& processOutput.Any(line =>
293292
line.Contains("No applicable installer found", StringComparison.OrdinalIgnoreCase)
293+
|| line.Contains("No applicable upgrade found", StringComparison.OrdinalIgnoreCase)
294294
);
295295

296296
if (uintCode is 0x8A15002B || pingetReportedNotApplicable)

src/UniGetUI.PackageEngine.Tests/WinGetManagerTests.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,6 +1118,29 @@ public void WinGetGenericPingetFailureDoesNotRetry()
11181118
Assert.False(package.OverridenOptions.WinGet_DropArchAndScope);
11191119
}
11201120

1121+
[Fact]
1122+
public void WinGetUpdateNotApplicableViaPingetWithZeroExitCodeFails()
1123+
{
1124+
var manager = new WinGet();
1125+
SetCliToolKind(manager, WinGetCliToolKind.BundledPinget);
1126+
var package = new PackageBuilder()
1127+
.WithManager(manager)
1128+
.WithId("Contoso.Tool")
1129+
.WithVersion("1.0.0")
1130+
.WithNewVersion("2.0.0")
1131+
.Build();
1132+
1133+
var veredict = manager.OperationHelper.GetResult(
1134+
package,
1135+
OperationType.Update,
1136+
["No applicable upgrade found."],
1137+
0
1138+
);
1139+
1140+
OperationAssert.HasVeredict(veredict, OperationVeredict.Failure);
1141+
Assert.True(WinGetPkgOperationHelper.IsStuckUpgradeLoop(package));
1142+
}
1143+
11211144
[Fact]
11221145
public void WinGetUpdateNotApplicableSuppressesPhantomUpdate()
11231146
{

0 commit comments

Comments
 (0)