flatpak-builder: 1.2.3 -> 1.4.2

This commit is contained in:
arthsmn 2024-01-09 08:59:10 -03:00 committed by arthsmn
parent 44dc371f12
commit c0aefced56
No known key found for this signature in database
3 changed files with 71 additions and 45 deletions

View file

@ -3,18 +3,18 @@
, substituteAll , substituteAll
, nixosTests , nixosTests
, autoreconfHook , docbook_xml_dtd_45
, docbook_xml_dtd_412
, docbook_xml_dtd_42
, docbook_xml_dtd_43
, docbook_xsl , docbook_xsl
, gettext , gettext
, libxml2 , libxml2
, libxslt , libxslt
, pkg-config , pkg-config
, xmlto , xmlto
, meson
, ninja
, acl , acl
, appstream
, breezy , breezy
, binutils , binutils
, bzip2 , bzip2
@ -36,23 +36,24 @@
, libyaml , libyaml
, ostree , ostree
, patch , patch
, python2
, rpm , rpm
, unzip , unzip
, attr
}: }:
let let
installed_testdir = "${placeholder "installedTests"}/libexec/installed-tests/flatpak-builder"; installed_testdir = "${placeholder "installedTests"}/libexec/installed-tests/flatpak-builder";
installed_test_metadir = "${placeholder "installedTests"}/share/installed-tests/flatpak-builder"; in stdenv.mkDerivation (finalAttrs: {
in stdenv.mkDerivation rec {
pname = "flatpak-builder"; pname = "flatpak-builder";
version = "1.2.3"; version = "1.4.2";
outputs = [ "out" "doc" "man" "installedTests" ]; 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 { src = fetchurl {
url = "https://github.com/flatpak/flatpak-builder/releases/download/${version}/${pname}-${version}.tar.xz"; # TODO: remove the '-fixed-libglnx' in the next release
sha256 = "sha256-4leCWkf3o+ceMPsPgPLZrG5IAfdG9VLfrw5WTj7jUcg="; 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 = [ patches = [
@ -76,19 +77,17 @@ in stdenv.mkDerivation rec {
euelfcompress = "${elfutils}/bin/eu-elfcompress"; 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 { (substituteAll {
src = ./fix-test-paths.patch; src = ./fix-test-paths.patch;
inherit glibcLocales; inherit glibcLocales;
# FIXME use python3 for tests that rely on python2
# inherit python2;
}) })
./fix-test-prefix.patch
]; ];
nativeBuildInputs = [ nativeBuildInputs = [
autoreconfHook meson
docbook_xml_dtd_43 ninja
docbook_xml_dtd_45
docbook_xsl docbook_xsl
gettext gettext
libxml2 libxml2
@ -99,6 +98,7 @@ in stdenv.mkDerivation rec {
buildInputs = [ buildInputs = [
acl acl
appstream
bzip2 bzip2
curl curl
debugedit debugedit
@ -113,14 +113,9 @@ in stdenv.mkDerivation rec {
ostree ostree
]; ];
configureFlags = [ mesonFlags = [
"--enable-installed-tests" "-Dinstalled_tests=true"
"--with-system-debugedit" "-Dinstalled_test_prefix=${placeholder "installedTests"}"
];
makeFlags = [
"installed_testdir=${installed_testdir}"
"installed_test_metadir=${installed_test_metadir}"
]; ];
# Some scripts used by tests need to use shebangs that are available in Flatpak runtimes. # 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 # Installed tests
postFixup = '' 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 patchShebangs $file
done done
''; '';
@ -139,8 +134,10 @@ in stdenv.mkDerivation rec {
installedTestsDependencies = [ installedTestsDependencies = [
gnupg gnupg
ostree ostree
# FIXME python2
gnumake gnumake
attr
libxml2
appstream
]; ];
tests = { tests = {
@ -152,7 +149,7 @@ in stdenv.mkDerivation rec {
description = "Tool to build flatpaks from source"; description = "Tool to build flatpaks from source";
homepage = "https://github.com/flatpak/flatpak-builder"; homepage = "https://github.com/flatpak/flatpak-builder";
license = licenses.lgpl21Plus; license = licenses.lgpl21Plus;
maintainers = with maintainers; [ ]; maintainers = with maintainers; [ arthsmn ];
platforms = platforms.linux; platforms = platforms.linux;
}; };
} })

View file

@ -43,28 +43,28 @@ index ef517adb..6ab095f0 100644
return res; return res;
diff --git a/src/builder-source-archive.c b/src/builder-source-archive.c 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 --- a/src/builder-source-archive.c
+++ b/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_list ap;
va_start (ap, error); va_start (ap, error);
- res = flatpak_spawn (dir, NULL, 0, error, "tar", ap); - res = flatpak_spawn (dir, NULL, 0, error, "tar", ap);
+ res = flatpak_spawn (dir, NULL, 0, error, "@tar@", ap); + res = flatpak_spawn (dir, NULL, 0, error, "@tar@", ap);
va_end (ap); va_end (ap);
return res; return res;
@@ -458,7 +458,7 @@ unzip (GFile *dir, @@ -496,7 +496,7 @@ unzip (GFile *dir,
va_list ap; GError **error)
{
va_start (ap, error); gboolean res;
- res = flatpak_spawn (dir, NULL, 0, error, "unzip", ap); - const char *argv[] = { "unzip", "-q", zip_path, NULL };
+ res = flatpak_spawn (dir, NULL, 0, error, "@unzip@", ap); + const char *argv[] = { "@unzip@", "-q", zip_path, NULL };
va_end (ap);
res = flatpak_spawnv (dir, NULL, 0, error, argv, NULL);
return res;
@@ -483,7 +483,7 @@ unrpm (GFile *dir, @@ -522,7 +522,7 @@ unrpm (GFile *dir,
GError **error) GError **error)
{ {
gboolean res; gboolean res;
@ -73,14 +73,14 @@ index 3c694e57..0de62318 100644
"sh", /* shell's $0 */ "sh", /* shell's $0 */
rpm_path, /* shell's $1 */ rpm_path, /* shell's $1 */
NULL }; NULL };
@@ -631,7 +631,7 @@ git (GFile *dir, @@ -677,7 +677,7 @@ git (GFile *dir,
va_list ap; va_list ap;
va_start (ap, error); va_start (ap, error);
- res = flatpak_spawn (dir, NULL, 0, error, "git", ap); - res = flatpak_spawn (dir, NULL, 0, error, "git", ap);
+ res = flatpak_spawn (dir, NULL, 0, error, "@git@", ap); + res = flatpak_spawn (dir, NULL, 0, error, "@git@", ap);
va_end (ap); va_end (ap);
return res; return res;
diff --git a/src/builder-source-bzr.c b/src/builder-source-bzr.c diff --git a/src/builder-source-bzr.c b/src/builder-source-bzr.c
index ceeec94a..8abe6f53 100644 index ceeec94a..8abe6f53 100644

View file

@ -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')