Skip to content

Commit

Permalink
Merge branch 'ubuntu-deps'
Browse files Browse the repository at this point in the history
  • Loading branch information
rootmos committed Oct 28, 2023
2 parents 064e2bc + dbf0a00 commit c2329f7
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 2 deletions.
24 changes: 22 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,34 @@ on:
branches: [ main ]

jobs:
deps:
strategy:
matrix:
distro: [ "alpine:latest", "ubuntu:latest", "debian:latest", "archlinux:latest" ]
arch: [ amd64, i386 ]
runs-on: ubuntu-latest
container:
image: ${{ matrix.distro }}
steps:
- name: Install essentials
run: apk add python3

- name: Check out repository code
uses: actions/checkout@v4

- name: Install dependencies
run: ./openbsd deps --install --arch=${{ matrix.arch }}

base:
needs:
- deps
strategy:
matrix:
version: [ 7.3, 7.4 ]
arch: [ amd64, i386 ]
runs-on: ubuntu-latest
container:
image: alpine:3.18.4
image: alpine:latest
env:
OPENBSD_CACHE: /tmp/cache
WORKDIR: /${{github.job}}-${{github.run_id}}-${{github.run_number}}-${{github.run_attempt}}
Expand Down Expand Up @@ -64,7 +84,7 @@ jobs:
OPENBSD_CACHE: /tmp/cache
WORKDIR: /${{github.job}}-${{github.run_id}}-${{github.run_number}}-${{github.run_attempt}}
container:
image: alpine:3.18.4
image: alpine:latest

steps:
- name: Install essentials
Expand Down
36 changes: 36 additions & 0 deletions openbsd
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,22 @@ class Situation:
self._installer = [ pacman, "-S" ]
return

apt_get = shutil.which("apt-get")
if apt_get:
guess = platform.freedesktop_os_release()
self.logger.debug(f"here be Debians: {guess}")

distro = guess["ID"]
if distro == "ubuntu":
self._distro = distro
if distro == "debian":
self._distro = distro
else:
raise RuntimeError(f"unconfigured debian-like distro: {distro}")

self._installer = [ apt_get, "install", "--yes", "--no-install-recommends" ]
return

raise RuntimeError("unable to figure out distribution")

@property
Expand All @@ -228,12 +244,20 @@ class Situation:
pkg = "qemu-system-x86_64"
elif self.distro == "archlinux":
pkg = "qemu-system-x86"
elif self.distro == "ubuntu":
pkg = "qemu-system-x86"
elif self.distro == "debian":
pkg = "qemu-system-x86"
elif arch == "x86" or arch == "i386":
cmd = "qemu-system-i386"
if self.distro == "alpine":
pkg = "qemu-system-i386"
elif self.distro == "archlinux":
pkg = "qemu-system-x86"
elif self.distro == "ubuntu":
pkg = "qemu-system-x86"
elif self.distro == "debian":
pkg = "qemu-system-x86"
else:
raise RuntimeError(f"{arch} not configured")

Expand All @@ -259,6 +283,10 @@ class Situation:
pkg = "signify"
elif self.distro == "archlinux":
pkg = "signify"
elif self.distro == "ubuntu":
pkg = "signify"
elif self.distro == "debian":
pkg = "signify"
raise MissingDependency(command=cmd, package=pkg)
return self._signify

Expand All @@ -272,6 +300,10 @@ class Situation:
pkg = "openssh-client-default"
elif self.distro == "archlinux":
pkg = "openssh"
elif self.distro == "ubuntu":
pkg = "openssh-client"
elif self.distro == "debian":
pkg = "openssh-client"
raise MissingDependency(command=cmd, package=pkg)
return [ self._ssh ]

Expand All @@ -285,6 +317,10 @@ class Situation:
pkg = "socat"
elif self.distro == "archlinux":
pkg = "socat"
elif self.distro == "ubuntu":
pkg = "socat"
elif self.distro == "debian":
pkg = "socat"
raise MissingDependency(command=cmd, package=pkg)
return [ self._socat ]

Expand Down

0 comments on commit c2329f7

Please sign in to comment.