1 |
Closes: https://bugs.gentoo.org/771708 |
2 |
Reported-by: Sergey Torokhov <torokhov-s-a@××××××.ru> |
3 |
Suggested-by: Ionen Wolkens <sudinave@×××××.com> |
4 |
Signed-off-by: Ulrich Müller <ulm@g.o> |
5 |
--- |
6 |
v2: Insert counter after executable name, not after package name. |
7 |
See https://bugs.gentoo.org/771708#c9 for rationale. |
8 |
|
9 |
eclass/desktop.eclass | 13 ++++++++++--- |
10 |
1 file changed, 10 insertions(+), 3 deletions(-) |
11 |
|
12 |
diff --git a/eclass/desktop.eclass b/eclass/desktop.eclass |
13 |
index 7d5c0f0f9a26..82e764e2a1a4 100644 |
14 |
--- a/eclass/desktop.eclass |
15 |
+++ b/eclass/desktop.eclass |
16 |
@@ -1,4 +1,4 @@ |
17 |
-# Copyright 1999-2020 Gentoo Authors |
18 |
+# Copyright 1999-2021 Gentoo Authors |
19 |
# Distributed under the terms of the GNU General Public License v2 |
20 |
|
21 |
# @ECLASS: desktop.eclass |
22 |
@@ -162,8 +162,15 @@ make_desktop_entry() { |
23 |
else |
24 |
local desktop_name="${PN}-${slot}" |
25 |
fi |
26 |
- local desktop="${exec%%[[:space:]]*}" |
27 |
- desktop="${T}/${desktop##*/}-${desktop_name}.desktop" |
28 |
+ local desktop_exec="${exec%%[[:space:]]*}" |
29 |
+ desktop_exec="${desktop_exec##*/}" |
30 |
+ |
31 |
+ # Prevent collisions if a file with the same name already exists #771708 |
32 |
+ local desktop="${desktop_exec}-${desktop_name}" count=0 |
33 |
+ while [[ -e ${ED}/usr/share/applications/${desktop}.desktop ]]; do |
34 |
+ desktop="${desktop_exec}-$((++count))-${desktop_name}" |
35 |
+ done |
36 |
+ desktop="${T}/${desktop}.desktop" |
37 |
|
38 |
# Don't append another ";" when a valid category value is provided. |
39 |
type=${type%;}${type:+;} |
40 |
-- |
41 |
2.30.1 |