From 0d7dc9e3fecf9cb0567371eea3795267bfe7a0f7 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Mon, 17 Jun 2024 09:02:28 +0200 Subject: [PATCH 1/7] babeltrace: reformat with nixfmt-rfc-style - Don't use `meta = with lib;`. - Use (finalAttrs:{}) pattern. - Use lib.enableFeature for debug-info ./configure flag. - Use pkgs/by-name --- pkgs/by-name/ba/babeltrace/package.nix | 52 +++++++++++++++++++ .../tools/misc/babeltrace/default.nix | 32 ------------ pkgs/top-level/all-packages.nix | 2 - 3 files changed, 52 insertions(+), 34 deletions(-) create mode 100644 pkgs/by-name/ba/babeltrace/package.nix delete mode 100644 pkgs/development/tools/misc/babeltrace/default.nix diff --git a/pkgs/by-name/ba/babeltrace/package.nix b/pkgs/by-name/ba/babeltrace/package.nix new file mode 100644 index 000000000000..42f12ed5cf71 --- /dev/null +++ b/pkgs/by-name/ba/babeltrace/package.nix @@ -0,0 +1,52 @@ +{ + lib, + stdenv, + fetchurl, + autoreconfHook, + pkg-config, + glib, + libuuid, + popt, + elfutils, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "babeltrace"; + version = "1.5.8"; + + src = fetchurl { + url = "https://www.efficios.com/files/babeltrace/${finalAttrs.pname}-${finalAttrs.version}.tar.bz2"; + sha256 = "1hkg3phnamxfrhwzmiiirbhdgckzfkqwhajl0lmr1wfps7j47wcz"; + }; + + nativeBuildInputs = [ + # The pre-generated ./configure script uses an old autoconf version which + # breaks cross-compilation (replaces references to malloc with rpl_malloc). + # Re-generate with nixpkgs's autoconf. This requires glib to be present in + # nativeBuildInputs for its m4 macros to be present. + autoreconfHook + glib + pkg-config + ]; + buildInputs = [ + glib + libuuid + popt + elfutils + ]; + + configureFlags = [ + # --enable-debug-info (default) requires the configure script to run host + # executables to determine the elfutils library version, which cannot be done + # while cross compiling. + (lib.enableFeature (stdenv.hostPlatform == stdenv.buildPlatform) "debug-info") + ]; + + meta = { + description = "Command-line tool and library to read and convert LTTng tracefiles"; + homepage = "https://www.efficios.com/babeltrace"; + license = lib.licenses.mit; + platforms = lib.platforms.linux; + maintainers = with lib.maintainers; [ bjornfor ]; + }; +}) diff --git a/pkgs/development/tools/misc/babeltrace/default.nix b/pkgs/development/tools/misc/babeltrace/default.nix deleted file mode 100644 index 014d926eea3d..000000000000 --- a/pkgs/development/tools/misc/babeltrace/default.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ lib, stdenv, fetchurl, autoreconfHook, pkg-config, glib, libuuid, popt, elfutils }: - -stdenv.mkDerivation rec { - pname = "babeltrace"; - version = "1.5.8"; - - src = fetchurl { - url = "https://www.efficios.com/files/babeltrace/${pname}-${version}.tar.bz2"; - sha256 = "1hkg3phnamxfrhwzmiiirbhdgckzfkqwhajl0lmr1wfps7j47wcz"; - }; - - # The pre-generated ./configure script uses an old autoconf version which - # breaks cross-compilation (replaces references to malloc with rpl_malloc). - # Re-generate with nixpkgs's autoconf. This requires glib to be present in - # nativeBuildInputs for its m4 macros to be present. - nativeBuildInputs = [ autoreconfHook glib pkg-config ]; - buildInputs = [ glib libuuid popt elfutils ]; - - # --enable-debug-info (default) requires the configure script to run host - # executables to determine the elfutils library version, which cannot be done - # while cross compiling. - configureFlags = lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "--disable-debug-info"; - - meta = with lib; { - description = "Command-line tool and library to read and convert LTTng tracefiles"; - homepage = "https://www.efficios.com/babeltrace"; - license = licenses.mit; - platforms = platforms.linux; - maintainers = [ maintainers.bjornfor ]; - }; - -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f06962f5fad6..99a4a74e5e27 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -18033,8 +18033,6 @@ with pkgs; b4 = callPackage ../development/tools/b4 { }; - babeltrace = callPackage ../development/tools/misc/babeltrace { }; - bam = callPackage ../development/tools/build-managers/bam { }; bandit = with python3Packages; toPythonApplication bandit; From b0a25eca28580c6751bc65f94f6f465b1386f468 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Sat, 15 Jun 2024 12:07:34 +0200 Subject: [PATCH 2/7] babeltrace: add update script --- pkgs/by-name/ba/babeltrace/package.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/by-name/ba/babeltrace/package.nix b/pkgs/by-name/ba/babeltrace/package.nix index 42f12ed5cf71..6501d9328537 100644 --- a/pkgs/by-name/ba/babeltrace/package.nix +++ b/pkgs/by-name/ba/babeltrace/package.nix @@ -2,6 +2,7 @@ lib, stdenv, fetchurl, + gitUpdater, autoreconfHook, pkg-config, glib, @@ -42,6 +43,13 @@ stdenv.mkDerivation (finalAttrs: { (lib.enableFeature (stdenv.hostPlatform == stdenv.buildPlatform) "debug-info") ]; + passthru.updateScript = gitUpdater { + url = "https://git.efficios.com/babeltrace.git"; + rev-prefix = "v"; + # Versions 2.x are packaged independently as babeltrace2 + ignoredVersions = "^[^1]"; + }; + meta = { description = "Command-line tool and library to read and convert LTTng tracefiles"; homepage = "https://www.efficios.com/babeltrace"; From 460afd473b001af6bd715f6c5f4609e987ac1489 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Mon, 17 Jun 2024 21:50:47 +0300 Subject: [PATCH 3/7] babeltrace: 1.5.8 -> 1.5.11 --- pkgs/by-name/ba/babeltrace/package.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/ba/babeltrace/package.nix b/pkgs/by-name/ba/babeltrace/package.nix index 6501d9328537..3f3dbafb679d 100644 --- a/pkgs/by-name/ba/babeltrace/package.nix +++ b/pkgs/by-name/ba/babeltrace/package.nix @@ -13,11 +13,11 @@ stdenv.mkDerivation (finalAttrs: { pname = "babeltrace"; - version = "1.5.8"; + version = "1.5.11"; src = fetchurl { url = "https://www.efficios.com/files/babeltrace/${finalAttrs.pname}-${finalAttrs.version}.tar.bz2"; - sha256 = "1hkg3phnamxfrhwzmiiirbhdgckzfkqwhajl0lmr1wfps7j47wcz"; + sha256 = "Z7Q6qu9clR+nrxpVfPcgGhH+iYdrfCK6CgPLwxbbWpw="; }; nativeBuildInputs = [ From cd8f5fcd284560cf9749678bf99fcfd74e60f16a Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Sat, 15 Jun 2024 11:45:19 +0200 Subject: [PATCH 4/7] babeltrace: add myself as maintainer --- pkgs/by-name/ba/babeltrace/package.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/ba/babeltrace/package.nix b/pkgs/by-name/ba/babeltrace/package.nix index 3f3dbafb679d..1ae395ab66d8 100644 --- a/pkgs/by-name/ba/babeltrace/package.nix +++ b/pkgs/by-name/ba/babeltrace/package.nix @@ -55,6 +55,9 @@ stdenv.mkDerivation (finalAttrs: { homepage = "https://www.efficios.com/babeltrace"; license = lib.licenses.mit; platforms = lib.platforms.linux; - maintainers = with lib.maintainers; [ bjornfor ]; + maintainers = with lib.maintainers; [ + bjornfor + wentasah + ]; }; }) From e09452b585f9747c3c9d3f12f10b9e836d32e1ca Mon Sep 17 00:00:00 2001 From: hacker1024 Date: Fri, 2 Feb 2024 13:05:16 +1100 Subject: [PATCH 5/7] python311Packages.babeltrace: init at 1.5.11 --- pkgs/by-name/ba/babeltrace/package.nix | 47 ++++++++++++++++++-------- pkgs/top-level/python-packages.nix | 5 +++ 2 files changed, 37 insertions(+), 15 deletions(-) diff --git a/pkgs/by-name/ba/babeltrace/package.nix b/pkgs/by-name/ba/babeltrace/package.nix index 1ae395ab66d8..2d995df59c91 100644 --- a/pkgs/by-name/ba/babeltrace/package.nix +++ b/pkgs/by-name/ba/babeltrace/package.nix @@ -9,6 +9,9 @@ libuuid, popt, elfutils, + enablePython ? false, + pythonPackages ? null, + swig2, }: stdenv.mkDerivation (finalAttrs: { @@ -20,15 +23,20 @@ stdenv.mkDerivation (finalAttrs: { sha256 = "Z7Q6qu9clR+nrxpVfPcgGhH+iYdrfCK6CgPLwxbbWpw="; }; - nativeBuildInputs = [ - # The pre-generated ./configure script uses an old autoconf version which - # breaks cross-compilation (replaces references to malloc with rpl_malloc). - # Re-generate with nixpkgs's autoconf. This requires glib to be present in - # nativeBuildInputs for its m4 macros to be present. - autoreconfHook - glib - pkg-config - ]; + nativeBuildInputs = + [ + # The pre-generated ./configure script uses an old autoconf version which + # breaks cross-compilation (replaces references to malloc with rpl_malloc). + # Re-generate with nixpkgs's autoconf. This requires glib to be present in + # nativeBuildInputs for its m4 macros to be present. + autoreconfHook + glib + pkg-config + ] + ++ lib.optionals enablePython [ + swig2 + pythonPackages.setuptools + ]; buildInputs = [ glib libuuid @@ -36,12 +44,21 @@ stdenv.mkDerivation (finalAttrs: { elfutils ]; - configureFlags = [ - # --enable-debug-info (default) requires the configure script to run host - # executables to determine the elfutils library version, which cannot be done - # while cross compiling. - (lib.enableFeature (stdenv.hostPlatform == stdenv.buildPlatform) "debug-info") - ]; + configureFlags = + [ + # --enable-debug-info (default) requires the configure script to run host + # executables to determine the elfutils library version, which cannot be done + # while cross compiling. + (lib.enableFeature (stdenv.hostPlatform == stdenv.buildPlatform) "debug-info") + ] + ++ lib.optionals enablePython [ + # Using (lib.enableFeature enablePython "python-bindings") makes the + # configure script look for python dependencies even when + # enablePython==false. Adding the configure flag conditionally seems to + # solve this. + "--enable-python-bindings" + ]; + # passthru.updateScript = gitUpdater { url = "https://git.efficios.com/babeltrace.git"; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 928edd66a5f2..d6f074162a26 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1330,6 +1330,11 @@ self: super: with self; { babelgladeextractor = callPackage ../development/python-modules/babelgladeextractor { }; + babeltrace = toPythonModule (pkgs.babeltrace.override { + pythonPackages = self; + enablePython = true; + }); + bambi = callPackage ../development/python-modules/bambi { }; pad4pi = callPackage ../development/python-modules/pad4pi { }; From e4e8867d5b5735a09ee23d21c209de327a073478 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Sat, 15 Jun 2024 15:26:13 +0200 Subject: [PATCH 6/7] babeltrace2: init at 2.0.6 Separate from babeltrace 1.x as "the Babeltrace 2 project is completely independent from Babeltrace 1". https://github.com/efficios/babeltrace/releases/tag/v2.0.0 Co-authored-by: hacker1024 --- pkgs/by-name/ba/babeltrace2/package.nix | 101 ++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 pkgs/by-name/ba/babeltrace2/package.nix diff --git a/pkgs/by-name/ba/babeltrace2/package.nix b/pkgs/by-name/ba/babeltrace2/package.nix new file mode 100644 index 000000000000..ec9f15e679f8 --- /dev/null +++ b/pkgs/by-name/ba/babeltrace2/package.nix @@ -0,0 +1,101 @@ +{ + lib, + stdenv, + fetchFromGitHub, + fetchpatch, + autoreconfHook, + pkg-config, + glib, + elfutils, + bison, + flex, + asciidoc, + xmlto, + docbook_xml_dtd_45, + docbook_xsl, + enablePython ? false, + python ? null, + pythonPackages ? null, + swig, + ensureNewerSourcesForZipFilesHook, +}: + +stdenv.mkDerivation rec { + pname = "babeltrace2"; + version = "2.0.6"; + + src = fetchFromGitHub { + owner = "efficios"; + repo = "babeltrace"; + rev = "v${version}"; + hash = "sha256-L4YTqPxvWynUBnmAQnlJ2RNbEv9MhBxQOsqbWix8ZwU="; + }; + + patches = [ + # Patches needed for Python 3.12 + (fetchpatch { + # python: Use standalone 'sysconfig' module + url = "https://github.com/efficios/babeltrace/commit/452480eb6820df9973d50431a479ca547815ae08.patch"; + hash = "sha256-YgUKHJzdliNUsTY29E0xxcUjqVWn4EvxyTs0B+O+jrI="; + }) + (fetchpatch { + # python: replace distutils with setuptools + url = "https://github.com/efficios/babeltrace/commit/6ec97181a525a3cd64cedbcd0df905ed9e84ba03.patch"; + hash = "sha256-1hlEkPcRUpf2+iEXqHXcCDOaLTg+eaVcahqZlA8m5QY="; + }) + (fetchpatch { + # fix: python: monkey patch the proper sysconfig implementation + url = "https://github.com/efficios/babeltrace/commit/927263e4ea62877af7240cfdb1514ae949dbfc2e.patch"; + hash = "sha256-HNRQ7uw26FUKCQ/my6//OL2xsHdOGlQUq5zIKtg9OGw="; + }) + ]; + + outputs = [ + "out" + "man" + "dev" + ]; + + nativeBuildInputs = + [ + autoreconfHook + pkg-config + glib + bison + flex + asciidoc + xmlto + docbook_xml_dtd_45 + docbook_xsl + ] + ++ lib.optionals enablePython [ + swig + pythonPackages.setuptools + ensureNewerSourcesForZipFilesHook + ]; + + buildInputs = [ + glib + elfutils + ] ++ lib.optional enablePython python; + + configureFlags = [ + (lib.enableFeature enablePython "python-bindings") + (lib.enableFeature enablePython "python-plugins") + (lib.enableFeature (stdenv.hostPlatform == stdenv.buildPlatform) "debug-info") + ]; + + # For cross-compilation of Python bindings + makeFlags = [ "CFLAGS=-Wno-error=stringop-truncation -Wno-error=null-dereference" ]; + + enableParallelBuilding = true; + + meta = { + description = "Babeltrace /ˈbæbəltreɪs/ is an open-source trace manipulation toolkit"; + homepage = "https://babeltrace.org"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ wentasah ]; + mainProgram = "babeltrace2"; + platforms = lib.platforms.all; + }; +} From 68bc018ac27db15269b7cb9744f3ba4a9ed1f47d Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Sat, 15 Jun 2024 15:25:04 +0200 Subject: [PATCH 7/7] python311Packages.babeltrace2: init at 2.0.6 A new attribute overriding babeltrace2 is created, rather than enabling Python support in babeltrace2 itself, in order to reduce the closure size and leave babeltrace2 Python-version-agnostic. Co-authored-by: hacker1024 --- pkgs/top-level/python-packages.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index d6f074162a26..25c356e37674 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1335,6 +1335,12 @@ self: super: with self; { enablePython = true; }); + babeltrace2 = toPythonModule (pkgs.babeltrace2.override { + inherit (self) python; + pythonPackages = self; + enablePython = true; + }); + bambi = callPackage ../development/python-modules/bambi { }; pad4pi = callPackage ../development/python-modules/pad4pi { };