From 0a66dddf1604bdfd313ccd8e5070e4352f3efc6d Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Wed, 23 Oct 2024 18:34:21 +0800 Subject: [PATCH 1/3] isa-l: modernize (small refactoring) --- pkgs/development/libraries/isa-l/default.nix | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pkgs/development/libraries/isa-l/default.nix b/pkgs/development/libraries/isa-l/default.nix index 6ae04b0b267d..ad8fc62e1c16 100644 --- a/pkgs/development/libraries/isa-l/default.nix +++ b/pkgs/development/libraries/isa-l/default.nix @@ -1,13 +1,13 @@ { lib, stdenv, fetchFromGitHub, autoreconfHook, nasm }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "isa-l"; version = "2.31.0"; src = fetchFromGitHub { owner = "intel"; repo = "isa-l"; - rev = "v${version}"; + rev = "v${finalAttrs.version}"; sha256 = "sha256-xBBtpjtWyba0DogdLobtuWmiiAHTXMK4oRnjYuTUCNk="; }; @@ -17,13 +17,13 @@ stdenv.mkDerivation rec { export AS=nasm ''; - meta = with lib; { + meta = { description = "Collection of optimised low-level functions targeting storage applications"; mainProgram = "igzip"; - license = licenses.bsd3; + license = lib.licenses.bsd3; homepage = "https://github.com/intel/isa-l"; - maintainers = with maintainers; [ jbedo ]; - platforms = platforms.all; + maintainers = with lib.maintainers; [ jbedo ]; + platforms = lib.platforms.all; broken = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64; # does not build on M1 mac (asm/hwcap.h file not found) maybe needs gcc not clang? }; -} +}) From a2c82e129f63b3905742b8ff053fcc2921222aee Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Thu, 24 Oct 2024 02:03:21 +0800 Subject: [PATCH 2/3] isa-l: 2.31.0 -> 2.31.0-unstable-2024-04-25 and fix on aarch64-darwin Bump to an unstable version to include several Aarch64- and Aarch64-Darwin-related fixes. --- pkgs/development/libraries/isa-l/default.nix | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkgs/development/libraries/isa-l/default.nix b/pkgs/development/libraries/isa-l/default.nix index ad8fc62e1c16..8e7c04621917 100644 --- a/pkgs/development/libraries/isa-l/default.nix +++ b/pkgs/development/libraries/isa-l/default.nix @@ -2,13 +2,13 @@ stdenv.mkDerivation (finalAttrs: { pname = "isa-l"; - version = "2.31.0"; + version = "2.31.0-unstable-2024-04-25"; src = fetchFromGitHub { owner = "intel"; repo = "isa-l"; - rev = "v${finalAttrs.version}"; - sha256 = "sha256-xBBtpjtWyba0DogdLobtuWmiiAHTXMK4oRnjYuTUCNk="; + rev = "dbaf284e112bea1b90983772a3164e794b923aaf"; + sha256 = "sha256-eM1K3uObb4eZq0nSfafltp5DuZIDwknUYj9CdLn14lY="; }; nativeBuildInputs = [ nasm autoreconfHook ]; @@ -24,6 +24,5 @@ stdenv.mkDerivation (finalAttrs: { homepage = "https://github.com/intel/isa-l"; maintainers = with lib.maintainers; [ jbedo ]; platforms = lib.platforms.all; - broken = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64; # does not build on M1 mac (asm/hwcap.h file not found) maybe needs gcc not clang? }; }) From 137e9abd990f91096f5dc16e9022970539f077b6 Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Wed, 23 Oct 2024 18:41:53 +0800 Subject: [PATCH 3/3] isa-l: add package tests for igzip Test the compression and decompression functionality of igzip. --- pkgs/development/libraries/isa-l/default.nix | 38 +++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/isa-l/default.nix b/pkgs/development/libraries/isa-l/default.nix index 8e7c04621917..6a53990b7823 100644 --- a/pkgs/development/libraries/isa-l/default.nix +++ b/pkgs/development/libraries/isa-l/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchFromGitHub, autoreconfHook, nasm }: +{ lib, stdenv, fetchFromGitHub, runCommand, autoreconfHook, nix, nasm }: stdenv.mkDerivation (finalAttrs: { pname = "isa-l"; @@ -17,6 +17,42 @@ stdenv.mkDerivation (finalAttrs: { export AS=nasm ''; + passthru = { + tests = { + igzip = runCommand "test-isa-l-igzip" { + nativeBuildInputs = [ + finalAttrs.finalPackage + ]; + sample = runCommand "nixpkgs-lib.nar" { + nativeBuildInputs = [ nix ]; + } '' + nix nar --extra-experimental-features nix-command pack ${../../../../lib} > "$out" + ''; + meta = { + description = "Cross validation of igzip provided by isa-l with gzip"; + }; + } '' + HASH_ORIGINAL="$(cat "$sample" | sha256sum | cut -d" " -f1)" + HASH_COMPRESSION_TEST="$(igzip -c "$sample" | gzip -d -c | sha256sum | cut -d" " -f1)" + HASH_DECOMPRESSION_TEST="$(gzip -c "$sample" | igzip -d -c | sha256sum | cut -d" " -f1)" + if [[ "$HASH_COMPRESSION_TEST" != "$HASH_ORIGINAL" ]] || [[ "$HASH_DECOMPRESSION_TEST" != "$HASH_ORIGINAL" ]]; then + if [[ "HASH_COMPRESSION_TEST" != "$HASH_ORIGINAL" ]]; then + echo "The igzip-compressed file does not decompress to the original file." 1>&2 + fi + if [[ "HASH_DECOMPRESSION_TEST" != "$HASH_ORIGINAL" ]]; then + echo "igzip does not decompress the gzip-compressed archive to the original file." 1>&2 + fi + echo "SHA256 checksums:" 1>&2 + printf ' original file:\t%s\n' "$HASH_ORIGINAL" 1>&2 + printf ' compression test:\t%s\n' "$HASH_COMPRESSION_TEST" 1>&2 + printf ' decompression test:\t%s\n' "$HASH_DECOMPRESSION_TEST" 1>&2 + exit 1 + fi + touch "$out" + ''; + }; + }; + meta = { description = "Collection of optimised low-level functions targeting storage applications"; mainProgram = "igzip";