diff --git a/src/builder-manifest.c b/src/builder-manifest.c index 9304587d..2c275131 100644 --- a/src/builder-manifest.c +++ b/src/builder-manifest.c @@ -2783,6 +2783,22 @@ builder_manifest_cleanup (BuilderManifest *self, } } + if (builder_context_get_separate_locales (context)) + { + g_autoptr(GFile) root_dir = NULL; + + if (builder_context_get_build_runtime (context)) + root_dir = g_file_get_child (app_dir, "usr"); + else + root_dir = g_file_get_child (app_dir, "files"); + + if (!builder_migrate_locale_dirs (root_dir, error)) + { + g_prefix_error (error, "Can't migrate locale dirs: "); + return FALSE; + } + } + app_root = g_file_get_child (app_dir, "files"); appdata_source = builder_manifest_find_appdata_file (self, app_root); diff --git a/src/builder-module.c b/src/builder-module.c index d1a7aa55..8d5d92b5 100644 --- a/src/builder-module.c +++ b/src/builder-module.c @@ -2178,22 +2178,6 @@ builder_module_build_helper (BuilderModule *self, return FALSE; } - if (builder_context_get_separate_locales (context)) - { - g_autoptr(GFile) root_dir = NULL; - - if (builder_context_get_build_runtime (context)) - root_dir = g_file_get_child (app_dir, "usr"); - else - root_dir = g_file_get_child (app_dir, "files"); - - if (!builder_migrate_locale_dirs (root_dir, error)) - { - g_prefix_error (error, "module %s: ", self->name); - return FALSE; - } - } - if (!builder_module_install_licenses (self, id, source_dir, app_dir, error)) return FALSE; diff --git a/tests/meson.build b/tests/meson.build index c1fda2cb..2addf09e 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -123,6 +123,7 @@ if get_option('installed_tests') 'org.flatpak.appstream_media.json', 'org.test.Hello-256.png', 'org.flatpak.install_test.json', + 'test-locale-cleanup.json', install_dir: installed_testdir, install_mode: 'rw-r--r--', diff --git a/tests/test-builder.sh b/tests/test-builder.sh index 16407856..13792a26 100755 --- a/tests/test-builder.sh +++ b/tests/test-builder.sh @@ -23,7 +23,7 @@ set -euo pipefail skip_without_fuse -echo "1..11" +echo "1..12" setup_repo install_repo @@ -56,6 +56,7 @@ cp $(dirname $0)/org.test.Hello.png . cp $(dirname $0)/org.test.Hello-256.png . cp $(dirname $0)/org.flatpak.appstream_media.json . cp $(dirname $0)/org.flatpak.install_test.json . +cp $(dirname $0)/test-locale-cleanup.json . mkdir include1 cp $(dirname $0)/module1.json include1/ cp $(dirname $0)/module1.yaml include1/ @@ -184,3 +185,10 @@ echo "$REFS" | grep -q "org\.flatpak\.install_test\.Debug" echo "$REFS" | grep -q "org\.flatpak\.install_test\.Locale" echo "ok install" + +${FLATPAK_BUILDER} --repo=$REPO --force-clean appdir test-locale-cleanup.json >&2 + +assert_not_has_file appdir/files/share/runtime/locale/es/share/es/testA.mo +assert_has_file appdir/files/share/runtime/locale/es/share/es/testB.mo + +echo "ok testB's locale survives after testA's cleanup" diff --git a/tests/test-locale-cleanup.json b/tests/test-locale-cleanup.json new file mode 100644 index 00000000..6ef36e26 --- /dev/null +++ b/tests/test-locale-cleanup.json @@ -0,0 +1,26 @@ +{ + "app-id": "org.test.LocaleCleanup", + "runtime": "org.test.Platform", + "sdk": "org.test.Sdk", + "modules": [ + { + "name": "testA", + "cleanup": [ + "/share/locale" + ], + "buildsystem": "simple", + "build-commands": [ + "mkdir -p /app/share/locale/es", + "touch /app/share/locale/es/testA.mo" + ] + }, + { + "name": "testB", + "buildsystem": "simple", + "build-commands": [ + "mkdir -p /app/share/locale/es", + "touch /app/share/locale/es/testB.mo" + ] + } + ] +}