* [gentoo-dev] [PATCH 0/2] desktop.eclass: Install files as foo.desktop rather than foo-foo.desktop
@ 2022-10-01 8:39 Ulrich Müller
2022-10-01 8:39 ` [gentoo-dev] [PATCH 1/2] " Ulrich Müller
2022-10-01 8:39 ` [gentoo-dev] [PATCH 2/2] desktop.eclass: Add EAPI guard Ulrich Müller
0 siblings, 2 replies; 3+ messages in thread
From: Ulrich Müller @ 2022-10-01 8:39 UTC (permalink / raw
To: gentoo-dev; +Cc: Ulrich Müller
This came up in bug 771708. Currently desktop.eclass installs files
under the name <exec>-<package>.desktop, but in the simple and most
common case <exec> and <package> are the same. So the files end up as
foo-foo.desktop which is a little ugly.
The first patch will check for the two components being equal and
replace foo-foo by foo if they are.
The second patch adds an EAPI guard.
Any opinions?
Ulrich Müller (2):
desktop.eclass: Install files as foo.desktop rather than
foo-foo.desktop
desktop.eclass: Add EAPI guard
eclass/desktop.eclass | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
--
2.37.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [gentoo-dev] [PATCH 1/2] desktop.eclass: Install files as foo.desktop rather than foo-foo.desktop
2022-10-01 8:39 [gentoo-dev] [PATCH 0/2] desktop.eclass: Install files as foo.desktop rather than foo-foo.desktop Ulrich Müller
@ 2022-10-01 8:39 ` Ulrich Müller
2022-10-01 8:39 ` [gentoo-dev] [PATCH 2/2] desktop.eclass: Add EAPI guard Ulrich Müller
1 sibling, 0 replies; 3+ messages in thread
From: Ulrich Müller @ 2022-10-01 8:39 UTC (permalink / raw
To: gentoo-dev; +Cc: Ulrich Müller
Bug: https://bugs.gentoo.org/771708#c14
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
---
eclass/desktop.eclass | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/eclass/desktop.eclass b/eclass/desktop.eclass
index de912bb80932..01de8b61ae1c 100644
--- a/eclass/desktop.eclass
+++ b/eclass/desktop.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: desktop.eclass
@@ -156,19 +156,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"
--
2.37.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [gentoo-dev] [PATCH 2/2] desktop.eclass: Add EAPI guard
2022-10-01 8:39 [gentoo-dev] [PATCH 0/2] desktop.eclass: Install files as foo.desktop rather than foo-foo.desktop Ulrich Müller
2022-10-01 8:39 ` [gentoo-dev] [PATCH 1/2] " Ulrich Müller
@ 2022-10-01 8:39 ` Ulrich Müller
1 sibling, 0 replies; 3+ messages in thread
From: Ulrich Müller @ 2022-10-01 8:39 UTC (permalink / raw
To: gentoo-dev; +Cc: Ulrich Müller
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
---
eclass/desktop.eclass | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/eclass/desktop.eclass b/eclass/desktop.eclass
index 01de8b61ae1c..aa1b9ac68d85 100644
--- a/eclass/desktop.eclass
+++ b/eclass/desktop.eclass
@@ -4,8 +4,14 @@
# @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
--
2.37.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-10-01 8:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-01 8:39 [gentoo-dev] [PATCH 0/2] desktop.eclass: Install files as foo.desktop rather than foo-foo.desktop Ulrich Müller
2022-10-01 8:39 ` [gentoo-dev] [PATCH 1/2] " Ulrich Müller
2022-10-01 8:39 ` [gentoo-dev] [PATCH 2/2] desktop.eclass: Add EAPI guard Ulrich Müller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox