diff --git a/pkgs/development/tools/click/dbus-test-runner.patch b/pkgs/development/tools/click/dbus-test-runner.patch deleted file mode 100644 index c705cf99aa7c..000000000000 --- a/pkgs/development/tools/click/dbus-test-runner.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff --git a/click_package/Makefile.am b/click_package/Makefile.am -index 4981d74..9df9e79 100644 ---- a/click_package/Makefile.am -+++ b/click_package/Makefile.am -@@ -1,5 +1,3 @@ --SUBDIRS = tests -- - noinst_SCRIPTS = paths.py - CLEANFILES = $(noinst_SCRIPTS) - -diff --git a/configure.ac b/configure.ac -index 8f4dc9e..adbd366 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -52,8 +52,6 @@ PKG_CHECK_MODULES([SERVICE], [ - AC_SUBST([SERVICE_CFLAGS]) - AC_SUBST([SERVICE_LIBS]) - --AC_CHECK_PROG(DBUS_TEST_RUNNER_CHECK,dbus-test-runner,yes) --AS_IF([test "${DBUS_TEST_RUNNER_CHECK}" != "yes"], [AC_MSG_ERROR([dbus-test-runner not found])]) - AC_CHECK_PROG(GDBUS_CHECK,gdbus,yes) - AS_IF([test "${GDBUS_CHECK}" != "yes"], [AC_MSG_ERROR([gdbus (glib) not found])]) - diff --git a/pkgs/development/tools/click/default.nix b/pkgs/development/tools/click/default.nix index 97950147254c..a2f66c4d8fca 100644 --- a/pkgs/development/tools/click/default.nix +++ b/pkgs/development/tools/click/default.nix @@ -1,9 +1,16 @@ { lib, fetchFromGitLab, + fetchpatch, + stdenv, buildPythonApplication, autoreconfHook, + dbus, + dbus-test-runner, + dpkg, + glib, python-debian, + python-apt, perl, vala, pkg-config, @@ -13,26 +20,34 @@ gobject-introspection, getopt, setuptools, + six, pygobject3, + unittestCheckHook, wrapGAppsHook3, }: -buildPythonApplication { +buildPythonApplication rec { pname = "click"; - version = "unstable-2023-02-22"; + version = "0.5.2"; format = "other"; src = fetchFromGitLab { owner = "ubports"; repo = "development/core/click"; - rev = "aaf2735e8e6cbeaf2e429c70136733513a81718a"; - hash = "sha256-pNu995/w3tbz15QQVdVYBnWnAoZmqWj1DN/5PZZ0iZw="; + rev = version; + hash = "sha256-AV3n6tghvpV/6Ew6Lokf8QAGBIMbHFAnp6G4pefVn+8="; }; postPatch = '' # These should be proper Requires, using the header needs their headers substituteInPlace lib/click/click-*.pc.in \ - --replace 'Requires.private' 'Requires' + --replace-fail 'Requires.private' 'Requires' + + # Don't completely override PKG_CONFIG_PATH + substituteInPlace click_package/tests/Makefile.am \ + --replace-fail 'PKG_CONFIG_PATH=$(top_builddir)/lib/click' 'PKG_CONFIG_PATH=$(top_builddir)/lib/click:$(PKG_CONFIG_PATH)' + + patchShebangs bin/click ''; configureFlags = [ @@ -51,8 +66,15 @@ buildPythonApplication { export PYTHON_INSTALL_FLAGS="--prefix=$out" ''; + strictDeps = true; + + pkgsBuildBuild = [ + pkg-config + ]; + nativeBuildInputs = [ autoreconfHook + dbus-test-runner # Always checking for this perl pkg-config gobject-introspection @@ -61,17 +83,59 @@ buildPythonApplication { wrapGAppsHook3 ]; - # Tests were omitted for time constraint reasons - doCheck = false; + nativeCheckInputs = [ + dbus + dpkg + unittestCheckHook + ]; + + checkInputs = [ + python-apt + six + ]; + + doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; + + preCheck = '' + export HOME=$TMP + + # tests recompile some files for loaded predefines, doesn't use any optimisation level for it + # makes test output harder to read, so make the warning go away + export NIX_CFLAGS_COMPILE+=" -U_FORTIFY_SOURCE" + + for path in $disabledTestPaths; do + rm -v $path + done + ''; + + disabledTestPaths = [ + # From apt: Unable to determine a suitable packaging system type + "click_package/tests/integration/test_signatures.py" + "click_package/tests/test_build.py" + "click_package/tests/test_install.py" + "click_package/tests/test_scripts.py" + ]; enableParallelBuilding = true; patches = [ - # dbus-test-runner not packaged yet, otherwise build-time dependency even when not running tests - ./dbus-test-runner.patch + # Remove when version > 0.5.2 + (fetchpatch { + name = "0001-click-fix-Wimplicit-function-declaration.patch"; + url = "https://gitlab.com/ubports/development/core/click/-/commit/8f654978a12e6f9a0b6ff64296ec5565e3ff5cd0.patch"; + hash = "sha256-kio+DdtuagUNYEosyQY3q3H+dJM3cLQRW9wUKUcpUTY="; + }) + + # Remove when version > 0.5.2 + (fetchpatch { + name = "0002-click-Add-uid_t-and-gid_t-to-the-ctypes-_typemap.patch"; + url = "https://gitlab.com/ubports/development/core/click/-/commit/cbcd23b08b02fa122434e1edd69c2b3dcb6a8793.patch"; + hash = "sha256-QaWRhxO61wAzULVqPLdJrLuBCr3+NhKmQlEPuYq843I="; + }) ]; buildInputs = [ + glib libgee json-glib properties-cpp