Skip to content

Commit

Permalink
flatpak-builder: 1.2.3 -> 1.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
arthsmn committed Mar 3, 2024
1 parent 11cad33 commit 5f82728
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 45 deletions.
53 changes: 25 additions & 28 deletions pkgs/development/tools/flatpak-builder/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 = [
Expand All @@ -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
Expand All @@ -99,6 +98,7 @@ in stdenv.mkDerivation rec {

buildInputs = [
acl
appstream
bzip2
curl
debugedit
Expand All @@ -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.
Expand All @@ -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
'';
Expand All @@ -139,8 +134,10 @@ in stdenv.mkDerivation rec {
installedTestsDependencies = [
gnupg
ostree
# FIXME python2
gnumake
attr
libxml2
appstream
];

tests = {
Expand All @@ -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;
};
}
})
34 changes: 17 additions & 17 deletions pkgs/development/tools/flatpak-builder/fix-paths.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
29 changes: 29 additions & 0 deletions pkgs/development/tools/flatpak-builder/fix-test-prefix.patch
Original file line number Diff line number Diff line change
@@ -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')

0 comments on commit 5f82728

Please sign in to comment.