Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Release with new features and bugfixes:
* https://github.com/devonfw/IDEasy/issues/2114[#2114]: Fix false "Cygwin is not supported" warning in Git Bash
* https://github.com/devonfw/IDEasy/issues/865[#865]: az not working on Mac
* https://github.com/devonfw/IDEasy/issues/2026[#2026]: Create UvRepository and UvBasedCommandlet
* https://github.com/devonfw/IDEasy/issues/2007[#2007]: Support Docker on Arch Linux with pacman and yay

The full list of changes for this release can be found in https://github.com/devonfw/IDEasy/milestone/46?closed=1[milestone 2026.07.001].

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ public enum NativePackageManager {
YUM,

/** DaNdiFied yum (DNF) is the package manager of RPM package based Linux distributions like Fedora. It is the successor of {@link #YUM}. */
DNF;
DNF,

/** Pacman is the package manager of Arch Linux based distributions. */
PACMAN;

/**
* Extracts the package manager from the provided command string.
Expand All @@ -37,6 +40,9 @@ public static NativePackageManager extractPackageManager(String command) {
if (command.contains("dnf")) {
return DNF;
}
if (command.contains("pacman")) {
return PACMAN;
}

throw new IllegalArgumentException("Unknown package manager in command: " + command);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ protected List<PackageManagerCommand> getInstallPackageManagerCommands() {
"echo 'deb [signed-by=/usr/share/keyrings/isv-rancher-stable-archive-keyring.gpg]"
+ " https://download.opensuse.org/repositories/isv:/Rancher:/stable/deb/ ./' |"
+ " sudo dd status=none of=/etc/apt/sources.list.d/isv-rancher-stable.list", "sudo apt update",
String.format("sudo apt install -y --allow-downgrades rancher-desktop=%s*", resolvedVersion))));
String.format("sudo apt install -y --allow-downgrades rancher-desktop=%s*", resolvedVersion))),
new PackageManagerCommand(NativePackageManager.PACMAN, List.of("yay -S --needed --noconfirm rancher-desktop")));
}

@Override
Expand Down Expand Up @@ -132,6 +133,9 @@ private VersionIdentifier getDockerDesktopVersionWindows() {

private VersionIdentifier getDockerDesktopVersionLinux() {

if (!isCommandAvailable("apt")) {
return null;
}
String dockerDesktopVersionLinuxCommand = "apt list --installed | grep docker-desktop | awk '{print $2}'";
String output = this.context.newProcess().runAndGetSingleOutput("bash", "-lc", dockerDesktopVersionLinuxCommand);
return super.resolveVersionWithPattern(output, DOCKER_DESKTOP_LINUX_VERSION_PATTERN);
Expand Down Expand Up @@ -175,6 +179,8 @@ private List<PackageManagerCommand> getPackageManagerCommandsUninstall() {
new PackageManagerCommand(NativePackageManager.ZYPPER, List.of("sudo zypper remove rancher-desktop")));
pmCommands.add(
new PackageManagerCommand(NativePackageManager.APT, List.of("sudo apt -y autoremove rancher-desktop")));
pmCommands.add(
new PackageManagerCommand(NativePackageManager.PACMAN, List.of("sudo pacman -Rs --noconfirm rancher-desktop")));

return pmCommands;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.devonfw.tools.ide.tool;

import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;

/**
* Test of {@link NativePackageManager}.
*/
class NativePackageManagerTest extends Assertions {

/**
* Test of {@link NativePackageManager#extractPackageManager(String)} for every supported package manager.
*/
@Test
void testExtractPackageManager() {

assertThat(NativePackageManager.extractPackageManager("sudo apt install -y rancher-desktop")).isEqualTo(NativePackageManager.APT);
assertThat(NativePackageManager.extractPackageManager("yum install rancher-desktop")).isEqualTo(NativePackageManager.YUM);
assertThat(NativePackageManager.extractPackageManager("sudo zypper install rancher-desktop")).isEqualTo(NativePackageManager.ZYPPER);
assertThat(NativePackageManager.extractPackageManager("dnf install rancher-desktop")).isEqualTo(NativePackageManager.DNF);
assertThat(NativePackageManager.extractPackageManager("sudo pacman -Rs --noconfirm rancher-desktop")).isEqualTo(NativePackageManager.PACMAN);
}

/**
* Test of {@link NativePackageManager#extractPackageManager(String)} for a command without a recognized package manager.
*/
@Test
void testExtractPackageManagerThrowsForUnknownCommand() {

assertThatThrownBy(() -> NativePackageManager.extractPackageManager("brew install rancher-desktop")).isInstanceOf(IllegalArgumentException.class);
}

/**
* Test of {@link NativePackageManager#getBinaryName()}.
*/
@Test
void testGetBinaryName() {

assertThat(NativePackageManager.APT.getBinaryName()).isEqualTo("apt");
assertThat(NativePackageManager.PACMAN.getBinaryName()).isEqualTo("pacman");
}
}
Loading