Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to set custom fusermount path #616

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ GLIB_TESTS
FLATPAK_BUILDER_VERSION=flatpak_builder_version
AC_SUBST(FLATPAK_BUILDER_VERSION)

AC_DEFINE([FUSERMOUNT], ["fusermount"], [Path to fusermount binary])

AC_CONFIG_FILES([
Makefile
data/Makefile
Expand Down
9 changes: 8 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ project(
'flatpak-builder',
'c',
license: 'LGPL-2.1-or-later',
meson_version: '>= 0.56.2',
meson_version: '>= 0.62.0',
version: '1.4.4',
default_options: 'c_std=gnu99',
)
Expand Down Expand Up @@ -44,6 +44,13 @@ debugedit = find_program('debugedit', version: '>= 5.0')
appstreamcli = find_program('appstreamcli', version: '>= 0.15.0')
appstreamcli_compose = run_command(appstreamcli, ['compose', '--help'], check: true)

fusermount = get_option('system_fusermount')
if fusermount == ''
fusermount_program = find_program(['fusermount3', 'fusermount'], required: true)
else
fusermount_program = find_program(fusermount, required: true)
endif

subdir('src')
subdir('doc')
if get_option('tests')
Expand Down
11 changes: 5 additions & 6 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ option(
description: 'Whether to build and run unit tests'
)
option(
'fuse',
type: 'combo',
choices: ['2', '3', 'compatible'],
value: 'compatible',
description: 'Target a specific version of FUSE for best performance or support multiple versions'
)
'system_fusermount',
type: 'string',
description: 'system fusermount executable, or empty string to try multiple names (fusermount3, fusermount) automatically',
value: '',
)
6 changes: 2 additions & 4 deletions src/builder-context.c
Original file line number Diff line number Diff line change
Expand Up @@ -839,8 +839,7 @@ static char *rofiles_unmount_path = NULL;
static void
rofiles_umount_handler (int signum)
{
char *argv[] = { "fusermount", "-uz", NULL,
NULL };
char *argv[] = { FUSERMOUNT, "-uz", NULL, NULL };

argv[2] = rofiles_unmount_path;
g_debug ("Unmounting read-only fs: %s %s %s", argv[0], argv[1], argv[2]);
Expand Down Expand Up @@ -979,8 +978,7 @@ gboolean
builder_context_disable_rofiles (BuilderContext *self,
GError **error)
{
char *argv[] = { "fusermount", "-u", NULL,
NULL };
char *argv[] = { FUSERMOUNT, "-u", NULL, NULL };

if (!self->use_rofiles)
return TRUE;
Expand Down
3 changes: 2 additions & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ config_data.set('GLIB_VERSION_MIN_REQUIRED', 'GLIB_VERSION_2_66')
# We support targeting specific fuse versions to optimize performance.
# Currently only fuse2 has optimizations but this allows for future fuse3
# optimizations.
config_data.set('ASSUME_FUSE_2', get_option('fuse') == '2')
config_data.set('ASSUME_FUSE_2', fusermount_program.version().version_compare('< 3.0.0'))
config_data.set_quoted('FUSERMOUNT', fusermount_program.full_path())

config_h = configure_file(
configuration: config_data,
Expand Down
6 changes: 5 additions & 1 deletion tests/libtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ else
test_builddir=$(dirname $0)
fi

if [ -z "${FUSERMOUNT}" ]; then
FUSERMOUNT=fusermount
fi
Comment on lines +33 to +35
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably better to do the equivalent of flatpak/flatpak#5751


assert_not_reached () {
echo $@ 1>&2; exit 1
}
Expand Down Expand Up @@ -296,7 +300,7 @@ run_sh () {
# fuse support is needed (and the kernel module needs to be loaded) for several
# flatpak-builder tests
skip_without_fuse () {
if [ ! -w /dev/fuse ] || ! command -v fusermount >/dev/null; then
if [ ! -w /dev/fuse ] || ! command -v "$FUSERMOUNT" >/dev/null; then
echo "1..0 # SKIP this test requires fuse support"
exit 0
fi
Expand Down
1 change: 1 addition & 0 deletions tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ test_env.set('FLATPAK_TESTS_DEBUG', '1')
test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
test_env.prepend('PATH', meson.current_build_dir() / '..' / 'src', separator: ':')
test_env.set('FUSERMOUNT', fusermount_program.full_path())

test_names = [
'test-builder',
Expand Down
Loading