push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,160 @@
{
lib,
stdenv,
fetchurl,
replaceVars,
nixosTests,
docbook_xml_dtd_45,
docbook_xsl,
gettext,
libxml2,
libxslt,
pkg-config,
xmlto,
meson,
ninja,
acl,
appstream,
breezy,
binutils,
bzip2,
coreutils,
cpio,
curl,
debugedit,
elfutils,
flatpak,
gitMinimal,
glib,
glibcLocales,
gnumake,
gnupg,
gnutar,
json-glib,
libcap,
libyaml,
ostree,
patch,
rpm,
unzip,
attr,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "flatpak-builder";
version = "1.4.4";
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/${finalAttrs.version}/flatpak-builder-${finalAttrs.version}.tar.xz";
hash = "sha256-3CcVk5S6qiy1I/Uvh0Ry/1DRYZgyMyZMoqIuhQdB7Ho=";
};
patches = [
# patch taken from gtk_doc
./respect-xml-catalog-files-var.patch
# Hardcode paths
(replaceVars ./fix-paths.patch {
brz = "${breezy}/bin/brz";
cp = "${coreutils}/bin/cp";
patch = "${patch}/bin/patch";
tar = "${gnutar}/bin/tar";
unzip = "${unzip}/bin/unzip";
rpm2cpio = "${rpm}/bin/rpm2cpio";
cpio = "${cpio}/bin/cpio";
git = "${gitMinimal}/bin/git";
rofilesfuse = "${ostree}/bin/rofiles-fuse";
strip = "${binutils}/bin/strip";
eustrip = "${elfutils}/bin/eu-strip";
euelfcompress = "${elfutils}/bin/eu-elfcompress";
})
(replaceVars ./fix-test-paths.patch {
inherit glibcLocales;
})
./fix-test-prefix.patch
];
nativeBuildInputs = [
meson
ninja
docbook_xml_dtd_45
docbook_xsl
gettext
libxml2
libxslt
pkg-config
xmlto
];
buildInputs = [
acl
appstream
bzip2
curl
debugedit
elfutils
flatpak
glib
json-glib
libcap
libxml2
libyaml
ostree
];
mesonFlags = [
"-Dinstalled_tests=true"
"-Dinstalled_test_prefix=${placeholder "installedTests"}"
];
# Some scripts used by tests need to use shebangs that are available in Flatpak runtimes.
dontPatchShebangs = true;
enableParallelBuilding = true;
# Installed tests
postFixup =
let
installed_testdir = "${placeholder "installedTests"}/libexec/installed-tests/flatpak-builder";
in
''
for file in ${installed_testdir}/{test-builder.sh,test-builder-python.sh,test-builder-deprecated.sh}; do
patchShebangs $file
done
'';
passthru = {
installedTestsDependencies = [
gnupg
ostree
gnumake
attr
libxml2
appstream
];
tests = {
installedTests = nixosTests.installed-tests.flatpak-builder;
};
};
meta = with lib; {
description = "Tool to build flatpaks from source";
mainProgram = "flatpak-builder";
homepage = "https://github.com/flatpak/flatpak-builder";
license = licenses.lgpl21Plus;
maintainers = with maintainers; [ arthsmn ];
platforms = platforms.linux;
};
})

View File

@@ -0,0 +1,151 @@
diff --git a/src/builder-context.c b/src/builder-context.c
index dde12790..3a379297 100644
--- a/src/builder-context.c
+++ b/src/builder-context.c
@@ -256,7 +256,7 @@ builder_context_init (BuilderContext *self)
g_autofree char *path = NULL;
self->rofiles_file_lock = init;
- path = g_find_program_in_path ("rofiles-fuse");
+ path = g_find_program_in_path ("@rofilesfuse@");
self->have_rofiles = path != NULL;
}
@@ -800,7 +800,7 @@ builder_context_enable_rofiles (BuilderContext *self,
g_autoptr(GFile) rofiles_base = NULL;
g_autoptr(GFile) rofiles_dir = NULL;
g_autofree char *tmpdir_name = NULL;
- char *argv[] = { "rofiles-fuse",
+ char *argv[] = { "@rofilesfuse@",
"-o",
"kernel_cache,entry_timeout=60,attr_timeout=60,splice_write,splice_move",
(char *)flatpak_file_get_path_cached (self->app_dir),
diff --git a/src/builder-git.c b/src/builder-git.c
index ef517adb..6ab095f0 100644
--- a/src/builder-git.c
+++ b/src/builder-git.c
@@ -44,7 +44,7 @@ git (GFile *dir,
va_list ap;
va_start (ap, error);
- res = flatpak_spawn (dir, output, flags, error, "git", ap);
+ res = flatpak_spawn (dir, output, flags, error, "@git@", ap);
va_end (ap);
return res;
@@ -58,7 +58,7 @@ cp (GError **error,
va_list ap;
va_start (ap, error);
- res = flatpak_spawn (NULL, NULL, 0, error, "cp", ap);
+ res = flatpak_spawn (NULL, NULL, 0, error, "@cp@", ap);
va_end (ap);
return res;
diff --git a/src/builder-source-archive.c b/src/builder-source-archive.c
index ed66d5b..9ca9486 100644
--- a/src/builder-source-archive.c
+++ b/src/builder-source-archive.c
@@ -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;
@@ -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;
- const gchar *argv[] = { "sh", "-c", "rpm2cpio \"$1\" | cpio -i -d",
+ const gchar *argv[] = { "sh", "-c", "@rpm2cpio@ \"$1\" | @cpio@ -i -d",
"sh", /* shell's $0 */
rpm_path, /* shell's $1 */
NULL };
@@ -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
--- a/src/builder-source-bzr.c
+++ b/src/builder-source-bzr.c
@@ -124,7 +124,7 @@ bzr (GFile *dir,
gboolean res;
va_list ap;
- brz = g_find_program_in_path ("brz");
+ brz = g_find_program_in_path ("@brz@");
va_start (ap, error);
res = flatpak_spawn (dir, output, 0, error, brz ? brz : "bzr", ap);
diff --git a/src/builder-source-patch.c b/src/builder-source-patch.c
index 8721e1e4..d7f4d840 100644
--- a/src/builder-source-patch.c
+++ b/src/builder-source-patch.c
@@ -247,15 +247,15 @@ patch (GFile *dir,
args = g_ptr_array_new ();
if (use_git) {
- g_ptr_array_add (args, "git");
+ g_ptr_array_add (args, "@git@");
g_ptr_array_add (args, "apply");
g_ptr_array_add (args, "-v");
} else if (use_git_am) {
- g_ptr_array_add (args, "git");
+ g_ptr_array_add (args, "@git@");
g_ptr_array_add (args, "am");
g_ptr_array_add (args, "--keep-cr");
} else {
- g_ptr_array_add (args, "patch");
+ g_ptr_array_add (args, "@patch@");
}
for (i = 0; extra_options != NULL && extra_options[i] != NULL; i++)
g_ptr_array_add (args, (gchar *) extra_options[i]);
diff --git a/src/builder-utils.c b/src/builder-utils.c
index f1c06db5..2e3347c5 100644
--- a/src/builder-utils.c
+++ b/src/builder-utils.c
@@ -149,7 +149,7 @@ strip (GError **error,
va_list ap;
va_start (ap, error);
- res = flatpak_spawn (NULL, NULL, 0, error, "strip", ap);
+ res = flatpak_spawn (NULL, NULL, 0, error, "@strip@", ap);
va_end (ap);
return res;
@@ -163,7 +163,7 @@ eu_strip (GError **error,
va_list ap;
va_start (ap, error);
- res = flatpak_spawn (NULL, NULL, 0, error, "eu-strip", ap);
+ res = flatpak_spawn (NULL, NULL, 0, error, "@eustrip@", ap);
va_end (ap);
return res;
@@ -177,7 +177,7 @@ eu_elfcompress (GError **error,
va_list ap;
va_start (ap, error);
- res = flatpak_spawn (NULL, NULL, 0, error, "eu-elfcompress", ap);
+ res = flatpak_spawn (NULL, NULL, 0, error, "@euelfcompress@", ap);
va_end (ap);
return res;

View File

@@ -0,0 +1,111 @@
--- a/tests/libtest.sh
+++ b/tests/libtest.sh
@@ -301,7 +301,7 @@
}
skip_without_python2 () {
- if ! test -f /usr/bin/python2 || ! /usr/bin/python2 -c "import sys; sys.exit(0 if sys.version_info >= (2, 7) else 1)" ; then
+ if true ; then
echo "1..0 # SKIP this test requires /usr/bin/python2 (2.7) support"
exit 0
fi
--- a/tests/make-test-runtime.sh
+++ b/tests/make-test-runtime.sh
@@ -26,6 +26,7 @@
PATH="$PATH:/usr/sbin:/sbin"
# Add bash and dependencies
+mkdir -p ${DIR}/nix/store
mkdir -p ${DIR}/usr/bin
mkdir -p ${DIR}/usr/lib
ln -s ../lib ${DIR}/usr/lib64
@@ -35,73 +36,28 @@
else
cp `which ldconfig` ${DIR}/usr/bin
fi
-LIBS=`mktemp`
-BINS=`mktemp`
-
-add_bin() {
- local f=$1
- shift
-
- if grep -qFe "${f}" $BINS; then
- # Already handled
- return 0
- fi
-
- echo $f >> $BINS
-
- # Add library dependencies
- (ldd "${f}" | sed "s/.* => //" | awk '{ print $1}' | grep ^/ | sort -u -o $LIBS $LIBS -) || true
-
- local shebang=$(sed -n '1s/^#!\([^ ]*\).*/\1/p' "${f}")
- if [ x$shebang != x ]; then
- add_bin "$shebang"
- fi
-}
for i in $@; do
- I=`which $i`
- add_bin $I
- if test $i == python2; then
- mkdir -p ${DIR}/usr/lib/python2.7/lib-dynload
- # This is a hardcoded minimal set of modules we need in the current tests.
- # Pretty hacky stuff. Add modules as needed.
- PYDIR=/usr/lib/python2.7
- if test -d /usr/lib64/python2.7; then PYDIR=/usr/lib64/python2.7; fi
- for py in site os stat posixpath genericpath warnings \
- linecache types UserDict abc _abcoll \
- _weakrefset copy_reg traceback sysconfig \
- re sre_compile sre_parse sre_constants \
- _sysconfigdata ; do
- cp ${PYDIR}/$py.py ${DIR}/usr/lib/python2.7
- done
- # These might not exist, depending how Python was configured; and the
- # part after ${so} might be "module" or ".x86_64-linux-gnu" or
- # something else
- for so in _locale strop ; do
- cp ${PYDIR}/lib-dynload/${so}*.so ${DIR}/usr/lib/python2.7/lib-dynload || :
- done
- for plat in $( cd ${PYDIR} && echo plat-* ); do
- test -e ${PYDIR}/${plat} || continue
- mkdir -p ${DIR}/usr/lib/python2.7/${plat}
- cp ${PYDIR}/${plat}/*.py ${DIR}/usr/lib/python2.7/${plat}/
- done
- fi
-done
-for i in `cat $BINS`; do
- echo Adding binary $i 1>&2
- cp "$i" ${DIR}/usr/bin/
-done
-for i in `cat $LIBS`; do
- echo Adding library $i 1>&2
- cp "$i" ${DIR}/usr/lib/
+ I=$(readlink -f $(which $i))
+ requisites=$(nix-store --query --requisites "$I")
+ for r in $requisites; do
+ # a single store item can be needed by multiple paths, no need to copy it again
+ if [ ! -e ${DIR}/$r ]; then
+ cp -r $r ${DIR}/$r
+ fi
+ done
+ ln -s $I ${DIR}/usr/bin/$i
done
ln -s bash ${DIR}/usr/bin/sh
-# We copy the C.UTF8 locale and call it en_US. Its a bit of a lie, but
-# the real en_US locale is often not available, because its in the
-# local archive.
+mv ${DIR}/nix/store ${DIR}/usr/store # files outside /usr are not permitted, we will have to replace /nix/store with /usr/store
+chmod -R u+w ${DIR} # nix store has read-only directories which would cause problems during clean-up, files need to be writable for sed
+find ${DIR} -type f -print0 | xargs -0 sed -i 's~/nix/store/~/usr/store/~g' # replace hardcoded paths
+find ${DIR} -type l | xargs -I '{}' sh -c 'tg="$(readlink "$1")"; newtg="${tg#/nix/store/}"; if [ "$tg" != "$newtg" ]; then ln -fs "/usr/store/$newtg" "$1"; fi' -- '{}' # replace symlink targets
+
+# We copy the whole locale archive because we do not have C.UTF8 locale
mkdir -p ${DIR}/usr/lib/locale/
-cp -r /usr/lib/locale/C.* ${DIR}/usr/lib/locale/en_US
+cp @glibcLocales@/lib/locale/locale-archive ${DIR}/usr/lib/locale/locale-archive
if [ x$COLLECTION_ID != x ]; then
collection_args=--collection-id=${COLLECTION_ID}

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

View File

@@ -0,0 +1,13 @@
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -40,8 +40,8 @@
[
AC_REQUIRE([JH_PATH_XML_CATALOG],[JH_PATH_XML_CATALOG(,[:])])dnl
AC_MSG_CHECKING([for ifelse([$2],,[$1],[$2]) in XML catalog])
- if $jh_found_xmlcatalog && \
- AC_RUN_LOG([$XMLCATALOG --noout "$XML_CATALOG_FILE" "$1" >&2]); then
+ # empty argument forces libxml to use XML_CATALOG_FILES variable
+ if AC_RUN_LOG([$XMLCATALOG --noout "" "$1" >&2]); then
AC_MSG_RESULT([found])
ifelse([$3],,,[$3
])dnl