Skip to content
Merged
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
16 changes: 16 additions & 0 deletions src/builder-manifest.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
16 changes: 0 additions & 16 deletions src/builder-module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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--',
Expand Down
10 changes: 9 additions & 1 deletion tests/test-builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ set -euo pipefail

skip_without_fuse

echo "1..11"
echo "1..12"

setup_repo
install_repo
Expand Down Expand Up @@ -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/
Expand Down Expand Up @@ -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"
26 changes: 26 additions & 0 deletions tests/test-locale-cleanup.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
]
}