diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 40c5e870..1fafa612 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,10 +17,8 @@ jobs: python-version: "3.13" - name: Install toolchain run: | - pip install setuptools wheel pip install -r requirements-dev.txt - pip install gitpython freebsd_sysctl==0.0.7 - pip install --no-build-isolation jail==0.0.12 + pip install -r requirements.txt - name: Run static checks run: sh scripts/check.sh @@ -34,10 +32,7 @@ jobs: python-version: "3.13" - name: Install dependencies run: | - pip install setuptools wheel - pip install -r requirements-test.txt - pip install gitpython freebsd_sysctl==0.0.7 - pip install --no-build-isolation jail==0.0.12 + pip install -r requirements.txt -r requirements-test.txt - name: Run the platform-independent tests run: pytest --cov=libioc --cov-report=term @@ -76,6 +71,6 @@ jobs: uses: gronke/freebsd-ci/.github/actions/run@main with: run: | - /root/venv/bin/pip install -q --no-build-isolation -r requirements.txt -r requirements-test.txt - /root/venv/bin/pip install -q --no-build-isolation -e . + /root/venv/bin/pip install -q -r requirements.txt -r requirements-test.txt + /root/venv/bin/pip install -q -e . /root/venv/bin/pytest tests --zpool ioc-test diff --git a/libioc/JailParams.py b/libioc/JailParams.py index c79a61f3..ec87c319 100644 --- a/libioc/JailParams.py +++ b/libioc/JailParams.py @@ -160,8 +160,11 @@ def __update_sysctl_jail_params(self) -> None: self.__base_class(prefix).children ) # permanently store the queried sysctl in the singleton class + # cast for mypy: Sysctl.children constructs type(self), so the + # items are JailParam instances at runtime while the upstream + # annotation stays with the base class JailParams.__sysctl_params = dict([ - (x.name.rstrip("."), x,) + (x.name.rstrip("."), typing.cast(JailParam, x),) for x in jail_params ]) diff --git a/requirements.txt b/requirements.txt index 44da16ed..375347e3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ gitpython -freebsd_sysctl==0.0.7 -jail==0.0.12 +freebsd_sysctl @ git+https://github.com/gronke/py-freebsd_sysctl.git@92f6cf5dd4cab3a9b7e4ef04c4ca0dbeec74e181 +jail @ git+https://github.com/gronke/py-jail.git@8f935ed34e447216599e4f8964c64c89c708ad40 diff --git a/stubs/freebsd_sysctl/__init__.pyi b/stubs/freebsd_sysctl/__init__.pyi deleted file mode 100644 index 0249fc37..00000000 --- a/stubs/freebsd_sysctl/__init__.pyi +++ /dev/null @@ -1,65 +0,0 @@ -import typing - -import freebsd_sysctl.types - -NULL_BYTES: bytes -CTL_MAXNAME: int -T_OID: typing.Any -BUFSIZ: int - -class Sysctl: - def __init__( - self, - name: str | None = None, - oid: list[int] | None = None, - ) -> None: ... - @property - def oid(self) -> list[int]: ... - @property - def name(self) -> str: ... - @property - def kind(self) -> int: ... - @property - def fmt(self) -> bytes: ... - @property - def size(self) -> int: ... - @property - def raw_value(self) -> freebsd_sysctl.types.CtlType: ... - @property - def value(self) -> typing.Any: ... - @property - def description(self) -> str: ... - # next and children instantiate self.__class__, not plain Sysctl - @property - def next(self) -> typing.Self: ... - @property - def children(self) -> typing.Iterator[typing.Self]: ... - @staticmethod - def name2oid(name: str) -> list[int]: ... - @staticmethod - def oid2name(oid: list[int]) -> str: ... - @staticmethod - def query_fmt(oid: list[int]) -> bytes: ... - @staticmethod - def query_size( - oid: list[int], - ctl_type: type[freebsd_sysctl.types.CtlType], - ) -> bytes: ... - @staticmethod - def query_value( - oid: list[int], - size: int, - ctl_type: type[freebsd_sysctl.types.CtlType], - ) -> bytes: ... - @staticmethod - def query_description(oid: list[int]) -> str: ... - @staticmethod - def query_next(oid: list[int]) -> bytes: ... - @property - def ctl_type(self) -> type[freebsd_sysctl.types.CtlType]: ... - @staticmethod - def get_ctl_type( - kind: int, - fmt: bytes, - ) -> type[freebsd_sysctl.types.CtlType]: ... - def has_flag(self, flag: int) -> bool: ... diff --git a/stubs/freebsd_sysctl/flags.pyi b/stubs/freebsd_sysctl/flags.pyi deleted file mode 100644 index d12f6e95..00000000 --- a/stubs/freebsd_sysctl/flags.pyi +++ /dev/null @@ -1,20 +0,0 @@ -RD: int -WR: int -RW: int -DORMANT: int -ANYBODY: int -SECURE: int -PRISON: int -DYN: int -SKIP: int -TUN: int -RDTUN: int -RWTUN: int -MPSAFE: int -VNET: int -DYING: int -CAPRD: int -CAPWR: int -STATS: int -NOFETCH: int -CAPRW: int diff --git a/stubs/freebsd_sysctl/libc.pyi b/stubs/freebsd_sysctl/libc.pyi deleted file mode 100644 index e8dc7363..00000000 --- a/stubs/freebsd_sysctl/libc.pyi +++ /dev/null @@ -1,4 +0,0 @@ -import ctypes - -clib: str -dll: ctypes.CDLL diff --git a/stubs/freebsd_sysctl/types.pyi b/stubs/freebsd_sysctl/types.pyi deleted file mode 100644 index 01477211..00000000 --- a/stubs/freebsd_sysctl/types.pyi +++ /dev/null @@ -1,62 +0,0 @@ -import ctypes -import typing - -class CtlType: - min_size: int - data: bytes - ctype: type | None - unpack_format: str | None - size: int - def __init__(self, data: bytes, size: int) -> None: ... - @property - def amount(self) -> int: ... - @property - def value(self) -> typing.Any: ... - -class NODE(CtlType): - ctype: type[ctypes.c_uint] - -class INT(CtlType): - ctype: type[ctypes.c_int] - -class STRING(CtlType): - @property - def value(self) -> str: ... - -class S64(CtlType): - ctype: type[ctypes.c_int64] - -class STRUCT(CtlType): ... -class OPAQUE(CtlType): ... - -class UINT(CtlType): - ctype: type[ctypes.c_uint] - -class LONG(CtlType): - ctype: type[ctypes.c_long] - -class ULONG(CtlType): - ctype: type[ctypes.c_ulong] - -class U64(CtlType): - ctype: type[ctypes.c_uint64] - -class U8(CtlType): - ctype: type[ctypes.c_uint8] - -class U16(CtlType): - ctype: type[ctypes.c_uint16] - -class S8(CtlType): - ctype: type[ctypes.c_int8] - -class S16(CtlType): - ctype: type[ctypes.c_int16] - -class S32(CtlType): - ctype: type[ctypes.c_int32] - -class U32(CtlType): - ctype: type[ctypes.c_uint32] - -def identify_type(kind: int, fmt: bytes) -> type[CtlType]: ... diff --git a/tools/vm/50-run-tests.sh b/tools/vm/50-run-tests.sh index 2441da5b..b8566365 100755 --- a/tools/vm/50-run-tests.sh +++ b/tools/vm/50-run-tests.sh @@ -29,8 +29,8 @@ rsync -a --delete \ "${REPO_DIR}/" root@127.0.0.1:/root/libioc/ echo "Installing libioc into the guest venv." -run_guest 'cd /root/libioc && /root/venv/bin/pip install -q --no-build-isolation -r requirements.txt -r requirements-test.txt' -run_guest 'cd /root/libioc && /root/venv/bin/pip install -q --no-build-isolation -e .' +run_guest 'cd /root/libioc && /root/venv/bin/pip install -q -r requirements.txt -r requirements-test.txt' +run_guest 'cd /root/libioc && /root/venv/bin/pip install -q -e .' case "${TIER}" in tier0)