Skip to content

Commit a300073

Browse files
TingPingbbhtt
andcommitted
Add ability to set custom fusermount path
This also removes the 'fuse' option as it seems redundant. .version().version_compare requires Meson >= 0.62.0 which is not available in Ubuntu 22.04, so CI for that is dropped Co-authored-by: bbhtt <bbhtt.zn0i8@slmail.me>
1 parent a38eb17 commit a300073

File tree

9 files changed

+42
-13
lines changed

9 files changed

+42
-13
lines changed

.github/workflows/check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
runs-on: ${{ matrix.os }}
2424
strategy:
2525
matrix:
26-
os: ['ubuntu-22.04', 'ubuntu-24.04']
26+
os: ['ubuntu-24.04']
2727
compiler: ['gcc', 'clang']
2828

2929
env:

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ TBD
77
* Drop autotools, the project now only supports building with meson
88
* Prevent writing duplicate groups to metadata file
99
* Disable all filesystem access in flatpak-builder --run sandbox
10+
* Add ability to set custom fusermount path
1011

1112
Changes in 1.4.6
1213
================

meson.build

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ project(
22
'flatpak-builder',
33
'c',
44
license: 'LGPL-2.1-or-later',
5-
meson_version: '>= 0.56.2',
5+
meson_version: '>= 0.62.0',
66
version: '1.5.0',
77
default_options: 'c_std=gnu99',
88
)
@@ -44,6 +44,13 @@ debugedit = find_program('debugedit', version: '>= 5.0')
4444
appstreamcli = find_program('appstreamcli', version: '>= 0.15.0')
4545
appstreamcli_compose = run_command(appstreamcli, ['compose', '--help'], check: true)
4646

47+
fusermount = get_option('system_fusermount')
48+
if fusermount == ''
49+
fusermount_program = find_program(['fusermount3', 'fusermount'], required: true)
50+
else
51+
fusermount_program = find_program(fusermount, required: true)
52+
endif
53+
4754
subdir('src')
4855
subdir('doc')
4956
if get_option('tests')

meson_options.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ option(
2323
description: 'Whether to build and run unit tests'
2424
)
2525
option(
26-
'fuse',
27-
type: 'combo',
28-
choices: ['2', '3', 'compatible'],
29-
value: 'compatible',
30-
description: 'Target a specific version of FUSE for best performance or support multiple versions'
26+
'system_fusermount',
27+
type: 'string',
28+
description: 'system fusermount executable, or empty string to try multiple names (fusermount3, fusermount) automatically',
29+
value: '',
3130
)

src/builder-context.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -854,8 +854,7 @@ static char *rofiles_unmount_path = NULL;
854854
static void
855855
rofiles_umount_handler (int signum)
856856
{
857-
char *argv[] = { "fusermount", "-uz", NULL,
858-
NULL };
857+
char *argv[] = { FUSERMOUNT, "-uz", NULL, NULL };
859858

860859
argv[2] = rofiles_unmount_path;
861860
g_debug ("Unmounting read-only fs: %s %s %s", argv[0], argv[1], argv[2]);
@@ -994,8 +993,7 @@ gboolean
994993
builder_context_disable_rofiles (BuilderContext *self,
995994
GError **error)
996995
{
997-
char *argv[] = { "fusermount", "-u", NULL,
998-
NULL };
996+
char *argv[] = { FUSERMOUNT, "-u", NULL, NULL };
999997

1000998
if (!self->use_rofiles)
1001999
return TRUE;

src/meson.build

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ config_data.set('GLIB_VERSION_MIN_REQUIRED', 'GLIB_VERSION_2_66')
3939
# We support targeting specific fuse versions to optimize performance.
4040
# Currently only fuse2 has optimizations but this allows for future fuse3
4141
# optimizations.
42-
config_data.set('ASSUME_FUSE_2', get_option('fuse') == '2')
42+
config_data.set('ASSUME_FUSE_2', fusermount_program.version().version_compare('< 3.0.0'))
43+
config_data.set_quoted('FUSERMOUNT', fusermount_program.full_path())
4344

4445
config_h = configure_file(
4546
configuration: config_data,

tests/installed-tests.sh.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SPDX-License-Identifier: LGPL-2.1-or-later
2+
3+
FUSERMOUNT='@FUSERMOUNT@'

tests/libtest.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ else
3030
test_builddir=$(dirname $0)
3131
fi
3232

33+
if [ -e "$test_srcdir/installed-tests.sh" ]; then
34+
. "$test_srcdir/installed-tests.sh"
35+
fi
36+
37+
if [ -z "${FUSERMOUNT}" ]; then
38+
FUSERMOUNT=fusermount
39+
fi
40+
3341
assert_not_reached () {
3442
echo $@ 1>&2; exit 1
3543
}
@@ -296,7 +304,7 @@ run_sh () {
296304
# fuse support is needed (and the kernel module needs to be loaded) for several
297305
# flatpak-builder tests
298306
skip_without_fuse () {
299-
if [ ! -w /dev/fuse ] || ! command -v fusermount >/dev/null; then
307+
if [ ! -w /dev/fuse ] || ! command -v "$FUSERMOUNT" >/dev/null; then
300308
echo "1..0 # SKIP this test requires fuse support"
301309
exit 0
302310
fi

tests/meson.build

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ test_env.set('FLATPAK_TESTS_DEBUG', '1')
66
test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
77
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
88
test_env.prepend('PATH', meson.current_build_dir() / '..' / 'src', separator: ':')
9+
test_env.set('FUSERMOUNT', fusermount_program.full_path())
910

1011
test_names = [
1112
'test-builder',
@@ -17,6 +18,17 @@ tap_test = find_program(
1718
files(meson.project_source_root() / 'buildutil/tap-test'),
1819
)
1920

21+
if get_option('installed_tests')
22+
configure_file(
23+
input : 'installed-tests.sh.in',
24+
output : 'installed-tests.sh',
25+
configuration : {
26+
'FUSERMOUNT' : fusermount_program.full_path(),
27+
},
28+
install_dir : installed_testdir,
29+
)
30+
endif
31+
2032
foreach test_name : test_names
2133
filename = test_name + '.sh'
2234

0 commit comments

Comments
 (0)