From c0aefced56ec456fa83682fa7647e419dc373468 Mon Sep 17 00:00:00 2001 From: arthsmn Date: Tue, 9 Jan 2024 08:59:10 -0300 Subject: [PATCH] flatpak-builder: 1.2.3 -> 1.4.2 --- .../tools/flatpak-builder/default.nix | 53 +++++++++---------- .../tools/flatpak-builder/fix-paths.patch | 34 ++++++------ .../flatpak-builder/fix-test-prefix.patch | 29 ++++++++++ 3 files changed, 71 insertions(+), 45 deletions(-) create mode 100644 pkgs/development/tools/flatpak-builder/fix-test-prefix.patch diff --git a/pkgs/development/tools/flatpak-builder/default.nix b/pkgs/development/tools/flatpak-builder/default.nix index c3c59f1b2ba8..65c21b083f75 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,24 @@ , 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.2"; 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="; + # TODO: remove the '-fixed-libglnx' in the next release + url = "https://github.com/flatpak/flatpak-builder/releases/download/${finalAttrs.version}/flatpak-builder-${finalAttrs.version}-fixed-libglnx.tar.xz"; + hash = "sha256-wEG5dOA6LC082oig7+Hs9p+a30KhdY6sNB1VXnedBZY="; }; patches = [ @@ -76,19 +77,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 +98,7 @@ in stdenv.mkDerivation rec { buildInputs = [ acl + appstream bzip2 curl debugedit @@ -113,14 +113,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. @@ -130,7 +125,7 @@ in stdenv.mkDerivation rec { # Installed tests postFixup = '' - for file in ${installed_testdir}/{test-builder.sh,test-builder-python.sh}; do + for file in ${installed_testdir}/{test-builder.sh,test-builder-python.sh,test-builder-deprecated.sh}; do patchShebangs $file done ''; @@ -139,8 +134,10 @@ in stdenv.mkDerivation rec { installedTestsDependencies = [ gnupg ostree - # FIXME python2 gnumake + attr + libxml2 + appstream ]; tests = { @@ -152,7 +149,7 @@ in stdenv.mkDerivation rec { description = "Tool to build flatpaks from source"; homepage = "https://github.com/flatpak/flatpak-builder"; license = licenses.lgpl21Plus; - maintainers = with maintainers; [ ]; + maintainers = with maintainers; [ arthsmn ]; platforms = platforms.linux; }; -} +}) diff --git a/pkgs/development/tools/flatpak-builder/fix-paths.patch b/pkgs/development/tools/flatpak-builder/fix-paths.patch index c0df2c6cbe7e..10b630156681 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 000000000000..fcfc5dcaddcf --- /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')