Skip to content

Commit 095daea

Browse files
committed
Merge branch 'feature/aur-helpers' into ci/aur-e2e
2 parents 3cd0494 + a76dd7c commit 095daea

2 files changed

Lines changed: 69 additions & 5 deletions

File tree

‎src/UniGetUI.PackageEngine.Managers.Aur/Helpers/AurPkgOperationHelper.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public static List<string> Build(
9393
}
9494
}
9595

96-
parameters.Add(packageId);
96+
parameters.Add(operation is OperationType.Uninstall ? packageId : $"aur/{packageId}");
9797
return parameters;
9898
}
9999
}

‎src/UniGetUI.PackageEngine.Tests/AurManagerTests.cs‎

Lines changed: 68 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public void AnUnidentifiedHelperOnlyGetsTheOptionsBothHelpersUnderstand()
152152
{
153153
var args = AurOperationArguments.Build(OperationType.Install, "yay-bin", AurHelperKind.Unknown, "/usr/bin/pkexec", "");
154154

155-
Assert.Equal(["-S", "--aur", "--noconfirm", "--sudo=/usr/bin/pkexec", "yay-bin"], args);
155+
Assert.Equal(["-S", "--aur", "--noconfirm", "--sudo=/usr/bin/pkexec", "aur/yay-bin"], args);
156156
}
157157

158158
[Theory]
@@ -188,6 +188,70 @@ public void ComparesVersionsTheWayPacmanDoes(string a, string b, int expected)
188188
Assert.Equal(expected, new Aur().CompareVersions(a, b));
189189
}
190190

191+
[Fact]
192+
public void ParsesSearchOutputCapturedFromRealParuAndYay()
193+
{
194+
const string paru =
195+
"aur/pfetch 1.11.0-1 [+48 ~0.06]\n" +
196+
" A pretty system information tool written in POSIX sh.\n" +
197+
"aur/pfetch-git r340.e18a095-1 [+15 ~0.00]\n" +
198+
" A pretty system information tool written in POSIX sh.\n";
199+
const string yay =
200+
"aur/scrapfetch-rs 0.1.5-1 (+0 0.00) [164d1h] \n" +
201+
" Small system info splash\n" +
202+
"aur/scrapfetch-git r9.9650db3-3 (+1 0.00) [276d6h] \n" +
203+
" A tool for fetching system information. Written in C for Linux.\n";
204+
205+
Assert.Equal([new("pfetch", "1.11.0-1"), new("pfetch-git", "r340.e18a095-1")], AurOutputParser.ParseSearch(paru));
206+
Assert.Equal([new("scrapfetch-rs", "0.1.5-1"), new("scrapfetch-git", "r9.9650db3-3")], AurOutputParser.ParseSearch(yay));
207+
}
208+
209+
[Fact]
210+
public void ParsesDetailsCapturedFromRealYay()
211+
{
212+
const string output =
213+
"Repository : aur\n" +
214+
"Name : visual-studio-code-bin\n" +
215+
"Version : 1.146.0-1\n" +
216+
"Description : Visual Studio Code (vscode): Editor for building and debugging modern web and cloud applications (official binary version)\n" +
217+
"URL : https://code.visualstudio.com/\n" +
218+
"Licenses : custom: commercial\n" +
219+
"Groups : None\n" +
220+
"Provides : code vscode\n" +
221+
"Depends On : libxkbfile gnupg gtk3 libsecret nss\n" +
222+
" gcc-libs libnotify libxss glibc lsof\n" +
223+
" shared-mime-info xdg-utils alsa-lib\n" +
224+
"Optional Deps : glib2 libdbusmenu-glib\n" +
225+
" org.freedesktop.secrets icu69 bubblewrap\n" +
226+
" socat\n" +
227+
"Make Deps : None\n" +
228+
"Check Deps : None\n" +
229+
"Conflicts With : code\n" +
230+
"Replaces : None\n" +
231+
"AUR URL : https://aur.archlinux.org/packages/visual-studio-code-bin\n" +
232+
"First Submitted : Mon 18 Dec 2017 07:14:08 PM UTC\n" +
233+
"Keywords : None\n" +
234+
"Last Modified : Wed 11 Nov 2026 05:28:35 PM UTC\n" +
235+
"Maintainer : dcelasun\n" +
236+
"Popularity : 11.975223\n" +
237+
"Votes : 1713\n" +
238+
"Out-of-date : No\n" +
239+
"\n";
240+
241+
var details = new PackageDetails(new PackageBuilder().WithId("visual-studio-code-bin").Build());
242+
243+
AurOutputParser.ParseDetails(output, details);
244+
245+
Assert.Equal("dcelasun", details.Publisher);
246+
Assert.Equal("1.146.0-1", details.Version);
247+
Assert.Equal("custom: commercial", details.License);
248+
Assert.Equal("Wed 11 Nov 2026 05:28:35 PM UTC", details.UpdateDate);
249+
Assert.Equal(13, details.Dependencies.Count(d => d.Mandatory));
250+
Assert.Equal(
251+
["glib2", "libdbusmenu-glib", "org.freedesktop.secrets", "icu69", "bubblewrap", "socat"],
252+
details.Dependencies.Where(d => !d.Mandatory).Select(d => d.Name));
253+
}
254+
191255
[Fact]
192256
public void FallsBackToThePackagePageWhenTheHelperGivesNoAurUrl()
193257
{
@@ -216,7 +280,7 @@ public void ParuInstallsSkipReviewAndUseTheConfiguredElevator()
216280
var args = AurOperationArguments.Build(OperationType.Install, "yay-bin", AurHelperKind.Paru, "/usr/bin/sudo", "-A");
217281

218282
Assert.Equal(
219-
["-S", "--aur", "--skipreview", "--noconfirm", "--sudo=/usr/bin/sudo", "--sudoflags=-A", "yay-bin"],
283+
["-S", "--aur", "--skipreview", "--noconfirm", "--sudo=/usr/bin/sudo", "--sudoflags=-A", "aur/yay-bin"],
220284
args);
221285
}
222286

@@ -228,7 +292,7 @@ public void YayUpdatesAnswerEveryMenuWithNone()
228292
Assert.Equal(
229293
[
230294
"-S", "--aur", "--answerclean=None", "--answerdiff=None", "--answeredit=None",
231-
"--noconfirm", "--sudo=/usr/bin/pkexec", "--sudoloop=false", "paru-bin",
295+
"--noconfirm", "--sudo=/usr/bin/pkexec", "--sudoloop=false", "aur/paru-bin",
232296
],
233297
args);
234298
}
@@ -239,7 +303,7 @@ public void ParuTurnsTheSudoLoopOffForAnElevatorThatIsNotSudo()
239303
var args = AurOperationArguments.Build(OperationType.Install, "yay-bin", AurHelperKind.Paru, "/usr/bin/pkexec", "");
240304

241305
Assert.Equal(
242-
["-S", "--aur", "--skipreview", "--noconfirm", "--sudo=/usr/bin/pkexec", "--nosudoloop", "yay-bin"],
306+
["-S", "--aur", "--skipreview", "--noconfirm", "--sudo=/usr/bin/pkexec", "--nosudoloop", "aur/yay-bin"],
243307
args);
244308
}
245309

0 commit comments

Comments
 (0)