diff --git a/pkgs/development/tools/flatpak-builder/default.nix b/pkgs/development/tools/flatpak-builder/default.nix index c3c59f1b2ba80f3..63194cbc7a77e6e 100644 --- a/pkgs/development/tools/flatpak-builder/default.nix +++ b/pkgs/development/tools/flatpak-builder/default.nix @@ -3,18 +3,18 @@ , substituteAll , nixosTests -, autoreconfHook -, docbook_xml_dtd_412 -, docbook_xml_dtd_42 -, docbook_xml_dtd_43 +, docbook_xml_dtd_45 , docbook_xsl , gettext , libxml2 , libxslt , pkg-config , xmlto +, meson +, ninja , acl +, appstream , breezy , binutils , bzip2 @@ -36,23 +36,23 @@ , libyaml , ostree , patch -, python2 , rpm , unzip +, attr }: let installed_testdir = "${placeholder "installedTests"}/libexec/installed-tests/flatpak-builder"; - installed_test_metadir = "${placeholder "installedTests"}/share/installed-tests/flatpak-builder"; -in stdenv.mkDerivation rec { +in stdenv.mkDerivation (finalAttrs: { pname = "flatpak-builder"; - version = "1.2.3"; + version = "1.4.0"; outputs = [ "out" "doc" "man" "installedTests" ]; + # fetchFromGitHub fetches an archive which does not contain the full source (https://github.com/flatpak/flatpak-builder/issues/558) src = fetchurl { - url = "https://github.com/flatpak/flatpak-builder/releases/download/${version}/${pname}-${version}.tar.xz"; - sha256 = "sha256-4leCWkf3o+ceMPsPgPLZrG5IAfdG9VLfrw5WTj7jUcg="; + url = "https://github.com/flatpak/flatpak-builder/releases/download/${finalAttrs.version}/flatpak-builder-${finalAttrs.version}.tar.xz"; + hash = "sha256-GrwIRfx/MYQSQCnl7TP+DK800ZvuqC6Bioz6usHbDaA="; }; patches = [ @@ -76,19 +76,17 @@ in stdenv.mkDerivation rec { euelfcompress = "${elfutils}/bin/eu-elfcompress"; }) - # The test scripts in Flatpak repo were updated so we are basing - # this on our patch for Flatpak 0.99. (substituteAll { src = ./fix-test-paths.patch; inherit glibcLocales; - # FIXME use python3 for tests that rely on python2 - # inherit python2; }) + ./fix-test-prefix.patch ]; nativeBuildInputs = [ - autoreconfHook - docbook_xml_dtd_43 + meson + ninja + docbook_xml_dtd_45 docbook_xsl gettext libxml2 @@ -99,6 +97,7 @@ in stdenv.mkDerivation rec { buildInputs = [ acl + appstream bzip2 curl debugedit @@ -113,14 +112,9 @@ in stdenv.mkDerivation rec { ostree ]; - configureFlags = [ - "--enable-installed-tests" - "--with-system-debugedit" - ]; - - makeFlags = [ - "installed_testdir=${installed_testdir}" - "installed_test_metadir=${installed_test_metadir}" + mesonFlags = [ + "-Dinstalled_tests=true" + "-Dinstalled_test_prefix=${placeholder "installedTests"}" ]; # Some scripts used by tests need to use shebangs that are available in Flatpak runtimes. @@ -139,8 +133,9 @@ in stdenv.mkDerivation rec { installedTestsDependencies = [ gnupg ostree - # FIXME python2 gnumake + attr + libxml2 ]; tests = { @@ -155,4 +150,4 @@ in stdenv.mkDerivation rec { maintainers = with maintainers; [ ]; platforms = platforms.linux; }; -} +}) diff --git a/pkgs/development/tools/flatpak-builder/fix-paths.patch b/pkgs/development/tools/flatpak-builder/fix-paths.patch index c0df2c6cbe7e13a..10b63015668188f 100644 --- a/pkgs/development/tools/flatpak-builder/fix-paths.patch +++ b/pkgs/development/tools/flatpak-builder/fix-paths.patch @@ -43,28 +43,28 @@ index ef517adb..6ab095f0 100644 return res; diff --git a/src/builder-source-archive.c b/src/builder-source-archive.c -index 3c694e57..0de62318 100644 +index ed66d5b..9ca9486 100644 --- a/src/builder-source-archive.c +++ b/src/builder-source-archive.c -@@ -443,7 +443,7 @@ tar (GFile *dir, +@@ -484,7 +484,7 @@ tar (GFile *dir, va_list ap; - + va_start (ap, error); - res = flatpak_spawn (dir, NULL, 0, error, "tar", ap); + res = flatpak_spawn (dir, NULL, 0, error, "@tar@", ap); va_end (ap); - - return res; -@@ -458,7 +458,7 @@ unzip (GFile *dir, - va_list ap; - - va_start (ap, error); -- res = flatpak_spawn (dir, NULL, 0, error, "unzip", ap); -+ res = flatpak_spawn (dir, NULL, 0, error, "@unzip@", ap); - va_end (ap); - + return res; -@@ -483,7 +483,7 @@ unrpm (GFile *dir, +@@ -496,7 +496,7 @@ unzip (GFile *dir, + GError **error) + { + gboolean res; +- const char *argv[] = { "unzip", "-q", zip_path, NULL }; ++ const char *argv[] = { "@unzip@", "-q", zip_path, NULL }; + + res = flatpak_spawnv (dir, NULL, 0, error, argv, NULL); + +@@ -522,7 +522,7 @@ unrpm (GFile *dir, GError **error) { gboolean res; @@ -73,14 +73,14 @@ index 3c694e57..0de62318 100644 "sh", /* shell's $0 */ rpm_path, /* shell's $1 */ NULL }; -@@ -631,7 +631,7 @@ git (GFile *dir, +@@ -677,7 +677,7 @@ git (GFile *dir, va_list ap; - + va_start (ap, error); - res = flatpak_spawn (dir, NULL, 0, error, "git", ap); + res = flatpak_spawn (dir, NULL, 0, error, "@git@", ap); va_end (ap); - + return res; diff --git a/src/builder-source-bzr.c b/src/builder-source-bzr.c index ceeec94a..8abe6f53 100644 diff --git a/pkgs/development/tools/flatpak-builder/fix-test-prefix.patch b/pkgs/development/tools/flatpak-builder/fix-test-prefix.patch new file mode 100644 index 000000000000000..fcfc5dcaddcf4c9 --- /dev/null +++ b/pkgs/development/tools/flatpak-builder/fix-test-prefix.patch @@ -0,0 +1,29 @@ +diff --git a/meson_options.txt b/meson_options.txt +index d5a0bd22..7d69d3d2 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -22,6 +22,12 @@ option( + value: true, + description: 'Whether to build and run unit tests' + ) ++option( ++ 'installed_test_prefix', ++ type: 'string', ++ value: '', ++ description: 'Prefix for installed tests' ++) + option( + 'fuse', + type: 'combo', +diff --git a/tests/meson.build b/tests/meson.build +index 6ec405d1..f43c165c 100644 +--- a/tests/meson.build ++++ b/tests/meson.build +@@ -1,5 +1,5 @@ +-installed_testdir = get_option('prefix') / get_option('libexecdir') / 'installed-tests' / 'flatpak-builder' +-installed_tests_metadir = get_option('prefix') / get_option('datadir') / 'installed-tests' / 'flatpak-builder' ++installed_testdir = get_option('installed_test_prefix') / get_option('libexecdir') / 'installed-tests' / 'flatpak-builder' ++installed_tests_metadir = get_option('installed_test_prefix') / get_option('datadir') / 'installed-tests' / 'flatpak-builder' + + test_env = environment() + test_env.set('FLATPAK_TESTS_DEBUG', '1')