From d7441a1328954d8ced3902392beaaba7890709dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Vask=C3=B3?= <1771332+vlaci@users.noreply.github.com> Date: Tue, 11 Feb 2025 17:00:05 +0100 Subject: [PATCH 1/4] ubi_reader: add update script --- pkgs/by-name/ub/ubi_reader/package.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/by-name/ub/ubi_reader/package.nix b/pkgs/by-name/ub/ubi_reader/package.nix index 20c3782e9062..64f5ea97c1e8 100644 --- a/pkgs/by-name/ub/ubi_reader/package.nix +++ b/pkgs/by-name/ub/ubi_reader/package.nix @@ -1,5 +1,6 @@ { fetchFromGitHub, + gitUpdater, lib, python3, }: @@ -23,6 +24,13 @@ python3.pkgs.buildPythonApplication rec { # There are no tests in the source doCheck = false; + passthru = { + updateScript = gitUpdater { + rev-prefix = "v"; + ignoredVersions = "_[a-z]+$"; + }; + }; + meta = { description = "Python scripts capable of extracting and analyzing the contents of UBI and UBIFS images"; homepage = "https://github.com/onekey-sec/ubi_reader"; From 2c280cbd1707e519f5ffa6e9468d9cefb804039e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Vask=C3=B3?= <1771332+vlaci@users.noreply.github.com> Date: Tue, 11 Feb 2025 17:00:18 +0100 Subject: [PATCH 2/4] ubi_reader: 0.8.9 -> 0.8.10 --- pkgs/by-name/ub/ubi_reader/package.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/ub/ubi_reader/package.nix b/pkgs/by-name/ub/ubi_reader/package.nix index 64f5ea97c1e8..469d09422700 100644 --- a/pkgs/by-name/ub/ubi_reader/package.nix +++ b/pkgs/by-name/ub/ubi_reader/package.nix @@ -7,14 +7,15 @@ python3.pkgs.buildPythonApplication rec { pname = "ubi_reader"; - version = "0.8.9"; + version = "0.8.10"; pyproject = true; + disabled = python3.pkgs.pythonOlder "3.9"; src = fetchFromGitHub { owner = "onekey-sec"; repo = "ubi_reader"; rev = "v${version}"; - hash = "sha256-04HwzkonPzzWfX8VE//fMoVv5ggAS+61zx2W8VEUIy4="; + hash = "sha256-fXJiQZ1QWUmkRM+WI8DSIsay9s1w3hKloRuCcUNwZjM="; }; build-system = [ python3.pkgs.poetry-core ]; From 8dd1d47b59b8f33e6241f14a55b181365d762aa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Vask=C3=B3?= <1771332+vlaci@users.noreply.github.com> Date: Thu, 13 Feb 2025 15:12:56 +0100 Subject: [PATCH 3/4] unblob: support easily disabling multiple test parameters --- pkgs/by-name/un/unblob/package.nix | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pkgs/by-name/un/unblob/package.nix b/pkgs/by-name/un/unblob/package.nix index 6bae7389f623..c434a93e4a86 100644 --- a/pkgs/by-name/un/unblob/package.nix +++ b/pkgs/by-name/un/unblob/package.nix @@ -104,12 +104,18 @@ python3.pkgs.buildPythonApplication rec { versionCheckProgramArg = "--version"; - pytestFlagsArray = [ - "--no-cov" - # `disabledTests` swallows the parameters between square brackets - # https://github.com/tytso/e2fsprogs/issues/152 - "-k 'not test_all_handlers[filesystem.extfs]'" - ]; + pytestFlagsArray = + let + # `disabledTests` swallows the parameters between square brackets + disabled = [ + # https://github.com/tytso/e2fsprogs/issues/152 + "test_all_handlers[filesystem.extfs]" + ]; + in + [ + "--no-cov" + "-k 'not ${lib.concatStringsSep " and not " disabled}'" + ]; passthru = { updateScript = gitUpdater { }; From 686715f585670c595c416fff22fa181fa6f30d64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Vask=C3=B3?= <1771332+vlaci@users.noreply.github.com> Date: Thu, 13 Feb 2025 15:13:30 +0100 Subject: [PATCH 4/4] unblob: disable tests which are incompatible with ubi_reader 0.8.10 Test assets have to be updated upstream to match the behavior of current ubi_reader. Should be reverted on next unblob release. --- pkgs/by-name/un/unblob/package.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/by-name/un/unblob/package.nix b/pkgs/by-name/un/unblob/package.nix index c434a93e4a86..9aeb56efc937 100644 --- a/pkgs/by-name/un/unblob/package.nix +++ b/pkgs/by-name/un/unblob/package.nix @@ -110,6 +110,13 @@ python3.pkgs.buildPythonApplication rec { disabled = [ # https://github.com/tytso/e2fsprogs/issues/152 "test_all_handlers[filesystem.extfs]" + + # Should be dropped after upgrading to next version + # Needs https://github.com/onekey-sec/unblob/pull/1128/commits/c6af67f0c6f32fa01d7abbf495eb0293e9184438 + # Unfortunately patches touching LFS stored assets cannot be applied + "test_all_handlers[filesystem.ubi.ubi]" + "test_all_handlers[archive.dlink.encrpted_img]" + "test_all_handlers[archive.dlink.shrs]" ]; in [