From 5fc214cd8a554a75ee8f7fe438694b8b10f49c8c Mon Sep 17 00:00:00 2001 From: Pedro Lamas Date: Sat, 11 Mar 2023 10:55:50 +0000 Subject: [PATCH] Ignore the file '/etc/board-release' (#353) --- src/distro/distro.py | 1 + tests/resources/distros/bttcb1/etc/board-release | 9 +++++++++ tests/resources/distros/bttcb1/etc/os-release | 9 +++++++++ tests/resources/distros/bttcb1/usr/lib/os-release | 9 +++++++++ tests/test_distro.py | 15 +++++++++++++++ 5 files changed, 43 insertions(+) create mode 100644 tests/resources/distros/bttcb1/etc/board-release create mode 100644 tests/resources/distros/bttcb1/etc/os-release create mode 100644 tests/resources/distros/bttcb1/usr/lib/os-release diff --git a/src/distro/distro.py b/src/distro/distro.py index c5d38d1..45660c4 100755 --- a/src/distro/distro.py +++ b/src/distro/distro.py @@ -152,6 +152,7 @@ class InfoDict(TypedDict): "system-release", "plesk-release", "iredmail-release", + "board-release", ) diff --git a/tests/resources/distros/bttcb1/etc/board-release b/tests/resources/distros/bttcb1/etc/board-release new file mode 100644 index 0000000..f79e870 --- /dev/null +++ b/tests/resources/distros/bttcb1/etc/board-release @@ -0,0 +1,9 @@ +# PLEASE DO NOT EDIT THIS FILE +BOARD=h616 +BOARD_NAME="BTT-CB1" +DISTRIBUTION_CODENAME=bullseye +VERSION=2.3.1 +LINUXFAMILY=sun50iw9 +ARCH=arm64 +INITRD_ARCH=arm64 +BRANCH=current \ No newline at end of file diff --git a/tests/resources/distros/bttcb1/etc/os-release b/tests/resources/distros/bttcb1/etc/os-release new file mode 100644 index 0000000..c4f321e --- /dev/null +++ b/tests/resources/distros/bttcb1/etc/os-release @@ -0,0 +1,9 @@ +PRETTY_NAME="BTT-CB1 2.3.1 Bullseye" +NAME="Debian GNU/Linux" +VERSION_ID="11" +VERSION="11 (bullseye)" +VERSION_CODENAME=bullseye +ID=debian +HOME_URL="https://www.debian.org/" +SUPPORT_URL="https://www.debian.org/support" +BUG_REPORT_URL="https://bugs.debian.org/" \ No newline at end of file diff --git a/tests/resources/distros/bttcb1/usr/lib/os-release b/tests/resources/distros/bttcb1/usr/lib/os-release new file mode 100644 index 0000000..08d9428 --- /dev/null +++ b/tests/resources/distros/bttcb1/usr/lib/os-release @@ -0,0 +1,9 @@ +PRETTY_NAME="Debian GNU/Linux 11 (bullseye)" +NAME="Debian GNU/Linux" +VERSION_ID="11" +VERSION="11 (bullseye)" +VERSION_CODENAME=bullseye +ID=debian +HOME_URL="https://www.debian.org/" +SUPPORT_URL="https://www.debian.org/support" +BUG_REPORT_URL="https://bugs.debian.org/" \ No newline at end of file diff --git a/tests/test_distro.py b/tests/test_distro.py index f738cff..e1cf7a0 100644 --- a/tests/test_distro.py +++ b/tests/test_distro.py @@ -522,6 +522,21 @@ def test_altlinux10_os_release(self) -> None: } self._test_outcome(desired_outcome) + def test_bttcb1_os_release(self) -> None: + desired_outcome = { + "id": "debian", + "codename": "bullseye", + "name": "Debian GNU/Linux", + "pretty_name": "BTT-CB1 2.3.1 Bullseye", + "like": "", + "version": "11", + "pretty_version": "11 (bullseye)", + "best_version": "11", + "major_version": "11", + "minor_version": "0", + } + self._test_outcome(desired_outcome) + class TestWithRootDir(TestOSRelease): """Test that a LinuxDistribution can be created using an arbitrary root_dir