From c0aada1e1fc8ae2f7e0fe51f7e4938a03a055d52 Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Sun, 27 Sep 2015 07:02:10 +0300 Subject: [PATCH 1/4] rpm: Hack fix finding libpython when compiling for Python 3 Currently, building RPM with `python = python3` causes this: checking for a Python interpreter with version >= 2.6... python3 checking for python3... /nix/store/dykqxnrwiz9drlcv2wy8lpvl3xvklx0g-python3-3.4.3/bin/python3 checking for python3 version... 3.4 checking for Python.h... yes checking for library containing Py_Main... no configure: error: missing python library That comes from this snippet in configure.ac: AC_SEARCH_LIBS([Py_Main],[python${PYTHON_VERSION} python],[ WITH_PYTHON_LIB="$ac_res" ],[AC_MSG_ERROR([missing python library]) ]) So it's looking for (e.g) `libpython3.4.so` wheras we have `libpython3.4m.so`. Patching the configure script to match seems to make that work (although I don't really understand what the heck is this 'm' business about). --- pkgs/tools/package-management/rpm/default.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/tools/package-management/rpm/default.nix b/pkgs/tools/package-management/rpm/default.nix index ef7b9995296..7b5281220fa 100644 --- a/pkgs/tools/package-management/rpm/default.nix +++ b/pkgs/tools/package-management/rpm/default.nix @@ -16,6 +16,11 @@ stdenv.mkDerivation rec { NIX_CFLAGS_LINK = "-L${elfutils}/lib"; + postPatch = '' + # For Python3, the original expression evaluates as 'python3.4' but we want 'python3.4m' here + substituteInPlace configure --replace 'python''${PYTHON_VERSION}' ${python.executable} + ''; + configureFlags = "--with-external-db --without-lua --enable-python"; meta = with stdenv.lib; { From f5b6ced7ec77303acadc85dbe3f112dec665c4ea Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Sun, 27 Sep 2015 07:05:27 +0300 Subject: [PATCH 2/4] pythonPackages.tlsh: init at 3.4.1 This C extension is a bit funky since it needs cmake to be run to generate some header file before it can be built. --- pkgs/top-level/python-packages.nix | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 45b8aec62fd..62e820c782b 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -21111,6 +21111,29 @@ in modules // { }; }; + tlsh = buildPythonPackage rec { + name = "tlsh-3.4.1"; + src = pkgs.fetchFromGitHub { + owner = "trendmicro"; + repo = "tlsh"; + rev = "b319aed6a270cc765347296b442820c495018833"; + sha256 = "08ysniihvidcyvh9zip64wwvj7mvxvsqs60ci8cxj28f1ip0n8wg"; + }; + buildInputs = with pkgs; [ cmake ]; + preConfigure = '' + mkdir build + cd build + cmake .. + cd ../py_ext + ''; + meta = with stdenv.lib; { + description = "Trend Micro Locality Sensitive Hash"; + homepage = https://github.com/trendmicro/tlsh; + license = licenses.asl20; + platforms = platforms.linux; + }; + }; + toposort = buildPythonPackage rec { name = "toposort-${version}"; version = "1.1"; From 7e85fdc6df8bd280bb01a50285ae35e3afa9bc85 Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Sun, 27 Sep 2015 07:10:25 +0300 Subject: [PATCH 3/4] diffoscope: 29 -> 44 Relevant changes: - Python version switched to Python 3 - ssdeep library got replaced with tlsh - the 'magic' Python package got replaced with a different one - Minor build system improvements == less work for us --- pkgs/tools/misc/diffoscope/default.nix | 15 ++++++--------- pkgs/top-level/all-packages.nix | 5 ++++- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pkgs/tools/misc/diffoscope/default.nix b/pkgs/tools/misc/diffoscope/default.nix index e6c672d8344..f91cd143633 100644 --- a/pkgs/tools/misc/diffoscope/default.nix +++ b/pkgs/tools/misc/diffoscope/default.nix @@ -5,33 +5,30 @@ pythonPackages.buildPythonPackage rec { name = "diffoscope-${version}"; - version = "29"; + version = "44"; namePrefix = ""; src = fetchgit { url = "git://anonscm.debian.org/reproducible/diffoscope.git"; rev = "refs/tags/${version}"; - sha256 = "0q7hx2wm9gvzl1f7iilr9pjwpv8i2anscqan7cgk80v90s2pakrf"; + sha256 = "1sisdmh1bl62b16yfjy9mxxdfzhskrabp0l3pl1kxn7db0c4vpac"; }; postPatch = '' - # Different pkg name in debian - sed -i setup.py -e "s@'magic'@'Magic-file-extensions'@" - # Upstream doesn't provide a PKG-INFO file - sed -i setup.py -e "/'rpm',/d" + sed -i setup.py -e "/'rpm-python',/d" ''; - # Still missing these tools: ghc javap showttf sng - propagatedBuildInputs = (with pythonPackages; [ debian libarchive-c magic ssdeep ]) ++ + # Still missing these tools: enjarify ghc img2txt javap otool(maybe OS X only) ppudump showttf sng + # Also these libraries: python3-guestfs + propagatedBuildInputs = (with pythonPackages; [ debian libarchive-c python_magic tlsh ]) ++ [ acl binutils bzip2 cdrkit cpio diffutils e2fsprogs file gettext gnupg gzip pdftk poppler_utils rpm sqlite squashfsTools unzip vim xz ]; doCheck = false; # Calls 'mknod' in squashfs tests, which needs root postInstall = '' - mv $out/bin/diffoscope.py $out/bin/diffoscope mkdir -p $out/share/man/man1 ${docutils}/bin/rst2man.py debian/diffoscope.1.rst $out/share/man/man1/diffoscope.1 ''; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 986004c5642..03709f72803 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1285,7 +1285,10 @@ let di = callPackage ../tools/system/di { }; - diffoscope = callPackage ../tools/misc/diffoscope { }; + diffoscope = callPackage ../tools/misc/diffoscope { + pythonPackages = python3Packages; + rpm = rpm.override { python = python3; }; + }; diffstat = callPackage ../tools/text/diffstat { }; From eae60d2f40cc561c83fe30da221fa7964aa9969f Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Wed, 23 Dec 2015 23:40:59 +0200 Subject: [PATCH 4/4] diffoscope: Add more tools to the runtime path --- pkgs/tools/misc/diffoscope/default.nix | 10 +++++----- pkgs/top-level/all-packages.nix | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pkgs/tools/misc/diffoscope/default.nix b/pkgs/tools/misc/diffoscope/default.nix index f91cd143633..7fe21e8b347 100644 --- a/pkgs/tools/misc/diffoscope/default.nix +++ b/pkgs/tools/misc/diffoscope/default.nix @@ -1,6 +1,6 @@ { stdenv, fetchgit, pythonPackages, docutils -, acl, binutils, bzip2, cdrkit, cpio, diffutils, e2fsprogs, file, gettext -, gnupg, gzip, pdftk, poppler_utils, rpm, sqlite, squashfsTools, unzip, vim, xz +, acl, binutils, bzip2, cbfstool, cdrkit, cpio, diffutils, e2fsprogs, file, fpc, gettext, ghc, gnupg1 +, gzip, jdk, libcaca, mono, pdftk, poppler_utils, rpm, sng, sqlite, squashfsTools, unzip, vim, xz }: pythonPackages.buildPythonPackage rec { @@ -20,11 +20,11 @@ pythonPackages.buildPythonPackage rec { sed -i setup.py -e "/'rpm-python',/d" ''; - # Still missing these tools: enjarify ghc img2txt javap otool(maybe OS X only) ppudump showttf sng + # Still missing these tools: enjarify otool(maybe OS X only) showttf # Also these libraries: python3-guestfs propagatedBuildInputs = (with pythonPackages; [ debian libarchive-c python_magic tlsh ]) ++ - [ acl binutils bzip2 cdrkit cpio diffutils e2fsprogs file gettext gnupg - gzip pdftk poppler_utils rpm sqlite squashfsTools unzip vim xz ]; + [ acl binutils bzip2 cbfstool cdrkit cpio diffutils e2fsprogs file fpc gettext ghc gnupg1 + gzip jdk libcaca mono pdftk poppler_utils rpm sng sqlite squashfsTools unzip vim xz ]; doCheck = false; # Calls 'mknod' in squashfs tests, which needs root diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 03709f72803..3dd1d8e74bf 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1286,6 +1286,7 @@ let di = callPackage ../tools/system/di { }; diffoscope = callPackage ../tools/misc/diffoscope { + jdk = jdk7; pythonPackages = python3Packages; rpm = rpm.override { python = python3; }; };