Nim pretty and add void (#18652)

* pretty and add void

* distro fixup

* Update lib/pure/distros.nim

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

* tab to space

* requested change to be cleaner

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
This commit is contained in:
Kyle Brown 2021-08-08 10:30:51 -07:00 • committed by GitHub
commit eb19db6595
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -109,7 +109,7 @@ type
Clonezilla Clonezilla
SteamOS SteamOS
Absolute Absolute
NixOS ## NixOS or a Nix build environment NixOS ## NixOS or a Nix build environment
AUSTRUMI AUSTRUMI
Arya Arya
Porteus Porteus
@ -124,6 +124,7 @@ type
ExTiX ExTiX
Rockstor Rockstor
GoboLinux GoboLinux
Void
BSD BSD
FreeBSD FreeBSD
@ -134,7 +135,9 @@ type
const const
LacksDevPackages* = {Distribution.Gentoo, Distribution.Slackware, Distribution.ArchLinux, Distribution.Artix} LacksDevPackages* = {Distribution.Gentoo, Distribution.Slackware,
Distribution.ArchLinux, Distribution.Artix, Distribution.Antergos,
Distribution.BlackArch, Distribution.ArchBang}
# we cache the result of the 'cmdRelease' # we cache the result of the 'cmdRelease'
# execution for faster platform detections. # execution for faster platform detections.
@ -153,7 +156,8 @@ template hostnamectl(): untyped = cmdRelease("hostnamectl", hostnamectlRes)
proc detectOsWithAllCmd(d: Distribution): bool = proc detectOsWithAllCmd(d: Distribution): bool =
let dd = toLowerAscii($d) let dd = toLowerAscii($d)
result = dd in toLowerAscii(osReleaseID()) or dd in toLowerAscii(release()) or result = dd in toLowerAscii(osReleaseID()) or dd in toLowerAscii(release()) or
dd in toLowerAscii(uname()) or ("operating system: " & dd) in toLowerAscii(hostnamectl()) dd in toLowerAscii(uname()) or ("operating system: " & dd) in
toLowerAscii(hostnamectl())
proc detectOsImpl(d: Distribution): bool = proc detectOsImpl(d: Distribution): bool =
case d case d
@ -173,9 +177,9 @@ proc detectOsImpl(d: Distribution): bool =
case d case d
of Distribution.Gentoo: of Distribution.Gentoo:
result = ("-" & $d & " ") in uname() result = ("-" & $d & " ") in uname()
of Distribution.Elementary, Distribution.Ubuntu, Distribution.Debian, Distribution.Fedora, of Distribution.Elementary, Distribution.Ubuntu, Distribution.Debian,
Distribution.OpenMandriva, Distribution.CentOS, Distribution.Alpine, Distribution.Fedora, Distribution.OpenMandriva, Distribution.CentOS,
Distribution.Mageia, Distribution.Zorin: Distribution.Alpine, Distribution.Mageia, Distribution.Zorin, Distribution.Void:
result = toLowerAscii($d) in osReleaseID() result = toLowerAscii($d) in osReleaseID()
of Distribution.RedHat: of Distribution.RedHat:
result = "rhel" in osReleaseID() result = "rhel" in osReleaseID()
@ -254,6 +258,8 @@ proc foreignDepInstallCmd*(foreignPackageName: string): (string, bool) =
result = ("rpm -ivh " & p, true) result = ("rpm -ivh " & p, true)
elif detectOs(ArchLinux) or detectOs(Manjaro) or detectOs(Artix): elif detectOs(ArchLinux) or detectOs(Manjaro) or detectOs(Artix):
result = ("pacman -S " & p, true) result = ("pacman -S " & p, true)
elif detectOs(Void):
result = ("xbps-install " & p, true)
else: else:
result = ("<your package manager here> install " & p, true) result = ("<your package manager here> install " & p, true)
elif defined(haiku): elif defined(haiku):