summaryrefslogtreecommitdiff
path: root/eclass/desktop.eclass
diff options
context:
space:
mode:
Diffstat (limited to 'eclass/desktop.eclass')
-rw-r--r--eclass/desktop.eclass23
1 files changed, 14 insertions, 9 deletions
diff --git a/eclass/desktop.eclass b/eclass/desktop.eclass
index de912bb80932..aa1b9ac68d85 100644
--- a/eclass/desktop.eclass
+++ b/eclass/desktop.eclass
@@ -1,11 +1,17 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: desktop.eclass
# @MAINTAINER:
# base-system@gentoo.org
+# @SUPPORTED_EAPIS: 6 7 8
# @BLURB: support for desktop files, menus, and icons
+case ${EAPI} in
+ 6|7|8) ;;
+ *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
if [[ -z ${_DESKTOP_ECLASS} ]]; then
_DESKTOP_ECLASS=1
@@ -156,19 +162,18 @@ make_desktop_entry() {
;;
esac
fi
- local slot=${SLOT%/*}
- if [[ ${slot} == "0" ]] ; then
- local desktop_name="${PN}"
- else
- local desktop_name="${PN}-${slot}"
- fi
+
local desktop_exec="${exec%%[[:space:]]*}"
desktop_exec="${desktop_exec##*/}"
+ local desktop_suffix="-${PN}"
+ [[ ${SLOT%/*} != 0 ]] && desktop_suffix+="-${SLOT%/*}"
+ # Replace foo-foo.desktop by foo.desktop
+ [[ ${desktop_suffix#-} == "${desktop_exec}" ]] && desktop_suffix=""
# Prevent collisions if a file with the same name already exists #771708
- local desktop="${desktop_exec}-${desktop_name}" count=0
+ local desktop="${desktop_exec}${desktop_suffix}" count=0
while [[ -e ${ED}/usr/share/applications/${desktop}.desktop ]]; do
- desktop="${desktop_exec}-$((++count))-${desktop_name}"
+ desktop="${desktop_exec}-$((++count))${desktop_suffix}"
done
desktop="${T}/${desktop}.desktop"