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
74 changes: 36 additions & 38 deletions apps/rocm/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2549,7 +2549,7 @@ fn build_driver_install_plan(
os_release_text: &str,
dkms: bool,
) -> DriverInstallPlan {
let repo_version_expr = "${ROCM_CLI_AMDGPU_VERSION:-7.2.4}".to_owned();
let repo_version_expr = "${ROCM_CLI_AMDGPU_DRIVER_VERSION:-latest}".to_owned();
if examine.os == "windows" {
return DriverInstallPlan {
supported: false,
Expand Down Expand Up @@ -2809,7 +2809,7 @@ fn apt_driver_plan(
driver_command(
DriverCommandPhase::Prepare,
&format!(
"printf '%s\\n' 'deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/graphics/{repo_version_expr}/ubuntu {codename} main' | sudo tee /etc/apt/sources.list.d/amdgpu.list >/dev/null"
"printf '%s\\n' 'deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/amdgpu/{repo_version_expr}/ubuntu {codename} main' | sudo tee /etc/apt/sources.list.d/amdgpu.list >/dev/null"
),
),
driver_command(
Expand Down Expand Up @@ -2898,11 +2898,15 @@ fn dnf_driver_plan(
));
}
}
commands.push(driver_command(
DriverCommandPhase::Prepare,
"sudo rpm --import https://repo.radeon.com/rocm/rocm.gpg.key",
));
commands.push(driver_command(
DriverCommandPhase::Prepare,
&format!(
"sudo dnf install -y {}",
amdgpu_install_rpm_url(&repo_version_expr, &version_id, distro)
"printf '%s\\n' '[amdgpu]' 'name=amdgpu' 'baseurl={}' 'enabled=1' 'priority=50' 'gpgcheck=1' 'gpgkey=https://repo.radeon.com/rocm/rocm.gpg.key' | sudo tee /etc/yum.repos.d/amdgpu.repo >/dev/null",
dnf_repo_baseurl(&repo_version_expr, &version_id, distro)
),
));
commands.push(driver_command(
Expand Down Expand Up @@ -2988,11 +2992,15 @@ fn sles_driver_plan(
DriverCommandPhase::Prepare,
"sudo zypper install -y kernel-default-devel",
),
driver_command(
DriverCommandPhase::Prepare,
"sudo rpm --import https://repo.radeon.com/rocm/rocm.gpg.key",
),
driver_command(
DriverCommandPhase::Prepare,
&format!(
"sudo zypper --no-gpg-checks install -y {}",
amdgpu_install_sles_rpm_url(&repo_version_expr, &version_id)
"printf '%s\\n' '[amdgpu]' 'name=amdgpu' 'baseurl={}' 'enabled=1' 'autorefresh=0' 'type=rpm-md' 'gpgcheck=1' 'gpgkey=https://repo.radeon.com/rocm/rocm.gpg.key' | sudo tee /etc/zypp/repos.d/amdgpu.repo >/dev/null",
sles_repo_baseurl(&repo_version_expr, &version_id)
),
),
driver_command(DriverCommandPhase::Prepare, "sudo zypper refresh"),
Expand Down Expand Up @@ -3061,26 +3069,19 @@ fn rhel_kernel_prepare_commands(version_id: &str) -> Vec<&'static str> {
}
}

fn amdgpu_install_rpm_url(
repo_version_expr: &str,
version_id: &str,
distro: DnfDriverDistro,
) -> String {
fn dnf_repo_baseurl(repo_version_expr: &str, version_id: &str, distro: DnfDriverDistro) -> String {
let repo_family = match distro {
DnfDriverDistro::Rhel => "rhel",
DnfDriverDistro::Oracle | DnfDriverDistro::Rocky | DnfDriverDistro::Generic => "el",
};
let repo_version = dnf_repo_version_path(version_id);
let el_major = linux_major_version(version_id);
format!(
"https://repo.radeon.com/amdgpu-install/{repo_version_expr}/{repo_family}/{repo_version}/amdgpu-install-{repo_version_expr}.${{ROCM_CLI_AMDGPU_PACKAGE_RELEASE:-70204}}-1.el{el_major}.noarch.rpm"
"https://repo.radeon.com/amdgpu/{repo_version_expr}/{repo_family}/{repo_version}/main/x86_64"
)
}

fn amdgpu_install_sles_rpm_url(repo_version_expr: &str, version_id: &str) -> String {
format!(
"https://repo.radeon.com/amdgpu-install/{repo_version_expr}/sle/{version_id}/amdgpu-install-{repo_version_expr}.${{ROCM_CLI_AMDGPU_PACKAGE_RELEASE:-70204}}-1.noarch.rpm"
)
fn sles_repo_baseurl(repo_version_expr: &str, version_id: &str) -> String {
format!("https://repo.radeon.com/amdgpu/{repo_version_expr}/sle/{version_id}/main/x86_64")
}

fn dnf_repo_version_path(version_id: &str) -> String {
Expand Down Expand Up @@ -21078,7 +21079,7 @@ VERSION_CODENAME=noble
assert!(
commands
.iter()
.any(|command| command.contains("repo.radeon.com/graphics"))
.any(|command| command.contains("repo.radeon.com/amdgpu"))
);
assert!(
commands
Expand Down Expand Up @@ -21262,10 +21263,11 @@ VERSION_ID="9.7"
assert!(rendered.contains("kernel-headers-$(uname -r)"));
assert!(rendered.contains("kernel-devel-$(uname -r)"));
assert!(rendered.contains("kernel-devel-matched-$(uname -r)"));
assert!(rendered.contains("sudo rpm --import https://repo.radeon.com/rocm/rocm.gpg.key"));
assert!(rendered.contains(
"repo.radeon.com/amdgpu-install/${ROCM_CLI_AMDGPU_VERSION:-7.2.4}/rhel/9.7/"
"baseurl=https://repo.radeon.com/amdgpu/${ROCM_CLI_AMDGPU_DRIVER_VERSION:-latest}/rhel/9.7/main/x86_64"

Check failure on line 21268 in apps/rocm/src/main.rs

View workflow job for this annotation

GitHub Actions / clippy

this looks like a formatting argument but it is not part of a formatting macro
));
assert!(rendered.contains("amdgpu-install-${ROCM_CLI_AMDGPU_VERSION:-7.2.4}.${ROCM_CLI_AMDGPU_PACKAGE_RELEASE:-70204}-1.el9.noarch.rpm"));
assert!(rendered.contains("/etc/yum.repos.d/amdgpu.repo"));
assert!(rendered.contains("Execute: sudo dnf install -y amdgpu-dkms"));
assert!(rendered.contains("approval: required"));
}
Expand All @@ -21284,10 +21286,9 @@ VERSION_ID="10.1"
assert!(rendered.contains("kernel-uek-devel-$(uname -r)"));
assert!(
rendered.contains(
"repo.radeon.com/amdgpu-install/${ROCM_CLI_AMDGPU_VERSION:-7.2.4}/el/10/"
"baseurl=https://repo.radeon.com/amdgpu/${ROCM_CLI_AMDGPU_DRIVER_VERSION:-latest}/el/10/main/x86_64"

Check failure on line 21289 in apps/rocm/src/main.rs

View workflow job for this annotation

GitHub Actions / clippy

this looks like a formatting argument but it is not part of a formatting macro
)
);
assert!(rendered.contains("amdgpu-install-${ROCM_CLI_AMDGPU_VERSION:-7.2.4}.${ROCM_CLI_AMDGPU_PACKAGE_RELEASE:-70204}-1.el10.noarch.rpm"));
assert!(rendered.contains("dry run only"));
}

Expand All @@ -21307,7 +21308,7 @@ VERSION_ID="9.7"
);
assert!(
rendered.contains(
"repo.radeon.com/amdgpu-install/${ROCM_CLI_AMDGPU_VERSION:-7.2.4}/el/9.7/"
"baseurl=https://repo.radeon.com/amdgpu/${ROCM_CLI_AMDGPU_DRIVER_VERSION:-latest}/el/9.7/main/x86_64"

Check failure on line 21311 in apps/rocm/src/main.rs

View workflow job for this annotation

GitHub Actions / clippy

this looks like a formatting argument but it is not part of a formatting macro
)
);
assert!(rendered.contains("Execute: sudo dnf install -y amdgpu-dkms"));
Expand All @@ -21327,10 +21328,9 @@ VERSION_ID="9.4"
assert!(plan.mutating);
assert!(
rendered.contains(
"repo.radeon.com/amdgpu-install/${ROCM_CLI_AMDGPU_VERSION:-7.2.4}/el/9.4/"
"baseurl=https://repo.radeon.com/amdgpu/${ROCM_CLI_AMDGPU_DRIVER_VERSION:-latest}/el/9.4/main/x86_64"

Check failure on line 21331 in apps/rocm/src/main.rs

View workflow job for this annotation

GitHub Actions / clippy

this looks like a formatting argument but it is not part of a formatting macro
)
);
assert!(rendered.contains("amdgpu-install-${ROCM_CLI_AMDGPU_VERSION:-7.2.4}.${ROCM_CLI_AMDGPU_PACKAGE_RELEASE:-70204}-1.el9.noarch.rpm"));
assert!(rendered.contains("Execute: sudo dnf install -y amdgpu-dkms"));
}

Expand Down Expand Up @@ -21365,7 +21365,7 @@ VERSION_CODENAME=bookworm
assert!(plan.supported);
assert_eq!(plan.codename, "jammy");
assert!(rendered.contains(
"https://repo.radeon.com/graphics/${ROCM_CLI_AMDGPU_VERSION:-7.2.4}/ubuntu jammy main"
"https://repo.radeon.com/amdgpu/${ROCM_CLI_AMDGPU_DRIVER_VERSION:-latest}/ubuntu jammy main"

Check failure on line 21368 in apps/rocm/src/main.rs

View workflow job for this annotation

GitHub Actions / clippy

this looks like a formatting argument but it is not part of a formatting macro
));
assert!(
plan.reason
Expand All @@ -21387,10 +21387,11 @@ VERSION_ID="15.7"
assert!(rendered.contains("SUSEConnect"));
assert!(rendered.contains("sle-module-desktop-applications/15.7/x86_64"));
assert!(rendered.contains("sudo zypper install -y kernel-default-devel"));
assert!(rendered.contains("sudo rpm --import https://repo.radeon.com/rocm/rocm.gpg.key"));
assert!(rendered.contains(
"repo.radeon.com/amdgpu-install/${ROCM_CLI_AMDGPU_VERSION:-7.2.4}/sle/15.7/"
"baseurl=https://repo.radeon.com/amdgpu/${ROCM_CLI_AMDGPU_DRIVER_VERSION:-latest}/sle/15.7/main/x86_64"

Check failure on line 21392 in apps/rocm/src/main.rs

View workflow job for this annotation

GitHub Actions / clippy

this looks like a formatting argument but it is not part of a formatting macro
));
assert!(rendered.contains("sudo zypper --no-gpg-checks install -y"));
assert!(rendered.contains("/etc/zypp/repos.d/amdgpu.repo"));
assert!(rendered.contains("Execute: sudo zypper install -y amdgpu-dkms"));
assert!(rendered.contains("approval: required"));
}
Expand Down Expand Up @@ -21464,7 +21465,7 @@ ID_LIKE="ubuntu debian"
// Ubuntu-family derivatives ship the Ubuntu kernel, so linux-modules-extra applies.
assert!(rendered.contains("linux-modules-extra-$(uname -r)"));
assert!(rendered.contains(
"https://repo.radeon.com/graphics/${ROCM_CLI_AMDGPU_VERSION:-7.2.4}/ubuntu jammy main"
"https://repo.radeon.com/amdgpu/${ROCM_CLI_AMDGPU_DRIVER_VERSION:-latest}/ubuntu jammy main"

Check failure on line 21468 in apps/rocm/src/main.rs

View workflow job for this annotation

GitHub Actions / clippy

this looks like a formatting argument but it is not part of a formatting macro
));
assert!(rendered.contains("Execute: sudo apt-get install -y amdgpu-dkms"));
}
Expand All @@ -21483,7 +21484,7 @@ ID_LIKE=debian
assert!(plan.supported);
// Debian-family maps to the Ubuntu jammy repo and omits linux-modules-extra.
assert!(rendered.contains(
"https://repo.radeon.com/graphics/${ROCM_CLI_AMDGPU_VERSION:-7.2.4}/ubuntu jammy main"
"https://repo.radeon.com/amdgpu/${ROCM_CLI_AMDGPU_DRIVER_VERSION:-latest}/ubuntu jammy main"

Check failure on line 21487 in apps/rocm/src/main.rs

View workflow job for this annotation

GitHub Actions / clippy

this looks like a formatting argument but it is not part of a formatting macro
));
assert!(!rendered.contains("linux-modules-extra-$(uname -r)"));
assert!(rendered.contains("amdgpu-dkms"));
Expand All @@ -21506,11 +21507,10 @@ ID_LIKE="rhel centos fedora"
// EL rebuilds use the vendor-neutral el/ repo path, not rhel/.
assert!(
rendered.contains(
"repo.radeon.com/amdgpu-install/${ROCM_CLI_AMDGPU_VERSION:-7.2.4}/el/9.6/"
"baseurl=https://repo.radeon.com/amdgpu/${ROCM_CLI_AMDGPU_DRIVER_VERSION:-latest}/el/9.6/main/x86_64"

Check failure on line 21510 in apps/rocm/src/main.rs

View workflow job for this annotation

GitHub Actions / clippy

this looks like a formatting argument but it is not part of a formatting macro
)
);
assert!(!rendered.contains("/rhel/9.6/"));
assert!(rendered.contains("amdgpu-install-${ROCM_CLI_AMDGPU_VERSION:-7.2.4}.${ROCM_CLI_AMDGPU_PACKAGE_RELEASE:-70204}-1.el9.noarch.rpm"));
// el9 uses the version-aware standard-kernel prepare commands.
assert!(rendered.contains("kernel-devel-matched-$(uname -r)"));
assert!(rendered.contains("Execute: sudo dnf install -y amdgpu-dkms"));
Expand All @@ -21528,11 +21528,9 @@ ID_LIKE="rhel centos fedora"

assert!(plan.supported);
// EL 8 is served from the major-version path (el/8), matching AMD docs.
assert!(
rendered
.contains("repo.radeon.com/amdgpu-install/${ROCM_CLI_AMDGPU_VERSION:-7.2.4}/el/8/")
);
assert!(rendered.contains("-1.el8.noarch.rpm"));
assert!(rendered.contains(
"baseurl=https://repo.radeon.com/amdgpu/${ROCM_CLI_AMDGPU_DRIVER_VERSION:-latest}/el/8/main/x86_64"

Check failure on line 21532 in apps/rocm/src/main.rs

View workflow job for this annotation

GitHub Actions / clippy

this looks like a formatting argument but it is not part of a formatting macro
));
// el8 has no kernel-devel-matched package.
assert!(!rendered.contains("kernel-devel-matched"));
assert!(rendered.contains("kernel-devel-$(uname -r)"));
Expand Down Expand Up @@ -21569,7 +21567,7 @@ ID_LIKE=fedora

assert!(plan.supported);
assert!(rendered.contains(
"repo.radeon.com/amdgpu-install/${ROCM_CLI_AMDGPU_VERSION:-7.2.4}/rhel/9.7/"
"baseurl=https://repo.radeon.com/amdgpu/${ROCM_CLI_AMDGPU_DRIVER_VERSION:-latest}/rhel/9.7/main/x86_64"
));
assert!(!rendered.contains("/el/9.7/"));
}
Expand Down
Loading