diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm index aa7c69baba..efd2ba9d76 100644 --- a/gnu/packages/erlang-xyz.scm +++ b/gnu/packages/erlang-xyz.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2024, 2025 Igor Goryachev +;;; Copyright © 2025 Giacomo Leidi ;;; ;;; This file is part of GNU Guix. ;;; @@ -32,6 +33,28 @@ #:use-module (guix packages) #:use-module (guix utils)) +(define-public erlang-binpp + (package + (name "erlang-binpp") + (version "1.1.1") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/jtendo/binpp") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 "1dv7mg0j6q4vs4bcp14df3q1y3if58dskca98wmnsrbwkibkn6vp")) + (patches (search-patches "erlang-binpp-disable-failing-tests.patch")))) + (build-system rebar-build-system) + (synopsis "Erlang Binary Pretty Printer") + (description "@code{Binpp} will use @code{io:format} to output the formatted +binary by default. However there are options making @code{pprint} functions +return formatted data instead of performing direct IO write.") + (home-page "https://hexdocs.pm/binpp/") + (license license:wtfpl2))) + (define-public erlang-luerl (package (name "erlang-luerl") diff --git a/gnu/packages/patches/erlang-binpp-disable-failing-tests.patch b/gnu/packages/patches/erlang-binpp-disable-failing-tests.patch new file mode 100644 index 0000000000..ba567b3e0a --- /dev/null +++ b/gnu/packages/patches/erlang-binpp-disable-failing-tests.patch @@ -0,0 +1,73 @@ +From 4ee37e2617e3de954113d64046fce7566dd39910 Mon Sep 17 00:00:00 2001 +From: Giacomo Leidi +Date: Tue, 17 Sep 2024 03:11:47 +0200 +Subject: [PATCH] These tests fail on current Guix. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + + binpp: -print_bucket_test_/0-fun-4- (Print 00FF)...*failed* +in function binpp:'-print_bucket_test_/0-fun-4-'/3 (/tmp/guix-build-erlang-binpp-1.1.1.drv-0/src/binpp.erl, line 290) +in call from eunit_test:run_testfun/1 (eunit_test.erl, line 72) +in call from eunit_proc:run_test/1 (eunit_proc.erl, line 544) +in call from eunit_proc:with_timeout/3 (eunit_proc.erl, line 369) +in call from eunit_proc:handle_test/2 (eunit_proc.erl, line 527) +in call from eunit_proc:tests_inorder/3 (eunit_proc.erl, line 469) +in call from eunit_proc:with_timeout/3 (eunit_proc.erl, line 359) +in call from eunit_proc:run_group/2 (eunit_proc.erl, line 583) +**error:{assertEqual,[{module,binpp}, + {line,290}, + {expression,"F ( I )"}, + {expected,["00 FF ", + 32,".ÿ","\n"]}, + {value,["00 FF ",32, + ".ÿ",10]}]} + output:<<"">> + + binpp: -print_bucket_test_/0-fun-4- (Print 41414141414141414141414141414141)...*failed* +in function binpp:'-print_bucket_test_/0-fun-4-'/3 (/tmp/guix-build-erlang-binpp-1.1.1.drv-0/src/binpp.erl, line 290) +in call from eunit_test:run_testfun/1 (eunit_test.erl, line 72) +in call from eunit_proc:run_test/1 (eunit_proc.erl, line 544) +in call from eunit_proc:with_timeout/3 (eunit_proc.erl, line 369) +in call from eunit_proc:handle_test/2 (eunit_proc.erl, line 527) +in call from eunit_proc:tests_inorder/3 (eunit_proc.erl, line 469) +in call from eunit_proc:with_timeout/3 (eunit_proc.erl, line 359) +in call from eunit_proc:run_group/2 (eunit_proc.erl, line 583) +**error:{assertEqual,[{module,binpp}, + {line,290}, + {expression,"F ( I )"}, + {expected,["41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 ", + 32,"AAAAAAAAAAAAAAAA","\n"]}, + {value,["41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 ",32, + "AAAAAAAAAAAAAAAA",10]}]} + output:<<"">> +--- + src/binpp.erl | 12 ------------ + 1 file changed, 12 deletions(-) + +diff --git a/src/binpp.erl b/src/binpp.erl +index ec5f8cf..4ec98e4 100644 +--- a/src/binpp.erl ++++ b/src/binpp.erl +@@ -278,18 +278,6 @@ diff_test_() -> + [ { <<"Diff">>, fun() -> ?assertEqual({ok, R}, F(I1, I2)) end } + || { {I1, I2}, R } <- Tests ]. + +-print_bucket_test_() -> +- F = fun print_bucket/1, +- Tests = [ +- { ["00", "FF"], +- ["00 FF ", ?SPACE, [?SPECIAL, 255], "\n"] }, +- +- { ["41" || _ <- lists:seq(1, 16) ], +- ["41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 ", ?SPACE, [$A || _ <- lists:seq(1, 16)], "\n"] } +- ], +- [ { iolist_to_binary(["Print ", I]), fun() -> ?assertEqual(R, F(I)) end } +- || { I, R } <- Tests ]. +- + print_buckets_test_() -> + F = fun print_buckets/1, + Tests = [ +-- +2.46.0 +