Accepting request 640264 from GNOME:Next

- Add meson-Fix-handling-generated-desktop-files.patch: Fix
  handling generated .desktop files.
- Add meson-Fix-handling-generated-desktop-files.patch: Fix
  handling generated .desktop files.

OBS-URL: https://build.opensuse.org/request/show/640264
OBS-URL: https://build.opensuse.org/package/show/devel:tools:building/meson?expand=0&rev=111
This commit is contained in:
Alexei Sorokin 2018-10-06 14:18:19 +00:00 committed by Git OBS Bridge
parent 08cc2d1f0b
commit 5493e1453a
5 changed files with 137 additions and 1 deletions

View File

@ -0,0 +1,116 @@
From 2ff69b20df0864182fdf2b146d29dc67d0cb9a5b Mon Sep 17 00:00:00 2001
From: Jussi Pakkanen <jpakkane@gmail.com>
Date: Mon, 1 Oct 2018 20:31:48 +0300
Subject: [PATCH] Fix handling generated .desktop files. Closes #4304.
---
mesonbuild/modules/i18n.py | 22 ++++++++++---------
.../6 gettext/generated/desktopgenerator.py | 9 ++++++++
.../6 gettext/generated/meson.build | 14 ++++++++++++
.../generated/something.desktop.in.in | 15 +++++++++++++
test cases/frameworks/6 gettext/meson.build | 1 +
5 files changed, 51 insertions(+), 10 deletions(-)
create mode 100644 test cases/frameworks/6 gettext/generated/desktopgenerator.py
create mode 100644 test cases/frameworks/6 gettext/generated/meson.build
create mode 100644 test cases/frameworks/6 gettext/generated/something.desktop.in.in
diff --git a/mesonbuild/modules/i18n.py b/mesonbuild/modules/i18n.py
index 0fc052b778..8b5e18162f 100644
--- a/mesonbuild/modules/i18n.py
+++ b/mesonbuild/modules/i18n.py
@@ -82,17 +82,19 @@ def merge_file(self, state, args, kwargs):
kwargs['command'] = command
inputfile = kwargs['input']
- if isinstance(inputfile, str):
- inputfile = mesonlib.File.from_source_file(state.environment.source_dir,
+ if hasattr(inputfile, 'held_object'):
+ ct = build.CustomTarget(kwargs['output'] + '_merge', state.subdir, state.subproject, kwargs)
+ else:
+ if isinstance(inputfile, str):
+ inputfile = mesonlib.File.from_source_file(state.environment.source_dir,
state.subdir, inputfile)
- output = kwargs['output']
- ifile_abs = inputfile.absolute_path(state.environment.source_dir,
- state.environment.build_dir)
- values = mesonlib.get_filenames_templates_dict([ifile_abs], None)
- outputs = mesonlib.substitute_values([output], values)
- output = outputs[0]
-
- ct = build.CustomTarget(output + '_' + state.subdir + '_merge', state.subdir, state.subproject, kwargs)
+ output = kwargs['output']
+ ifile_abs = inputfile.absolute_path(state.environment.source_dir,
+ state.environment.build_dir)
+ values = mesonlib.get_filenames_templates_dict([ifile_abs], None)
+ outputs = mesonlib.substitute_values([output], values)
+ output = outputs[0]
+ ct = build.CustomTarget(output + '_' + state.subdir + '_merge', state.subdir, state.subproject, kwargs)
return ModuleReturnValue(ct, [ct])
@FeatureNewKwargs('i18n.gettext', '0.37.0', ['preset'])
diff --git a/test cases/frameworks/6 gettext/generated/desktopgenerator.py b/test cases/frameworks/6 gettext/generated/desktopgenerator.py
new file mode 100644
index 0000000000..150ed0435f
--- /dev/null
+++ b/test cases/frameworks/6 gettext/generated/desktopgenerator.py
@@ -0,0 +1,9 @@
+#!/usr/bin/env python3
+
+import sys, shutil
+
+ifile = sys.argv[1]
+ofile = sys.argv[2]
+
+os.unlink(ofile)
+shutil.copy(ifile, ofile)
diff --git a/test cases/frameworks/6 gettext/generated/meson.build b/test cases/frameworks/6 gettext/generated/meson.build
new file mode 100644
index 0000000000..02e61ba352
--- /dev/null
+++ b/test cases/frameworks/6 gettext/generated/meson.build
@@ -0,0 +1,14 @@
+dgen = find_program('desktopgenerator.py')
+
+desktop_in_file = custom_target('something.desktop.in',
+ input : ['something.desktop.in.in'],
+ output : 'something.desktop.in',
+ command : [dgen, '@INPUT@', '@OUTPUT@'],
+)
+
+i18n.merge_file(
+ input : desktop_in_file,
+ output : 'something.desktop',
+ type : 'desktop',
+ po_dir : '../po',
+)
diff --git a/test cases/frameworks/6 gettext/generated/something.desktop.in.in b/test cases/frameworks/6 gettext/generated/something.desktop.in.in
new file mode 100644
index 0000000000..e2094fdc22
--- /dev/null
+++ b/test cases/frameworks/6 gettext/generated/something.desktop.in.in
@@ -0,0 +1,15 @@
+[Desktop Entry]
+Name=Something doer
+Comment=Do something
+# Translators: Search terms to find this application. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
+Keywords=zip;tar;extract;unpack;
+TryExec=file-roller
+Exec=file-roller %U
+StartupNotify=true
+Terminal=false
+Type=Application
+# Translators: Do NOT translate or transliterate this text (this is an icon file name)!
+Icon=something
+Categories=GTK;GNOME;Utility
+X-GNOME-DocPath=file-roller/file-roller.xml
+X-GNOME-UsesNotifications=true
diff --git a/test cases/frameworks/6 gettext/meson.build b/test cases/frameworks/6 gettext/meson.build
index 9b84856060..09ef9829eb 100644
--- a/test cases/frameworks/6 gettext/meson.build
+++ b/test cases/frameworks/6 gettext/meson.build
@@ -15,3 +15,4 @@ subdir('po')
subdir('src')
subdir('data')
subdir('data2')
+subdir('generated')

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Oct 5 22:21:26 UTC 2018 - bjorn.lie@gmail.com
- Add meson-Fix-handling-generated-desktop-files.patch: Fix
handling generated .desktop files.
-------------------------------------------------------------------
Mon Oct 1 09:53:58 UTC 2018 - Dominique Leuenberger <dimstar@opensuse.org>

View File

@ -43,6 +43,9 @@ Patch2: meson-suse-fix-llvm-3.8.patch
Patch3: meson-restore-python3.4.patch
# PATCH-FIX-OPENSUSE meson-fix-gcc48.patch sor.alexei@meowr.ru -- Fix GCC 4.8 handling for openSUSE Leap 42.x.
Patch4: meson-fix-gcc48.patch
# PATCH-FIX-UPSTREAM meson-Fix-handling-generated-desktop-files.patch -- Fix handling generated .desktop files
Patch5: meson-Fix-handling-generated-desktop-files.patch
BuildRequires: python3-base
BuildRequires: python3-setuptools
BuildArch: noarch
@ -137,6 +140,7 @@ This package provides support for meson.build files in Vim.
%patch3 -p1
%patch4 -p1
%endif
%patch5 -p1
# Remove static boost tests from test cases/frameworks/1 boost (can't use patch due to spaces in dirname)
sed -i "/static/d" test\ cases/frameworks/1\ boost/meson.build

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Oct 5 22:21:26 UTC 2018 - bjorn.lie@gmail.com
- Add meson-Fix-handling-generated-desktop-files.patch: Fix
handling generated .desktop files.
-------------------------------------------------------------------
Mon Oct 1 09:53:58 UTC 2018 - Dominique Leuenberger <dimstar@opensuse.org>

View File

@ -1,5 +1,5 @@
#
# spec file for package meson
# spec file for package meson-testsuite
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
@ -43,6 +43,9 @@ Patch2: meson-suse-fix-llvm-3.8.patch
Patch3: meson-restore-python3.4.patch
# PATCH-FIX-OPENSUSE meson-fix-gcc48.patch sor.alexei@meowr.ru -- Fix GCC 4.8 handling for openSUSE Leap 42.x.
Patch4: meson-fix-gcc48.patch
# PATCH-FIX-UPSTREAM meson-Fix-handling-generated-desktop-files.patch -- Fix handling generated .desktop files
Patch5: meson-Fix-handling-generated-desktop-files.patch
BuildRequires: python3-base
BuildRequires: python3-setuptools
BuildArch: noarch
@ -137,6 +140,7 @@ This package provides support for meson.build files in Vim.
%patch3 -p1
%patch4 -p1
%endif
%patch5 -p1
# Remove static boost tests from test cases/frameworks/1 boost (can't use patch due to spaces in dirname)
sed -i "/static/d" test\ cases/frameworks/1\ boost/meson.build