Skip to content

Commit

Permalink
Simplify RHEL detection
Browse files Browse the repository at this point in the history
* add 7.x versions explicitly to distro table
* remove rhel special casing.
  • Loading branch information
gaborcsardi committed Sep 11, 2024
1 parent 6cb6cdf commit 06d0d42
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
3 changes: 0 additions & 3 deletions R/sysreqs.R
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,6 @@ parse_sysreqs_platform <- function(x) {
osplt$distribution <- restpcs[1]
osplt$version <- paste0(restpcs[-1], collapse = "-")
}
if (osplt$distribution == "rhel" || osplt$distribution == "redhat") {
osplt$version = strsplit(osplt$version, "[.]")[[1]][1]
}
osplt
}

Expand Down
10 changes: 10 additions & 0 deletions R/sysreqs2.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ sysreqs2_cmds <- utils::read.table(
'Red Hat Enterprise Linux' linux redhat 6 NA 'yum install -y' rpm
'Red Hat Enterprise Linux' linux redhat 7 NA 'yum install -y' rpm
'Red Hat Enterprise Linux' linux redhat * NA 'dnf install -y' rpm
'Red Hat Enterprise Linux' linux rhel 7.0 NA 'yum install -y' rpm
'Red Hat Enterprise Linux' linux rhel 7.1 NA 'yum install -y' rpm
'Red Hat Enterprise Linux' linux rhel 7.2 NA 'yum install -y' rpm
'Red Hat Enterprise Linux' linux rhel 7.3 NA 'yum install -y' rpm
'Red Hat Enterprise Linux' linux rhel 7.4 NA 'yum install -y' rpm
'Red Hat Enterprise Linux' linux rhel 7.5 NA 'yum install -y' rpm
'Red Hat Enterprise Linux' linux rhel 7.6 NA 'yum install -y' rpm
'Red Hat Enterprise Linux' linux rhel 7.7 NA 'yum install -y' rpm
'Red Hat Enterprise Linux' linux rhel 7.8 NA 'yum install -y' rpm
'Red Hat Enterprise Linux' linux rhel 7.9 NA 'yum install -y' rpm
'Red Hat Enterprise Linux' linux rhel * NA 'dnf install -y' rpm
'Fedora Linux' linux fedora * NA 'dnf install -y' rpm
'openSUSE Linux' linux opensuse * NA 'zypper --non-interactive install' rpm
Expand Down
24 changes: 17 additions & 7 deletions tests/testthat/_snaps/sysreqs.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# sysreqs_platforms

Code
sysreqs_platforms()
print(sysreqs_platforms(), n = Inf)
Output
# A data frame: 12 x 7
# A data frame: 22 x 7
name os distribution version update_command install_command query_command
<chr> <chr> <chr> <chr> <chr> <chr> <chr>
1 Ubun~ linux ubuntu * apt-get -y up~ apt-get -y ins~ dpkg-query
Expand All @@ -13,11 +13,21 @@
5 Red ~ linux redhat 6 <NA> yum install -y rpm
6 Red ~ linux redhat 7 <NA> yum install -y rpm
7 Red ~ linux redhat * <NA> dnf install -y rpm
8 Red ~ linux rhel * <NA> dnf install -y rpm
9 Fedo~ linux fedora * <NA> dnf install -y rpm
10 open~ linux opensuse * <NA> zypper --non-i~ rpm
11 SUSE~ linux sle * <NA> zypper --non-i~ rpm
12 Alpi~ linux alpine * <NA> apk add --no-c~ apk
8 Red ~ linux rhel 7.0 <NA> yum install -y rpm
9 Red ~ linux rhel 7.1 <NA> yum install -y rpm
10 Red ~ linux rhel 7.2 <NA> yum install -y rpm
11 Red ~ linux rhel 7.3 <NA> yum install -y rpm
12 Red ~ linux rhel 7.4 <NA> yum install -y rpm
13 Red ~ linux rhel 7.5 <NA> yum install -y rpm
14 Red ~ linux rhel 7.6 <NA> yum install -y rpm
15 Red ~ linux rhel 7.7 <NA> yum install -y rpm
16 Red ~ linux rhel 7.8 <NA> yum install -y rpm
17 Red ~ linux rhel 7.9 <NA> yum install -y rpm
18 Red ~ linux rhel * <NA> dnf install -y rpm
19 Fedo~ linux fedora * <NA> dnf install -y rpm
20 open~ linux opensuse * <NA> zypper --non-i~ rpm
21 SUSE~ linux sle * <NA> zypper --non-i~ rpm
22 Alpi~ linux alpine * <NA> apk add --no-c~ apk

# sysreqs_db_list

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-sysreqs.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

test_that("sysreqs_platforms", {
expect_snapshot(sysreqs_platforms())
expect_snapshot(print(sysreqs_platforms(), n = Inf))
})

test_that("sysreqs_db_list", {
Expand Down

0 comments on commit 06d0d42

Please sign in to comment.